Add PN_LOCAL escaping
authorGavin Carothers <gavin@carothers.name>
Sat, 10 Dec 2011 20:14:35 -0800
changeset 190 69e51087cfa0
parent 189 79138c67c8db
child 191 c223d03f36b8
Add PN_LOCAL escaping
rdf-turtle/turtle.bnf
--- a/rdf-turtle/turtle.bnf	Sat Dec 10 20:11:30 2011 -0800
+++ b/rdf-turtle/turtle.bnf	Sat Dec 10 20:14:35 2011 -0800
@@ -66,7 +66,6 @@
  
 [18] PREFIX ::= "@prefix" 
 
-#[70s] IRI_REF ::= "<" ( [^<>\"{}|^`\\] - [#0000- ] | UCHAR )* ">" 
 [70s] IRI_REF ::= "<" ( [^<>\"{}|^`\\] - [#x00-#x20] | UCHAR )* ">" 
  
 [71s] PNAME_NS ::= (PN_PREFIX)? ":" 
@@ -107,9 +106,9 @@
  
 [90s] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^\"\\] | ECHAR | UCHAR ) )* '"""' 
  
-[19] UCHAR ::= ( "\\u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] ) 
- | ( "\\U" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] 
- [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] ) 
+[19] UCHAR ::= ( "\\u" HEX HEX HEX HEX ) 
+ | ( "\\U" HEX HEX HEX HEX HEX HEX HEX HEX ) 
+
 [91s] ECHAR ::= "\\" [tbnrf\\\"'] 
  
 [92s] NIL ::= "(" (WS)* ")" 
@@ -145,7 +144,15 @@
  | [#203F-#2040] 
 [99s] PN_PREFIX ::= PN_CHARS_BASE ( ( PN_CHARS | "." )* PN_CHARS )? 
  
-[100s] PN_LOCAL ::= ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | "." )* PN_CHARS )? 
+[100s] PN_LOCAL ::= ( PN_CHARS_U | [0-9] | PLX ) ( ( PN_CHARS | '.' | PLX )*  ( PN_CHARS | PLX ) ) ?
+
+[160s] PLX ::= PERCENT | PN_LOCAL_ESC
+
+[161s] PERCENT ::= '%' HEX HEX
+
+[162s] HEX ::= [0-9] | [A-F] | [a-f]
+
+[163s] PN_LOCAL_ESC ::= '\\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | ':' | '/' | '?' | '#' | '@' | '%' )
  
 @pass ::= [ \t\r\n]+ 
  | "#" [^\r\n]* 
\ No newline at end of file