Clean up N-Triples grammar
authorGavin Carothers <gavin@carothers.name>
Mon, 30 Apr 2012 19:06:21 -0700
changeset 274 d8fcbd818477
parent 273 aa4d6fe27e25
child 275 ea5a6e17c056
Clean up N-Triples grammar
rdf-turtle/n-prime.bnf
--- a/rdf-turtle/n-prime.bnf	Mon Apr 30 18:46:37 2012 -0700
+++ b/rdf-turtle/n-prime.bnf	Mon Apr 30 19:06:21 2012 -0700
@@ -1,42 +1,39 @@
-[1]  ntriplesDoc             ::= triple? (EOL triple)* EOL?
-[2]  triple                  ::= subj pred obj '.'
-[3]  subj                    ::= IRI_REF | BLANK_NODE_LABEL
-[4]  pred                    ::= IRI_REF 
-[5]  obj                     ::= IRI_REF | BLANK_NODE_LABEL | lit
-[6]  lit                     ::= STRING_LITERAL2 ('^^' IRI_REF | ('@' LANG) )?
+[1]  ntriplesDoc        ::= triple? (EOL triple)* EOL?
+[2]  triple             ::= subj pred obj '.'
+[3]  subjects           ::= IRIREF | BLANK_NODE_LABEL
+[4]  predicate          ::= IRIREF 
+[5]  object             ::= IRIREF | BLANK_NODE_LABEL | lit
+[6]  literal            ::= STRING_LITERAL2 ('^^' IRIREF | ('@' LANG) )?
 
 @terminals
-[7]  LANG                    ::= [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )*
-
-[8]  EOL                     ::= [\r\n]+
+[7]  LANG               ::= [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )*
 
-[70s] IRI_REF           ::= '<' ([^<>"{}|^`\]-[#x00-#x20] | UCHAR )* '>'
-[73s] BLANK_NODE_LABEL  ::= "_:" PN_LOCAL 
-[88s] STRING_LITERAL2   ::= '"' ( ( [^\"\\\n\r] ) | ECHAR | UCHAR )* '"' 
-[19]  UCHAR             ::= ( "\\u" HEX HEX HEX HEX ) 
-                          | ( "\\U" HEX HEX HEX HEX HEX HEX HEX HEX ) 
-[91s] ECHAR             ::= "\\" [tbnrf\\\"'] 
-[95s] PN_CHARS_BASE     ::= [A-Z] 
-                          | [a-z] 
-                          | [#00C0-#00D6] 
-                          | [#00D8-#00F6] 
-                          | [#00F8-#02FF] 
-                          | [#0370-#037D] 
-                          | [#037F-#1FFF] 
-                          | [#200C-#200D] 
-                          | [#2070-#218F] 
-                          | [#2C00-#2FEF] 
-                          | [#3001-#D7FF] 
-                          | [#F900-#FDCF] 
-                          | [#FDF0-#FFFD] 
-                          | [#10000-#EFFFF] 
-[96s] PN_CHARS_U        ::= PN_CHARS_BASE 
-                          | "_" 
-[98s] PN_CHARS          ::= PN_CHARS_U 
-                          | "-" 
-                          | [0-9] 
-                          | #00B7 
-                          | [#0300-#036F] 
-                          | [#203F-#2040] 
-[100s] PN_LOCAL         ::= ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | "." )* PN_CHARS )?
+[8]  EOL                ::= [\r\n]+
+
+[132s] IRIREF           ::= '<' ([^<>"{}|^`\]-[#x00-#x20])* | UCHAR '>'
+[135s] BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?
+[150s] STRING_LITERAL2  ::= '"' ( ( [^#x22#x5C#xA#xD]) | ECHAR | UCHAR )* '"' 
+[19] UCHAR ::= ( "\u" HEX HEX HEX HEX ) 
+ | ( "\U" HEX HEX HEX HEX HEX HEX HEX HEX ) 
+[153s] ECHAR ::= "\" [tbnrf\"'] 
+[157s] PN_CHARS_BASE    ::= [A-Z] 
+                        | [a-z] 
+                        | [#00C0-#00D6] 
+                        | [#00D8-#00F6] 
+                        | [#00F8-#02FF] 
+                        | [#0370-#037D] 
+                        | [#037F-#1FFF] 
+                        | [#200C-#200D] 
+                        | [#2070-#218F] 
+                        | [#2C00-#2FEF] 
+                        | [#3001-#D7FF] 
+                        | [#F900-#FDCF] 
+                        | [#FDF0-#FFFD] 
+                        | [#10000-#EFFFF] 
+[160s] PN_CHARS         ::= PN_CHARS_U 
+                        | "-" 
+                        | [0-9] 
+                        | #00B7 
+                        | [#0300-#036F] 
+                        | [#203F-#2040] 
 [162s] HEX              ::= [0-9] | [A-F] | [a-f]
\ No newline at end of file