ebnf 2.3.5 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/VERSION +1 -1
- data/etc/abnf.sxp +1 -1
- data/etc/ebnf.html +13 -13
- data/etc/ebnf.ll1.rb +1 -1
- data/etc/ebnf.ll1.sxp +94 -94
- data/etc/ebnf.peg.rb +1 -1
- data/etc/ebnf.peg.sxp +29 -29
- data/etc/ebnf.sxp +18 -18
- data/etc/iso-ebnf.sxp +27 -27
- data/etc/sparql.sxp +195 -195
- data/etc/turtle.ebnf +70 -67
- data/etc/turtle.html +56 -106
- data/etc/turtle.peg.sxp +182 -191
- data/etc/turtle.sxp +64 -70
- data/lib/ebnf/abnf.rb +3 -3
- data/lib/ebnf/base.rb +1 -1
- data/lib/ebnf/isoebnf.rb +1 -1
- data/lib/ebnf/native.rb +3 -2
- data/lib/ebnf/parser.rb +4 -2
- data/lib/ebnf/rule.rb +1 -2
- data/lib/ebnf/unescape.rb +1 -1
- data/lib/ebnf/writer.rb +9 -7
- data/lib/ebnf.rb +2 -0
- metadata +16 -23
- data/etc/sparql.html +0 -1425
- data/etc/sparql.ll1.sxp +0 -7372
- data/etc/sparql.peg.rb +0 -532
- data/etc/sparql.peg.sxp +0 -597
- data/etc/turtle.ll1.rb +0 -1482
- data/etc/turtle.ll1.sxp +0 -425
- data/etc/turtle.peg.rb +0 -182
data/etc/turtle.peg.sxp
CHANGED
@@ -1,199 +1,190 @@
|
|
1
1
|
(
|
2
|
-
(rule turtleDoc
|
3
|
-
(rule statement
|
4
|
-
(rule _statement_1
|
5
|
-
(rule directive
|
6
|
-
(rule prefixID
|
7
|
-
(rule base
|
8
|
-
(rule
|
9
|
-
(rule
|
10
|
-
(rule
|
11
|
-
(rule
|
12
|
-
(rule
|
13
|
-
(rule
|
14
|
-
(rule
|
15
|
-
(rule
|
16
|
-
(rule
|
17
|
-
(rule
|
18
|
-
(rule
|
19
|
-
(rule
|
20
|
-
(rule
|
21
|
-
(rule
|
22
|
-
(rule
|
23
|
-
(rule
|
24
|
-
(rule
|
25
|
-
(rule
|
26
|
-
(rule
|
27
|
-
(rule
|
28
|
-
(rule
|
29
|
-
(rule
|
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
|
-
(
|
33
|
-
(
|
34
|
-
(
|
35
|
-
(
|
36
|
-
(terminal
|
37
|
-
(terminal
|
38
|
-
(terminal
|
39
|
-
(terminal
|
40
|
-
(terminal
|
41
|
-
(terminal
|
42
|
-
(terminal
|
43
|
-
(terminal
|
44
|
-
(terminal
|
45
|
-
(terminal
|
46
|
-
(terminal
|
47
|
-
(terminal
|
48
|
-
(terminal
|
49
|
-
(terminal
|
50
|
-
(terminal
|
51
|
-
(terminal
|
52
|
-
(terminal
|
53
|
-
(terminal
|
54
|
-
(terminal
|
55
|
-
(terminal
|
56
|
-
(terminal
|
57
|
-
(terminal
|
58
|
-
(terminal
|
59
|
-
(terminal
|
60
|
-
(terminal
|
61
|
-
(terminal
|
62
|
-
(terminal
|
63
|
-
(terminal
|
64
|
-
(terminal
|
65
|
-
(terminal
|
66
|
-
(terminal
|
67
|
-
|
68
|
-
(terminal
|
69
|
-
|
70
|
-
(terminal
|
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
|
73
|
-
(terminal STRING_LITERAL_LONG_SINGLE_QUOTE
|
74
|
-
(seq "'''" _STRING_LITERAL_LONG_SINGLE_QUOTE_1))
|
75
|
-
(terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_1
|
76
|
-
(
|
77
|
-
(terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_2
|
78
|
-
(
|
79
|
-
(terminal _STRING_LITERAL_LONG_SINGLE_QUOTE_3
|
80
|
-
(
|
81
|
-
(terminal
|
82
|
-
(terminal
|
83
|
-
(
|
84
|
-
(terminal
|
85
|
-
|
86
|
-
(terminal
|
87
|
-
(terminal
|
88
|
-
(
|
89
|
-
(terminal
|
90
|
-
(terminal
|
91
|
-
(terminal
|
92
|
-
|
93
|
-
(terminal
|
94
|
-
(terminal
|
95
|
-
(terminal
|
96
|
-
(terminal
|
97
|
-
(terminal
|
98
|
-
|
99
|
-
|
100
|
-
(
|
101
|
-
(terminal
|
102
|
-
(terminal
|
103
|
-
(terminal
|
104
|
-
(terminal
|
105
|
-
(terminal
|
106
|
-
(terminal
|
107
|
-
(terminal
|
108
|
-
|
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
|
166
|
-
(terminal _PN_CHARS_BASE_2
|
167
|
-
(terminal _PN_CHARS_BASE_3
|
168
|
-
(terminal
|
169
|
-
(terminal
|
170
|
-
(terminal
|
171
|
-
(terminal
|
172
|
-
(terminal
|
173
|
-
|
174
|
-
(terminal
|
175
|
-
(terminal
|
176
|
-
(terminal
|
177
|
-
(terminal
|
178
|
-
(terminal
|
179
|
-
(terminal
|
180
|
-
(terminal
|
181
|
-
|
182
|
-
(terminal
|
183
|
-
(terminal
|
184
|
-
(terminal
|
185
|
-
(terminal
|
186
|
-
(terminal
|
187
|
-
(terminal
|
188
|
-
(terminal
|
189
|
-
(terminal
|
190
|
-
(terminal
|
191
|
-
(terminal
|
192
|
-
(terminal
|
193
|
-
(terminal
|
194
|
-
(terminal
|
195
|
-
(terminal
|
196
|
-
(terminal
|
197
|
-
(terminal
|
198
|
-
|
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
|
3
|
-
(rule statement
|
4
|
-
(rule directive
|
5
|
-
(rule prefixID
|
6
|
-
(rule base
|
7
|
-
(rule sparqlPrefix
|
8
|
-
(rule sparqlBase
|
9
|
-
(rule triples
|
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
|
14
|
-
(seq verb objectList (star (seq
|
15
|
-
(rule objectList
|
16
|
-
(rule verb
|
17
|
-
(rule subject
|
18
|
-
(rule predicate
|
19
|
-
(rule object
|
20
|
-
(rule literal
|
21
|
-
(rule blankNodePropertyList
|
22
|
-
(rule collection
|
23
|
-
(rule NumericLiteral
|
24
|
-
(rule RDFLiteral
|
25
|
-
(rule BooleanLiteral
|
26
|
-
(rule String
|
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
|
30
|
-
(rule PrefixedName
|
31
|
-
(rule BlankNode
|
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 "
|
34
|
-
|
35
|
-
(terminal
|
36
|
-
(terminal
|
37
|
-
|
38
|
-
|
39
|
-
(terminal
|
40
|
-
|
41
|
-
(terminal
|
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"))
|
49
|
-
(seq
|
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
|
52
|
-
(terminal STRING_LITERAL_QUOTE
|
53
|
-
(seq "
|
54
|
-
(terminal STRING_LITERAL_SINGLE_QUOTE
|
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
|
53
|
+
(terminal STRING_LITERAL_LONG_SINGLE_QUOTE
|
57
54
|
(seq "'''" (star (seq (opt (alt "'" "''")) (alt (range "^'\\") ECHAR UCHAR))) "'''"))
|
58
|
-
(terminal STRING_LITERAL_LONG_QUOTE
|
59
|
-
(seq "
|
60
|
-
(terminal UCHAR
|
61
|
-
(alt (seq
|
62
|
-
(terminal ECHAR
|
63
|
-
(terminal
|
64
|
-
|
65
|
-
(terminal
|
66
|
-
(terminal
|
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
|
85
|
-
(terminal PN_CHARS
|
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
|
92
|
-
|
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
|
96
|
-
(opt (seq (star (alt PN_CHARS
|
97
|
-
(terminal PLX
|
98
|
-
(terminal PERCENT
|
99
|
-
(terminal HEX "
|
100
|
-
(terminal PN_LOCAL_ESC
|
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* '?'`
|