ebnf 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/etc/turtle.peg.sxp CHANGED
@@ -1,199 +1,190 @@
1
1
  (
2
- (rule turtleDoc "1" (star statement))
3
- (rule statement "2" (alt directive _statement_1))
4
- (rule _statement_1 "2.1" (seq triples "."))
5
- (rule directive "3" (alt prefixID base sparqlPrefix sparqlBase))
6
- (rule prefixID "4" (seq "@prefix" PNAME_NS IRIREF "."))
7
- (rule base "5" (seq "@base" IRIREF "."))
8
- (rule triples "6" (alt _triples_1 _triples_2))
9
- (rule _triples_1 "6.1" (seq subject predicateObjectList))
10
- (rule _triples_2 "6.2" (seq blankNodePropertyList _triples_3))
11
- (rule _triples_3 "6.3" (opt predicateObjectList))
12
- (rule predicateObjectList "7" (seq verb objectList _predicateObjectList_1))
13
- (rule _predicateObjectList_1 "7.1" (star _predicateObjectList_2))
14
- (rule _predicateObjectList_2 "7.2" (seq ";" _predicateObjectList_3))
15
- (rule _predicateObjectList_3 "7.3" (opt _predicateObjectList_4))
16
- (rule _predicateObjectList_4 "7.4" (seq verb objectList))
17
- (rule objectList "8" (seq object _objectList_1))
18
- (rule _objectList_1 "8.1" (star _objectList_2))
19
- (rule _objectList_2 "8.2" (seq "," object))
20
- (rule verb "9" (alt predicate "a"))
21
- (rule subject "10" (alt iri BlankNode collection))
22
- (rule predicate "11" (seq iri))
23
- (rule object "12" (alt iri BlankNode collection blankNodePropertyList literal))
24
- (rule literal "13" (alt RDFLiteral NumericLiteral BooleanLiteral))
25
- (rule blankNodePropertyList "14" (seq "[" predicateObjectList "]"))
26
- (rule collection "15" (seq "(" _collection_1 ")"))
27
- (rule _collection_1 "15.1" (star object))
28
- (rule NumericLiteral "16" (alt INTEGER DECIMAL DOUBLE))
29
- (rule String "17"
2
+ (rule turtleDoc (star statement))
3
+ (rule statement (alt directive _statement_1))
4
+ (rule _statement_1 (seq triples '.'))
5
+ (rule directive (alt prefixID base sparqlPrefix sparqlBase))
6
+ (rule prefixID (seq '@prefix' PNAME_NS IRIREF '.'))
7
+ (rule base (seq '@base' IRIREF '.'))
8
+ (rule sparqlPrefix (seq "PREFIX" PNAME_NS IRIREF))
9
+ (rule sparqlBase (seq "BASE" IRIREF))
10
+ (rule triples (alt _triples_1 _triples_2))
11
+ (rule _triples_1 (seq subject predicateObjectList))
12
+ (rule _triples_2 (seq blankNodePropertyList _triples_3))
13
+ (rule _triples_3 (opt predicateObjectList))
14
+ (rule predicateObjectList (seq verb objectList _predicateObjectList_1))
15
+ (rule _predicateObjectList_1 (star _predicateObjectList_2))
16
+ (rule _predicateObjectList_2 (seq ';' _predicateObjectList_3))
17
+ (rule _predicateObjectList_3 (opt _predicateObjectList_4))
18
+ (rule _predicateObjectList_4 (seq verb objectList))
19
+ (rule objectList (seq object _objectList_1))
20
+ (rule _objectList_1 (star _objectList_2))
21
+ (rule _objectList_2 (seq ',' object))
22
+ (rule verb (alt predicate 'a'))
23
+ (rule subject (alt iri BlankNode collection))
24
+ (rule predicate (seq iri))
25
+ (rule object (alt iri BlankNode collection blankNodePropertyList literal))
26
+ (rule literal (alt RDFLiteral NumericLiteral BooleanLiteral))
27
+ (rule blankNodePropertyList (seq '[' predicateObjectList ']'))
28
+ (rule collection (seq '(' _collection_1 ')'))
29
+ (rule _collection_1 (star object))
30
+ (rule NumericLiteral (alt INTEGER DECIMAL DOUBLE))
31
+ (rule RDFLiteral (seq String _RDFLiteral_1))
32
+ (rule _RDFLiteral_1 (opt _RDFLiteral_2))
33
+ (rule _RDFLiteral_2 (alt LANGTAG _RDFLiteral_3))
34
+ (rule _RDFLiteral_3 (seq '^^' iri))
35
+ (rule BooleanLiteral (alt 'true' 'false'))
36
+ (rule String
30
37
  (alt STRING_LITERAL_QUOTE STRING_LITERAL_SINGLE_QUOTE
31
38
  STRING_LITERAL_LONG_SINGLE_QUOTE STRING_LITERAL_LONG_QUOTE ))
32
- (terminal IRIREF "18" (seq "<" _IRIREF_1))
33
- (terminal _IRIREF_1 "18.1" (range "^#x00-#x20<>\"{}|^`] | UCHAR)* '>'"))
34
- (terminal INTEGER "19" (seq _INTEGER_1 _INTEGER_2))
35
- (terminal _INTEGER_1 "19.1" (opt _INTEGER_3))
36
- (terminal _INTEGER_2 "19.2" (plus _INTEGER_4))
37
- (terminal _INTEGER_3 "19.3" (range "+-"))
38
- (terminal _INTEGER_4 "19.4" (range "0-9"))
39
- (terminal DECIMAL "20" (seq _DECIMAL_1 _DECIMAL_2))
40
- (terminal _DECIMAL_1 "20.1" (opt _DECIMAL_3))
41
- (terminal _DECIMAL_2 "20.2" (seq _DECIMAL_4 "." _DECIMAL_5))
42
- (terminal _DECIMAL_3 "20.3" (range "+-"))
43
- (terminal _DECIMAL_4 "20.4" (star _DECIMAL_6))
44
- (terminal _DECIMAL_5 "20.5" (plus _DECIMAL_7))
45
- (terminal _DECIMAL_6 "20.6" (range "0-9"))
46
- (terminal _DECIMAL_7 "20.7" (range "0-9"))
47
- (terminal DOUBLE "21" (seq _DOUBLE_1 _DOUBLE_2))
48
- (terminal _DOUBLE_1 "21.1" (opt _DOUBLE_3))
49
- (terminal _DOUBLE_10 "21.10" (range "0-9"))
50
- (terminal _DOUBLE_11 "21.11" (plus _DOUBLE_12))
51
- (terminal _DOUBLE_12 "21.12" (range "0-9"))
52
- (terminal _DOUBLE_13 "21.13" (plus _DOUBLE_14))
53
- (terminal _DOUBLE_14 "21.14" (range "0-9"))
54
- (terminal _DOUBLE_2 "21.2" (alt _DOUBLE_4 _DOUBLE_5 _DOUBLE_6))
55
- (terminal _DOUBLE_3 "21.3" (range "+-"))
56
- (terminal _DOUBLE_4 "21.4" (seq _DOUBLE_7 "." _DOUBLE_8 EXPONENT))
57
- (terminal _DOUBLE_5 "21.5" (seq "." _DOUBLE_11 EXPONENT))
58
- (terminal _DOUBLE_6 "21.6" (seq _DOUBLE_13 EXPONENT))
59
- (terminal _DOUBLE_7 "21.7" (plus _DOUBLE_9))
60
- (terminal _DOUBLE_8 "21.8" (star _DOUBLE_10))
61
- (terminal _DOUBLE_9 "21.9" (range "0-9"))
62
- (terminal STRING_LITERAL_QUOTE "22" (seq "\"" _STRING_LITERAL_QUOTE_1 "\""))
63
- (terminal _STRING_LITERAL_QUOTE_1 "22.1" (star _STRING_LITERAL_QUOTE_2))
64
- (terminal _STRING_LITERAL_QUOTE_2 "22.2" (alt _STRING_LITERAL_QUOTE_3 ECHAR UCHAR))
65
- (terminal _STRING_LITERAL_QUOTE_3 "22.3" (range "^#x22#x5C#xA#xD"))
66
- (terminal STRING_LITERAL_SINGLE_QUOTE "23"
67
- (seq "'" _STRING_LITERAL_SINGLE_QUOTE_1 "'"))
68
- (terminal _STRING_LITERAL_SINGLE_QUOTE_1 "23.1"
69
- (star _STRING_LITERAL_SINGLE_QUOTE_2))
70
- (terminal _STRING_LITERAL_SINGLE_QUOTE_2 "23.2"
39
+ (rule iri (alt IRIREF PrefixedName))
40
+ (rule PrefixedName (alt PNAME_LN PNAME_NS))
41
+ (rule BlankNode (alt BLANK_NODE_LABEL ANON))
42
+ (terminals _terminals (seq))
43
+ (terminal IRIREF (seq '<' _IRIREF_1 '>'))
44
+ (terminal _IRIREF_1 (star _IRIREF_2))
45
+ (terminal _IRIREF_2 (alt _IRIREF_3 UCHAR))
46
+ (terminal _IRIREF_3 (range "^#x00-#x20<>\"{}|^`\\"))
47
+ (terminal PNAME_NS (seq _PNAME_NS_1 ':'))
48
+ (terminal _PNAME_NS_1 (opt PN_PREFIX))
49
+ (terminal PNAME_LN (seq PNAME_NS PN_LOCAL))
50
+ (terminal BLANK_NODE_LABEL (seq '_:' _BLANK_NODE_LABEL_1 _BLANK_NODE_LABEL_2))
51
+ (terminal _BLANK_NODE_LABEL_1 (alt PN_CHARS_U _BLANK_NODE_LABEL_3))
52
+ (terminal _BLANK_NODE_LABEL_3 (range "0-9"))
53
+ (terminal _BLANK_NODE_LABEL_2 (opt _BLANK_NODE_LABEL_4))
54
+ (terminal _BLANK_NODE_LABEL_4 (seq _BLANK_NODE_LABEL_5 PN_CHARS))
55
+ (terminal _BLANK_NODE_LABEL_5 (star _BLANK_NODE_LABEL_6))
56
+ (terminal _BLANK_NODE_LABEL_6 (alt PN_CHARS '.'))
57
+ (terminal LANGTAG (seq '@' _LANGTAG_1 _LANGTAG_2))
58
+ (terminal _LANGTAG_1 (plus _LANGTAG_3))
59
+ (terminal _LANGTAG_3 (range "a-zA-Z"))
60
+ (terminal _LANGTAG_2 (star _LANGTAG_4))
61
+ (terminal _LANGTAG_4 (seq '-' _LANGTAG_5))
62
+ (terminal _LANGTAG_5 (plus _LANGTAG_6))
63
+ (terminal _LANGTAG_6 (range "a-zA-Z0-9"))
64
+ (terminal INTEGER (seq _INTEGER_1 _INTEGER_2))
65
+ (terminal _INTEGER_1 (opt _INTEGER_3))
66
+ (terminal _INTEGER_3 (range "+-"))
67
+ (terminal _INTEGER_2 (plus _INTEGER_4))
68
+ (terminal _INTEGER_4 (range "0-9"))
69
+ (terminal DECIMAL (seq _DECIMAL_1 _DECIMAL_2))
70
+ (terminal _DECIMAL_1 (opt _DECIMAL_3))
71
+ (terminal _DECIMAL_3 (range "+-"))
72
+ (terminal _DECIMAL_2 (seq _DECIMAL_4 '.' _DECIMAL_5))
73
+ (terminal _DECIMAL_4 (star _DECIMAL_6))
74
+ (terminal _DECIMAL_6 (range "0-9"))
75
+ (terminal _DECIMAL_5 (plus _DECIMAL_7))
76
+ (terminal _DECIMAL_7 (range "0-9"))
77
+ (terminal DOUBLE (seq _DOUBLE_1 _DOUBLE_2))
78
+ (terminal _DOUBLE_1 (opt _DOUBLE_3))
79
+ (terminal _DOUBLE_3 (range "+-"))
80
+ (terminal _DOUBLE_2 (alt _DOUBLE_4 _DOUBLE_5 _DOUBLE_6))
81
+ (terminal _DOUBLE_4 (seq _DOUBLE_7 '.' _DOUBLE_8 EXPONENT))
82
+ (terminal _DOUBLE_7 (plus _DOUBLE_9))
83
+ (terminal _DOUBLE_9 (range "0-9"))
84
+ (terminal _DOUBLE_8 (star _DOUBLE_10))
85
+ (terminal _DOUBLE_10 (range "0-9"))
86
+ (terminal _DOUBLE_5 (seq '.' _DOUBLE_11 EXPONENT))
87
+ (terminal _DOUBLE_11 (plus _DOUBLE_12))
88
+ (terminal _DOUBLE_12 (range "0-9"))
89
+ (terminal _DOUBLE_6 (seq _DOUBLE_13 EXPONENT))
90
+ (terminal _DOUBLE_13 (plus _DOUBLE_14))
91
+ (terminal _DOUBLE_14 (range "0-9"))
92
+ (terminal EXPONENT (seq _EXPONENT_1 _EXPONENT_2 _EXPONENT_3))
93
+ (terminal _EXPONENT_1 (range "eE"))
94
+ (terminal _EXPONENT_2 (opt _EXPONENT_4))
95
+ (terminal _EXPONENT_4 (range "+-"))
96
+ (terminal _EXPONENT_3 (plus _EXPONENT_5))
97
+ (terminal _EXPONENT_5 (range "0-9"))
98
+ (terminal STRING_LITERAL_QUOTE (seq '"' _STRING_LITERAL_QUOTE_1 '"'))
99
+ (terminal _STRING_LITERAL_QUOTE_1 (star _STRING_LITERAL_QUOTE_2))
100
+ (terminal _STRING_LITERAL_QUOTE_2 (alt _STRING_LITERAL_QUOTE_3 ECHAR UCHAR))
101
+ (terminal _STRING_LITERAL_QUOTE_3 (range "^#x22#x5C#xA#xD"))
102
+ (terminal STRING_LITERAL_SINGLE_QUOTE (seq "'" _STRING_LITERAL_SINGLE_QUOTE_1 "'"))
103
+ (terminal _STRING_LITERAL_SINGLE_QUOTE_1 (star _STRING_LITERAL_SINGLE_QUOTE_2))
104
+ (terminal _STRING_LITERAL_SINGLE_QUOTE_2
71
105
  (alt _STRING_LITERAL_SINGLE_QUOTE_3 ECHAR UCHAR))
72
- (terminal _STRING_LITERAL_SINGLE_QUOTE_3 "23.3" (range "^#x27#x5C#xA#xD"))
73
- (terminal STRING_LITERAL_LONG_SINGLE_QUOTE "24"
74
- (seq "'''" _STRING_LITERAL_LONG_SINGLE_QUOTE_1))
75
- (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_1 "24.1"
76
- (seq _STRING_LITERAL_LONG_SINGLE_QUOTE_2 _STRING_LITERAL_LONG_SINGLE_QUOTE_3))
77
- (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_2 "24.2"
78
- (opt _STRING_LITERAL_LONG_SINGLE_QUOTE_4))
79
- (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_3 "24.3"
80
- (range "^'] | ECHAR | UCHAR ))* \"'''\""))
81
- (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_4 "24.4" (alt "'" "''"))
82
- (terminal STRING_LITERAL_LONG_QUOTE "25"
83
- (seq "\"\"\"" _STRING_LITERAL_LONG_QUOTE_1))
84
- (terminal _STRING_LITERAL_LONG_QUOTE_1 "25.1"
85
- (seq _STRING_LITERAL_LONG_QUOTE_2 _STRING_LITERAL_LONG_QUOTE_3))
86
- (terminal _STRING_LITERAL_LONG_QUOTE_2 "25.2" (opt _STRING_LITERAL_LONG_QUOTE_4))
87
- (terminal _STRING_LITERAL_LONG_QUOTE_3 "25.3"
88
- (range "^\"] | ECHAR | UCHAR ))* '\"\"\"'"))
89
- (terminal _STRING_LITERAL_LONG_QUOTE_4 "25.4" (alt "\"" "\"\""))
90
- (terminal UCHAR "26" (alt _UCHAR_1 _UCHAR_2))
91
- (terminal _UCHAR_1 "26.1" (seq "u" HEX HEX HEX HEX))
92
- (terminal _UCHAR_2 "26.2" (seq "U" HEX HEX HEX HEX HEX HEX HEX HEX))
93
- (terminal _SPARQL_PREFIX_4 "28t.4" (range "Ff"))
94
- (terminal _SPARQL_PREFIX_3 "28t.3" (range "Ee"))
95
- (terminal _SPARQL_PREFIX_2 "28t.2" (range "Rr"))
96
- (terminal _SPARQL_PREFIX_1 "28t.1" (range "Pp"))
97
- (terminal SPARQL_PREFIX "28t"
98
- (seq _SPARQL_PREFIX_1 _SPARQL_PREFIX_2 _SPARQL_PREFIX_3 _SPARQL_PREFIX_4
99
- _SPARQL_PREFIX_5 _SPARQL_PREFIX_6 ))
100
- (rule sparqlPrefix "28s" (seq SPARQL_PREFIX PNAME_NS IRIREF))
101
- (terminal _SPARQL_PREFIX_6 "28t.6" (range "Xx"))
102
- (terminal _SPARQL_PREFIX_5 "28t.5" (range "Ii"))
103
- (terminal _SPARQL_BASE_3 "29t.3" (range "Ss"))
104
- (terminal _SPARQL_BASE_4 "29t.4" (range "Ee"))
105
- (terminal _SPARQL_BASE_2 "29t.2" (range "Aa"))
106
- (terminal _SPARQL_BASE_1 "29t.1" (range "Bb"))
107
- (terminal SPARQL_BASE "29t"
108
- (seq _SPARQL_BASE_1 _SPARQL_BASE_2 _SPARQL_BASE_3 _SPARQL_BASE_4))
109
- (rule sparqlBase "29s" (seq SPARQL_BASE IRIREF))
110
- (rule RDFLiteral "128s" (seq String _RDFLiteral_1))
111
- (rule _RDFLiteral_1 "128s.1" (opt _RDFLiteral_2))
112
- (rule _RDFLiteral_2 "128s.2" (alt LANGTAG _RDFLiteral_3))
113
- (rule _RDFLiteral_3 "128s.3" (seq "^^" iri))
114
- (rule BooleanLiteral "133s" (alt "true" "false"))
115
- (rule iri "135s" (alt IRIREF PrefixedName))
116
- (rule PrefixedName "136s" (alt PNAME_LN PNAME_NS))
117
- (rule BlankNode "137s" (alt BLANK_NODE_LABEL ANON))
118
- (terminal PNAME_NS "139s" (seq _PNAME_NS_1 ":"))
119
- (terminal _PNAME_NS_1 "139s.1" (opt PN_PREFIX))
120
- (terminal PNAME_LN "140s" (seq PNAME_NS PN_LOCAL))
121
- (terminal _BLANK_NODE_LABEL_2 "141s.2" (opt _BLANK_NODE_LABEL_4))
122
- (terminal _BLANK_NODE_LABEL_6 "141s.6" (alt PN_CHARS "."))
123
- (terminal _BLANK_NODE_LABEL_4 "141s.4" (seq _BLANK_NODE_LABEL_5 PN_CHARS))
124
- (terminal _BLANK_NODE_LABEL_5 "141s.5" (star _BLANK_NODE_LABEL_6))
125
- (terminal BLANK_NODE_LABEL "141s"
126
- (seq "_:" _BLANK_NODE_LABEL_1 _BLANK_NODE_LABEL_2))
127
- (terminal _BLANK_NODE_LABEL_1 "141s.1" (alt PN_CHARS_U _BLANK_NODE_LABEL_3))
128
- (terminal _BLANK_NODE_LABEL_3 "141s.3" (range "0-9"))
129
- (terminal _LANGTAG_4 "144s.4" (seq "-" _LANGTAG_5))
130
- (terminal _LANGTAG_5 "144s.5" (plus _LANGTAG_6))
131
- (terminal _LANGTAG_6 "144s.6" (range "a-zA-Z0-9"))
132
- (terminal LANGTAG "144s" (seq "@" _LANGTAG_1 _LANGTAG_2))
133
- (terminal _LANGTAG_1 "144s.1" (plus _LANGTAG_3))
134
- (terminal _LANGTAG_3 "144s.3" (range "a-zA-Z"))
135
- (terminal _LANGTAG_2 "144s.2" (star _LANGTAG_4))
136
- (terminal _EXPONENT_3 "154s.3" (plus _EXPONENT_5))
137
- (terminal _EXPONENT_5 "154s.5" (range "0-9"))
138
- (terminal _EXPONENT_1 "154s.1" (range "eE"))
139
- (terminal EXPONENT "154s" (seq _EXPONENT_1 _EXPONENT_2 _EXPONENT_3))
140
- (terminal _EXPONENT_2 "154s.2" (opt _EXPONENT_4))
141
- (terminal _EXPONENT_4 "154s.4" (range "+-"))
142
- (terminal _ECHAR_1 "159s.1" (range "tbnrf\"'"))
143
- (terminal ECHAR "159s" (seq "\\" _ECHAR_1))
144
- (terminal _WS_2 "161s.2" (hex "#x9"))
145
- (terminal _WS_3 "161s.3" (hex "#xD"))
146
- (terminal _WS_4 "161s.4" (hex "#xA"))
147
- (terminal _WS_1 "161s.1" (hex "#x20"))
148
- (terminal WS "161s" (alt _WS_1 _WS_2 _WS_3 _WS_4))
149
- (terminal ANON "162s" (seq "[" _ANON_1 "]"))
150
- (terminal _ANON_1 "162s.1" (star WS))
151
- (terminal _PN_CHARS_BASE_7 "163s.7" (range "#x037F-#x1FFF"))
152
- (terminal _PN_CHARS_BASE_8 "163s.8" (range "#x200C-#x200D"))
153
- (terminal _PN_CHARS_BASE_9 "163s.9" (range "#x2070-#x218F"))
154
- (terminal _PN_CHARS_BASE_10 "163s.10" (range "#x2C00-#x2FEF"))
155
- (terminal _PN_CHARS_BASE_11 "163s.11" (range "#x3001-#xD7FF"))
156
- (terminal _PN_CHARS_BASE_12 "163s.12" (range "#xF900-#xFDCF"))
157
- (terminal _PN_CHARS_BASE_13 "163s.13" (range "#xFDF0-#xFFFD"))
158
- (terminal _PN_CHARS_BASE_14 "163s.14" (range "#x10000-#xEFFFF"))
159
- (terminal _PN_CHARS_BASE_4 "163s.4" (range "#x00D8-#x00F6"))
160
- (terminal PN_CHARS_BASE "163s"
106
+ (terminal _STRING_LITERAL_SINGLE_QUOTE_3 (range "^#x27#x5C#xA#xD"))
107
+ (terminal STRING_LITERAL_LONG_SINGLE_QUOTE
108
+ (seq "'''" _STRING_LITERAL_LONG_SINGLE_QUOTE_1 "'''"))
109
+ (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_1
110
+ (star _STRING_LITERAL_LONG_SINGLE_QUOTE_2))
111
+ (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_2
112
+ (seq _STRING_LITERAL_LONG_SINGLE_QUOTE_3 _STRING_LITERAL_LONG_SINGLE_QUOTE_4))
113
+ (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_3
114
+ (opt _STRING_LITERAL_LONG_SINGLE_QUOTE_5))
115
+ (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_5 (alt "'" "''"))
116
+ (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_4
117
+ (alt _STRING_LITERAL_LONG_SINGLE_QUOTE_6 ECHAR UCHAR))
118
+ (terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_6 (range "^'\\"))
119
+ (terminal STRING_LITERAL_LONG_QUOTE (seq '"""' _STRING_LITERAL_LONG_QUOTE_1 '"""'))
120
+ (terminal _STRING_LITERAL_LONG_QUOTE_1 (star _STRING_LITERAL_LONG_QUOTE_2))
121
+ (terminal _STRING_LITERAL_LONG_QUOTE_2
122
+ (seq _STRING_LITERAL_LONG_QUOTE_3 _STRING_LITERAL_LONG_QUOTE_4))
123
+ (terminal _STRING_LITERAL_LONG_QUOTE_3 (opt _STRING_LITERAL_LONG_QUOTE_5))
124
+ (terminal _STRING_LITERAL_LONG_QUOTE_5 (alt '"' '""'))
125
+ (terminal _STRING_LITERAL_LONG_QUOTE_4
126
+ (alt _STRING_LITERAL_LONG_QUOTE_6 ECHAR UCHAR))
127
+ (terminal _STRING_LITERAL_LONG_QUOTE_6 (range "^\"\\"))
128
+ (terminal UCHAR (alt _UCHAR_1 _UCHAR_2))
129
+ (terminal _UCHAR_1 (seq 'u' HEX HEX HEX HEX))
130
+ (terminal _UCHAR_2 (seq 'U' HEX HEX HEX HEX HEX HEX HEX HEX))
131
+ (terminal ECHAR (seq '\\' _ECHAR_1))
132
+ (terminal _ECHAR_1 (range "tbnrf\"'"))
133
+ (terminal NIL (seq '(' _NIL_1 ')'))
134
+ (terminal _NIL_1 (star WS))
135
+ (terminal WS (alt _WS_1 _WS_2 _WS_3 _WS_4))
136
+ (terminal _WS_1 (hex "#x20"))
137
+ (terminal _WS_2 (hex "#x9"))
138
+ (terminal _WS_3 (hex "#xD"))
139
+ (terminal _WS_4 (hex "#xA"))
140
+ (terminal ANON (seq '[' _ANON_1 ']'))
141
+ (terminal _ANON_1 (star WS))
142
+ (terminal PN_CHARS_BASE
161
143
  (alt _PN_CHARS_BASE_1 _PN_CHARS_BASE_2 _PN_CHARS_BASE_3 _PN_CHARS_BASE_4
162
144
  _PN_CHARS_BASE_5 _PN_CHARS_BASE_6 _PN_CHARS_BASE_7 _PN_CHARS_BASE_8
163
145
  _PN_CHARS_BASE_9 _PN_CHARS_BASE_10 _PN_CHARS_BASE_11 _PN_CHARS_BASE_12
164
146
  _PN_CHARS_BASE_13 _PN_CHARS_BASE_14 ))
165
- (terminal _PN_CHARS_BASE_1 "163s.1" (range "A-Z"))
166
- (terminal _PN_CHARS_BASE_2 "163s.2" (range "a-z"))
167
- (terminal _PN_CHARS_BASE_3 "163s.3" (range "#x00C0-#x00D6"))
168
- (terminal _PN_CHARS_BASE_5 "163s.5" (range "#x00F8-#x02FF"))
169
- (terminal _PN_CHARS_BASE_6 "163s.6" (range "#x0370-#x037D"))
170
- (terminal PN_CHARS_U "164s" (alt PN_CHARS_BASE "_"))
171
- (terminal _PN_CHARS_1 "166s.1" (range "0-9"))
172
- (terminal PN_CHARS "166s"
173
- (alt PN_CHARS_U "-" _PN_CHARS_1 _PN_CHARS_2 _PN_CHARS_3 _PN_CHARS_4))
174
- (terminal _PN_CHARS_2 "166s.2" (hex "#x00B7"))
175
- (terminal _PN_CHARS_3 "166s.3" (range "#x0300-#x036F"))
176
- (terminal _PN_CHARS_4 "166s.4" (range "#x203F-#x2040"))
177
- (terminal _PN_PREFIX_4 "167s.4" (alt PN_CHARS "."))
178
- (terminal _PN_PREFIX_1 "167s.1" (opt _PN_PREFIX_2))
179
- (terminal PN_PREFIX "167s" (seq PN_CHARS_BASE _PN_PREFIX_1))
180
- (terminal _PN_PREFIX_2 "167s.2" (seq _PN_PREFIX_3 PN_CHARS))
181
- (terminal _PN_PREFIX_3 "167s.3" (star _PN_PREFIX_4))
182
- (terminal _PN_LOCAL_4 "168s.4" (seq _PN_LOCAL_5 _PN_LOCAL_6))
183
- (terminal _PN_LOCAL_7 "168s.7" (alt PN_CHARS "." ":" PLX))
184
- (terminal _PN_LOCAL_6 "168s.6" (alt PN_CHARS ":" PLX))
185
- (terminal _PN_LOCAL_5 "168s.5" (star _PN_LOCAL_7))
186
- (terminal PN_LOCAL "168s" (seq _PN_LOCAL_1 _PN_LOCAL_2))
187
- (terminal _PN_LOCAL_1 "168s.1" (alt PN_CHARS_U ":" _PN_LOCAL_3 PLX))
188
- (terminal _PN_LOCAL_3 "168s.3" (range "0-9"))
189
- (terminal _PN_LOCAL_2 "168s.2" (opt _PN_LOCAL_4))
190
- (terminal PLX "169s" (alt PERCENT PN_LOCAL_ESC))
191
- (terminal PERCENT "170s" (seq "%" HEX HEX))
192
- (terminal _HEX_1 "171s.1" (range "0-9"))
193
- (terminal _HEX_3 "171s.3" (range "a-f"))
194
- (terminal _HEX_2 "171s.2" (range "A-F"))
195
- (terminal HEX "171s" (alt _HEX_1 _HEX_2 _HEX_3))
196
- (terminal PN_LOCAL_ESC "172s" (seq "\\" _PN_LOCAL_ESC_1))
197
- (terminal _PN_LOCAL_ESC_1 "172s.1"
198
- (alt "_" "~" "." "-" "!" "$" "&" "'" "(" ")" "*" "+" "," ";" "=" "/" "?" "#"
199
- "@" "%" )) )
147
+ (terminal _PN_CHARS_BASE_1 (range "A-Z"))
148
+ (terminal _PN_CHARS_BASE_2 (range "a-z"))
149
+ (terminal _PN_CHARS_BASE_3 (range "#x00C0-#x00D6"))
150
+ (terminal _PN_CHARS_BASE_4 (range "#x00D8-#x00F6"))
151
+ (terminal _PN_CHARS_BASE_5 (range "#x00F8-#x02FF"))
152
+ (terminal _PN_CHARS_BASE_6 (range "#x0370-#x037D"))
153
+ (terminal _PN_CHARS_BASE_7 (range "#x037F-#x1FFF"))
154
+ (terminal _PN_CHARS_BASE_8 (range "#x200C-#x200D"))
155
+ (terminal _PN_CHARS_BASE_9 (range "#x2070-#x218F"))
156
+ (terminal _PN_CHARS_BASE_10 (range "#x2C00-#x2FEF"))
157
+ (terminal _PN_CHARS_BASE_11 (range "#x3001-#xD7FF"))
158
+ (terminal _PN_CHARS_BASE_12 (range "#xF900-#xFDCF"))
159
+ (terminal _PN_CHARS_BASE_13 (range "#xFDF0-#xFFFD"))
160
+ (terminal _PN_CHARS_BASE_14 (range "#x10000-#xEFFFF"))
161
+ (terminal PN_CHARS_U (alt PN_CHARS_BASE '_'))
162
+ (terminal PN_CHARS
163
+ (alt PN_CHARS_U '-' _PN_CHARS_1 _PN_CHARS_2 _PN_CHARS_3 _PN_CHARS_4))
164
+ (terminal _PN_CHARS_1 (range "0-9"))
165
+ (terminal _PN_CHARS_2 (hex "#x00B7"))
166
+ (terminal _PN_CHARS_3 (range "#x0300-#x036F"))
167
+ (terminal _PN_CHARS_4 (range "#x203F-#x2040"))
168
+ (terminal PN_PREFIX (seq PN_CHARS_BASE _PN_PREFIX_1))
169
+ (terminal _PN_PREFIX_1 (opt _PN_PREFIX_2))
170
+ (terminal _PN_PREFIX_2 (seq _PN_PREFIX_3 PN_CHARS))
171
+ (terminal _PN_PREFIX_3 (star _PN_PREFIX_4))
172
+ (terminal _PN_PREFIX_4 (alt PN_CHARS '.'))
173
+ (terminal PN_LOCAL (seq _PN_LOCAL_1 _PN_LOCAL_2))
174
+ (terminal _PN_LOCAL_1 (alt PN_CHARS_U ':' _PN_LOCAL_3 PLX))
175
+ (terminal _PN_LOCAL_3 (range "0-9"))
176
+ (terminal _PN_LOCAL_2 (opt _PN_LOCAL_4))
177
+ (terminal _PN_LOCAL_4 (seq _PN_LOCAL_5 _PN_LOCAL_6))
178
+ (terminal _PN_LOCAL_5 (star _PN_LOCAL_7))
179
+ (terminal _PN_LOCAL_7 (alt PN_CHARS '.' ':' PLX))
180
+ (terminal _PN_LOCAL_6 (alt PN_CHARS ':' PLX))
181
+ (terminal PLX (alt PERCENT PN_LOCAL_ESC))
182
+ (terminal PERCENT (seq '%' HEX HEX))
183
+ (terminal HEX (alt _HEX_1 _HEX_2 _HEX_3))
184
+ (terminal _HEX_1 (range "0-9"))
185
+ (terminal _HEX_2 (range "A-F"))
186
+ (terminal _HEX_3 (range "a-f"))
187
+ (terminal PN_LOCAL_ESC (seq '\\' _PN_LOCAL_ESC_1))
188
+ (terminal _PN_LOCAL_ESC_1
189
+ (alt '_' '~' '.' '-' '!' '$' '&' "'" '(' ')' '*' '+' ',' ';' '=' '/' '?' '#'
190
+ '@' '%' )) )
data/etc/turtle.sxp CHANGED
@@ -1,71 +1,66 @@
1
1
  (
2
- (rule turtleDoc "1" (star statement))
3
- (rule statement "2" (alt directive (seq triples ".")))
4
- (rule directive "3" (alt prefixID base sparqlPrefix sparqlBase))
5
- (rule prefixID "4" (seq "@prefix" PNAME_NS IRIREF "."))
6
- (rule base "5" (seq "@base" IRIREF "."))
7
- (rule sparqlPrefix "28s" (seq SPARQL_PREFIX PNAME_NS IRIREF))
8
- (rule sparqlBase "29s" (seq SPARQL_BASE IRIREF))
9
- (rule triples "6"
2
+ (rule turtleDoc (star statement))
3
+ (rule statement (alt directive (seq triples '.')))
4
+ (rule directive (alt prefixID base sparqlPrefix sparqlBase))
5
+ (rule prefixID (seq '@prefix' PNAME_NS IRIREF '.'))
6
+ (rule base (seq '@base' IRIREF '.'))
7
+ (rule sparqlPrefix (seq "PREFIX" PNAME_NS IRIREF))
8
+ (rule sparqlBase (seq "BASE" IRIREF))
9
+ (rule triples
10
10
  (alt
11
11
  (seq subject predicateObjectList)
12
12
  (seq blankNodePropertyList (opt predicateObjectList))) )
13
- (rule predicateObjectList "7"
14
- (seq verb objectList (star (seq ";" (opt (seq verb objectList))))))
15
- (rule objectList "8" (seq object (star (seq "," object))))
16
- (rule verb "9" (alt predicate "a"))
17
- (rule subject "10" (alt iri BlankNode collection))
18
- (rule predicate "11" (seq iri))
19
- (rule object "12" (alt iri BlankNode collection blankNodePropertyList literal))
20
- (rule literal "13" (alt RDFLiteral NumericLiteral BooleanLiteral))
21
- (rule blankNodePropertyList "14" (seq "[" predicateObjectList "]"))
22
- (rule collection "15" (seq "(" (star object) ")"))
23
- (rule NumericLiteral "16" (alt INTEGER DECIMAL DOUBLE))
24
- (rule RDFLiteral "128s" (seq String (opt (alt LANGTAG (seq "^^" iri)))))
25
- (rule BooleanLiteral "133s" (alt "true" "false"))
26
- (rule String "17"
13
+ (rule predicateObjectList
14
+ (seq verb objectList (star (seq ';' (opt (seq verb objectList))))))
15
+ (rule objectList (seq object (star (seq ',' object))))
16
+ (rule verb (alt predicate 'a'))
17
+ (rule subject (alt iri BlankNode collection))
18
+ (rule predicate (seq iri))
19
+ (rule object (alt iri BlankNode collection blankNodePropertyList literal))
20
+ (rule literal (alt RDFLiteral NumericLiteral BooleanLiteral))
21
+ (rule blankNodePropertyList (seq '[' predicateObjectList ']'))
22
+ (rule collection (seq '(' (star object) ')'))
23
+ (rule NumericLiteral (alt INTEGER DECIMAL DOUBLE))
24
+ (rule RDFLiteral (seq String (opt (alt LANGTAG (seq '^^' iri)))))
25
+ (rule BooleanLiteral (alt 'true' 'false'))
26
+ (rule String
27
27
  (alt STRING_LITERAL_QUOTE STRING_LITERAL_SINGLE_QUOTE
28
28
  STRING_LITERAL_LONG_SINGLE_QUOTE STRING_LITERAL_LONG_QUOTE ))
29
- (rule iri "135s" (alt IRIREF PrefixedName))
30
- (rule PrefixedName "136s" (alt PNAME_LN PNAME_NS))
31
- (rule BlankNode "137s" (alt BLANK_NODE_LABEL ANON))
29
+ (rule iri (alt IRIREF PrefixedName))
30
+ (rule PrefixedName (alt PNAME_LN PNAME_NS))
31
+ (rule BlankNode (alt BLANK_NODE_LABEL ANON))
32
32
  (terminals _terminals (seq))
33
- (terminal IRIREF "18"
34
- (seq "<" (star (alt (diff (range "^<>\"{}|^`\\") (range "#x00-#x20")) UCHAR)) ">"))
35
- (terminal PNAME_NS "139s" (seq (opt PN_PREFIX) ":"))
36
- (terminal PNAME_LN "140s" (seq PNAME_NS PN_LOCAL))
37
- (terminal BLANK_NODE_LABEL "141s"
38
- (seq "_:" (alt PN_CHARS_U (range "0-9")) (opt (seq (star (alt PN_CHARS ".")) PN_CHARS))))
39
- (terminal LANGTAG "144s"
40
- (seq "@" (plus (range "a-zA-Z")) (star (seq "-" (plus (range "a-zA-Z0-9"))))))
41
- (terminal INTEGER "19" (seq (opt (range "+-")) (plus (range "0-9"))))
42
- (terminal DECIMAL "20"
43
- (seq (opt (range "+-")) (seq (star (range "0-9")) "." (plus (range "0-9")))))
44
- (terminal DOUBLE "21"
33
+ (terminal IRIREF (seq '<' (star (alt (range "^#x00-#x20<>\"{}|^`\\") UCHAR)) '>'))
34
+ (terminal PNAME_NS (seq (opt PN_PREFIX) ':'))
35
+ (terminal PNAME_LN (seq PNAME_NS PN_LOCAL))
36
+ (terminal BLANK_NODE_LABEL
37
+ (seq '_:' (alt PN_CHARS_U (range "0-9")) (opt (seq (star (alt PN_CHARS '.')) PN_CHARS))))
38
+ (terminal LANGTAG (seq '@' (plus (range "a-zA-Z")) (star (seq '-' (plus (range "a-zA-Z0-9"))))))
39
+ (terminal INTEGER (seq (opt (range "+-")) (plus (range "0-9"))))
40
+ (terminal DECIMAL (seq (opt (range "+-")) (seq (star (range "0-9")) '.' (plus (range "0-9")))))
41
+ (terminal DOUBLE
45
42
  (seq
46
43
  (opt (range "+-"))
47
44
  (alt
48
- (seq (plus (range "0-9")) "." (star (range "0-9")) EXPONENT)
49
- (seq "." (plus (range "0-9")) EXPONENT)
45
+ (seq (plus (range "0-9")) '.' (star (range "0-9")) EXPONENT)
46
+ (seq '.' (plus (range "0-9")) EXPONENT)
50
47
  (seq (plus (range "0-9")) EXPONENT)) ))
51
- (terminal EXPONENT "154s" (seq (range "eE") (opt (range "+-")) (plus (range "0-9"))))
52
- (terminal STRING_LITERAL_QUOTE "22"
53
- (seq "\"" (star (alt (range "^#x22#x5C#xA#xD") ECHAR UCHAR)) "\""))
54
- (terminal STRING_LITERAL_SINGLE_QUOTE "23"
48
+ (terminal EXPONENT (seq (range "eE") (opt (range "+-")) (plus (range "0-9"))))
49
+ (terminal STRING_LITERAL_QUOTE
50
+ (seq '"' (star (alt (range "^#x22#x5C#xA#xD") ECHAR UCHAR)) '"'))
51
+ (terminal STRING_LITERAL_SINGLE_QUOTE
55
52
  (seq "'" (star (alt (range "^#x27#x5C#xA#xD") ECHAR UCHAR)) "'"))
56
- (terminal STRING_LITERAL_LONG_SINGLE_QUOTE "24"
53
+ (terminal STRING_LITERAL_LONG_SINGLE_QUOTE
57
54
  (seq "'''" (star (seq (opt (alt "'" "''")) (alt (range "^'\\") ECHAR UCHAR))) "'''"))
58
- (terminal STRING_LITERAL_LONG_QUOTE "25"
59
- (seq "\"\"\"" (star (seq (opt (alt "\"" "\"\"")) (alt (range "^\"\\") ECHAR UCHAR))) "\"\"\""))
60
- (terminal UCHAR "26"
61
- (alt (seq "\\u" HEX HEX HEX HEX) (seq "\\U" HEX HEX HEX HEX HEX HEX HEX HEX)))
62
- (terminal ECHAR "159s" (seq "\\" (range "tbnrf\\\"'")))
63
- (terminal SPARQL_PREFIX "28t"
64
- (seq (range "Pp") (range "Rr") (range "Ee") (range "Ff") (range "Ii") (range "Xx")))
65
- (terminal SPARQL_BASE "29t" (seq (range "Bb") (range "Aa") (range "Ss") (range "Ee")))
66
- (terminal WS "161s" (alt (hex "#x20") (hex "#x9") (hex "#xD") (hex "#xA")))
67
- (terminal ANON "162s" (seq "[" (star WS) "]"))
68
- (terminal PN_CHARS_BASE "163s"
55
+ (terminal STRING_LITERAL_LONG_QUOTE
56
+ (seq '"""' (star (seq (opt (alt '"' '""')) (alt (range "^\"\\") ECHAR UCHAR))) '"""'))
57
+ (terminal UCHAR
58
+ (alt (seq '\\u' HEX HEX HEX HEX) (seq '\\U' HEX HEX HEX HEX HEX HEX HEX HEX)))
59
+ (terminal ECHAR (seq '\\' (range "tbnrf\\\"'")))
60
+ (terminal NIL (seq '(' (star WS) ')'))
61
+ (terminal WS (alt (hex "#x20") (hex "#x9") (hex "#xD") (hex "#xA")))
62
+ (terminal ANON (seq '[' (star WS) ']'))
63
+ (terminal PN_CHARS_BASE
69
64
  (alt
70
65
  (range "A-Z")
71
66
  (range "a-z")
@@ -81,23 +76,22 @@
81
76
  (range "#xF900-#xFDCF")
82
77
  (range "#xFDF0-#xFFFD")
83
78
  (range "#x10000-#xEFFFF")) )
84
- (terminal PN_CHARS_U "164s" (alt PN_CHARS_BASE "_"))
85
- (terminal PN_CHARS "166s"
86
- (alt PN_CHARS_U "-"
79
+ (terminal PN_CHARS_U (alt PN_CHARS_BASE '_'))
80
+ (terminal PN_CHARS
81
+ (alt PN_CHARS_U '-'
87
82
  (range "0-9")
88
83
  (hex "#x00B7")
89
84
  (range "#x0300-#x036F")
90
85
  (range "#x203F-#x2040")) )
91
- (terminal PN_PREFIX "167s"
92
- (seq PN_CHARS_BASE (opt (seq (star (alt PN_CHARS ".")) PN_CHARS))))
93
- (terminal PN_LOCAL "168s"
86
+ (terminal PN_PREFIX (seq PN_CHARS_BASE (opt (seq (star (alt PN_CHARS '.')) PN_CHARS))))
87
+ (terminal PN_LOCAL
94
88
  (seq
95
- (alt PN_CHARS_U ":" (range "0-9") PLX)
96
- (opt (seq (star (alt PN_CHARS "." ":" PLX)) (alt PN_CHARS ":" PLX)))) )
97
- (terminal PLX "169s" (alt PERCENT PN_LOCAL_ESC))
98
- (terminal PERCENT "170s" (seq "%" HEX HEX))
99
- (terminal HEX "171s" (range "0-9A-Fa-f"))
100
- (terminal PN_LOCAL_ESC "172s"
101
- (seq "\\"
102
- (alt "_" "~" "." "-" "!" "$" "&" "'" "(" ")" "*" "+" "," ";" "=" "/" "?" "#"
103
- "@" "%" )) ))
89
+ (alt PN_CHARS_U ':' (range "0-9") PLX)
90
+ (opt (seq (star (alt PN_CHARS '.' ':' PLX)) (alt PN_CHARS ':' PLX)))) )
91
+ (terminal PLX (alt PERCENT PN_LOCAL_ESC))
92
+ (terminal PERCENT (seq '%' HEX HEX))
93
+ (terminal HEX (alt (range "0-9") (range "A-F") (range "a-f")))
94
+ (terminal PN_LOCAL_ESC
95
+ (seq '\\'
96
+ (alt '_' '~' '.' '-' '!' '$' '&' "'" '(' ')' '*' '+' ',' ';' '=' '/' '?' '#'
97
+ '@' '%' )) ))
data/lib/ebnf/abnf.rb CHANGED
@@ -208,15 +208,15 @@ module EBNF
208
208
  str = value.last[:quoted_string]
209
209
  if str.match?(/[[:alpha:]]/)
210
210
  # Only need to use case-insensitive if there are alphabetic characters in the string.
211
- [:istr, value.last[:quoted_string]]
211
+ [:istr, value.last[:quoted_string].tap {|s| s.quote_style = :dquote}]
212
212
  else
213
- value.last[:quoted_string]
213
+ value.last[:quoted_string].tap {|s| s.quote_style = :dquote}
214
214
  end
215
215
  end
216
216
 
217
217
  # `case_sensitive_string ::= "%s" quoted_string`
218
218
  production(:case_sensitive_string) do |value|
219
- value.last[:quoted_string]
219
+ value.last[:quoted_string].tap {|s| s.quote_style = :squote}
220
220
  end
221
221
 
222
222
  # `num_val ::= "%" (bin_val | dec_val | hex_val)`
data/lib/ebnf/base.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'strscan'
2
+ require 'sxp' unless defined?(SXP)
2
3
 
3
4
  # Extended Bakus-Nour Form (EBNF), being the W3C variation is
4
5
  # originaly defined in the
@@ -152,7 +153,6 @@ module EBNF
152
153
  end
153
154
  end
154
155
  when :sxp
155
- require 'sxp' unless defined?(SXP)
156
156
  @ast = SXP::Reader::Basic.read(input).map {|e| Rule.from_sxp(e)}
157
157
  else
158
158
  raise "unknown input format #{format.inspect}"
data/lib/ebnf/isoebnf.rb CHANGED
@@ -56,7 +56,7 @@ module EBNF
56
56
  # `[17] terminal_string ::= ("'" first_terminal_character+ "'")`
57
57
  # ` | ('"' second_terminal_character+ '"')`
58
58
  terminal(:terminal_string, /(?:'#{FIRST_TERMINAL_CHARACTER}+')|(?:"#{SECOND_TERMINAL_CHARACTER}+")/x) do |value|
59
- value[1..-2]
59
+ value[1..-2].tap {|s| s.quote_style = (value.start_with?("'") ? :squote : :dquote) }
60
60
  end
61
61
 
62
62
  # `[20] special_sequence ::= '?' special_sequence_character* '?'`