ebnf 2.3.1 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8591cff439890326aadd4187c5ccb7561d6a6f5f3cd3bc213ae6f23f4d689de
4
- data.tar.gz: c53fad830e7de8dbf0d0e7aa477989b2130fa6fbee0c054a2a199689a3ebc6f0
3
+ metadata.gz: c4fb86945b28f51ba07f086e46e5d89e0707bbaa5d59c88c1748c4701d1106e4
4
+ data.tar.gz: e7df3a8153bf07c292ccd0aa1d7664583032ecd06a224a48a0485c0f87024fe5
5
5
  SHA512:
6
- metadata.gz: 07f515ffbfaa5de085c9b63bf7e12ef84428a28fc35f727bc0956557c7e4270213eb51104950befec53c97105f992edea848bc30b22b21e07843bca818edbe63
7
- data.tar.gz: 3433f6cfb3de5009caf7013ece30f50bec35aeff65d71dbce7235f753d81d7ab88ce09468cd9d9c0759a453ea9535dd5e9a01ee954837b1f318b4524a9658eec
6
+ metadata.gz: 0cfe707433ef76136a8e856f5ae6e7eb8e1cb9e6430d762f337f9ce388fa7b055a6dc4538d272fb4c4a91a57b65d888ee0c314d47ba35ec77d9cbae826936810
7
+ data.tar.gz: 316d8928d79e585bc00a9667b7ab31f4ab8236863af0526631c5dcf5eeb3d152cf3ac31f188264f43250498bc7f3fe6d735d6b1e06ca99b186cdc1996c553fd6
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [EBNF][] parser and generic parser generator.
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/ebnf.png)](https://badge.fury.io/rb/ebnf)
5
+ [![Gem Version](https://badge.fury.io/rb/ebnf.svg)](https://badge.fury.io/rb/ebnf)
6
6
  [![Build Status](https://github.com/dryruby/ebnf/workflows/CI/badge.svg?branch=develop)](https://github.com/dryruby/ebnf/actions?query=workflow%3ACI)
7
7
  [![Coverage Status](https://coveralls.io/repos/dryruby/ebnf/badge.svg?branch=develop)](https://coveralls.io/r/dryruby/ebnf?branch=develop)
8
8
  [![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)
@@ -99,7 +99,9 @@ The formatted HTML results are designed to be appropriate for including in speci
99
99
  On a parsing failure, and exception is raised with information that may be useful in determining the source of the error.
100
100
 
101
101
  ## EBNF Grammar
102
- The [EBNF][] variant used here is based on [W3C](https://w3.org/) [EBNF][] (see {file:etc/ebnf.ebnf EBNF grammar}) as defined in the
102
+ The [EBNF][] variant used here is based on [W3C](https://w3.org/) [EBNF][]
103
+ (see [EBNF grammar](https://dryruby.github.io/ebnf/etc/ebnf.ebnf))
104
+ as defined in the
103
105
  [XML 1.0 recommendation](https://www.w3.org/TR/REC-xml/), with minor extensions:
104
106
 
105
107
  Note that the grammar includes an optional `[identifer]` in front of rule names, which can be in conflict with the `RANGE` terminal. It is typically not a problem, but if it comes up, try parsing with the `native` parser, add comments or sequences to disambiguate. EBNF does not have beginning of line checks as all whitespace is treated the same, so the common practice of identifying each rule inherently leads to such ambiguity.
@@ -161,7 +163,12 @@ Within the expression on the right-hand side of a rule, the following expression
161
163
  * `@pass` defines the expression used to detect whitespace, which is removed in processing.
162
164
  * No support for `wfc` (well-formedness constraint) or `vc` (validity constraint).
163
165
 
164
- Parsing this grammar yields an [S-Expression][] version: {file:etc/ebnf.sxp} (or [LL(1)][] version {file:etc/ebnf.ll1.sxp} or [PEG][] version {file:etc/ebnf.peg.sxp}).
166
+ Parsing this grammar yields an [S-Expression][S-Expression] version:
167
+ [here](https://dryruby.github.io/ebnf/etc/ebnf.sxp)
168
+ (or [LL(1)][] version
169
+ [here](https://dryruby.github.io/ebnf/etc/ebnf.ll1.sxp)
170
+ or [PEG][] version
171
+ [here](https://dryruby.github.io/ebnf/etc/ebnf.peg.sxp)).
165
172
 
166
173
  ### Parser S-Expressions
167
174
  Intermediate representations of the grammar may be serialized to Lisp-like [S-Expressions][S-Expression]. For example, the rule
@@ -225,7 +232,7 @@ For a [PEG][] parser for a simple grammar implementing a calculator see [Calc ex
225
232
  For an example parser built using this gem that parses the [EBNF][] grammar, see [EBNF PEG Parser example](https://dryruby.github.io/ebnf/examples/ebnf-peg-parser/doc/parser.html). This example creates a parser for the [EBNF][] grammar which generates the same Abstract Syntax Tree as the built-in parser in the gem.
226
233
 
227
234
  There is also an
228
- [EBNF LL(1) Parser example](https://dryruby.github.io/ebnf/examples/ebnf-peg-parser/doc/parser.html).
235
+ [EBNF LL(1) Parser example](https://dryruby.github.io/ebnf/examples/ebnf-ll1-parser/doc/parser.html).
229
236
 
230
237
  The [ISO EBNF Parser](https://dryruby.github.io/ebnf/examples/isoebnf/doc/parser.html) example parses [ISO/IEC 14977][] into [S-Expressions][S-Expression], which can be used to parse compatible grammars using this parser (either [PEG][] or [LL(1)][]).
231
238
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.3.3
data/etc/turtle.html CHANGED
@@ -1,467 +1,388 @@
1
- <table class='grammar'>
2
- <tbody id='grammar-productions'>
3
- <tr id='grammar-production-turtleDoc'>
4
- <td>[1]</td>
5
- <td><code>turtleDoc</code></td>
6
- <td>::=</td>
7
- <td>
8
- statement*
9
- </td>
10
- </tr>
11
- <tr id='grammar-production-statement'>
12
- <td>[2]</td>
13
- <td><code>statement</code></td>
14
- <td>::=</td>
15
- <td>
16
- directive | triples "."
17
- </td>
18
- </tr>
19
- <tr id='grammar-production-directive'>
20
- <td>[3]</td>
21
- <td><code>directive</code></td>
22
- <td>::=</td>
23
- <td>
24
- prefixID
25
- | base
26
- | sparqlPrefix
27
- | sparqlBase
28
- </td>
29
- </tr>
30
- <tr id='grammar-production-prefixID'>
31
- <td>[4]</td>
32
- <td><code>prefixID</code></td>
33
- <td>::=</td>
34
- <td>
35
- "@prefix" PNAME_NS IRIREF "."
36
- </td>
37
- </tr>
38
- <tr id='grammar-production-base'>
39
- <td>[5]</td>
40
- <td><code>base</code></td>
41
- <td>::=</td>
42
- <td>
43
- "@base" IRIREF "."
44
- </td>
45
- </tr>
46
- <tr id='grammar-production-sparqlPrefix'>
47
- <td>[28s]</td>
48
- <td><code>sparqlPrefix</code></td>
49
- <td>::=</td>
50
- <td>
51
- SPARQL_PREFIX PNAME_NS IRIREF
52
- </td>
53
- </tr>
54
- <tr id='grammar-production-sparqlBase'>
55
- <td>[29s]</td>
56
- <td><code>sparqlBase</code></td>
57
- <td>::=</td>
58
- <td>
59
- SPARQL_BASE IRIREF
60
- </td>
61
- </tr>
62
- <tr id='grammar-production-triples'>
63
- <td>[6]</td>
64
- <td><code>triples</code></td>
65
- <td>::=</td>
66
- <td>
67
- subject predicateObjectList
68
- | blankNodePropertyList predicateObjectList?
69
- </td>
70
- </tr>
71
- <tr id='grammar-production-predicateObjectList'>
72
- <td>[7]</td>
73
- <td><code>predicateObjectList</code></td>
74
- <td>::=</td>
75
- <td>
76
- verb
77
- objectList
78
- (";" (verb objectList)?)*
79
- </td>
80
- </tr>
81
- <tr id='grammar-production-objectList'>
82
- <td>[8]</td>
83
- <td><code>objectList</code></td>
84
- <td>::=</td>
85
- <td>
86
- object ("," object)*
87
- </td>
88
- </tr>
89
- <tr id='grammar-production-verb'>
90
- <td>[9]</td>
91
- <td><code>verb</code></td>
92
- <td>::=</td>
93
- <td>
94
- predicate | "a"
95
- </td>
96
- </tr>
97
- <tr id='grammar-production-subject'>
98
- <td>[10]</td>
99
- <td><code>subject</code></td>
100
- <td>::=</td>
101
- <td>
102
- iri | BlankNode | collection
103
- </td>
104
- </tr>
105
- <tr id='grammar-production-predicate'>
106
- <td>[11]</td>
107
- <td><code>predicate</code></td>
108
- <td>::=</td>
109
- <td>
110
- iri
111
- </td>
112
- </tr>
113
- <tr id='grammar-production-object'>
114
- <td>[12]</td>
115
- <td><code>object</code></td>
116
- <td>::=</td>
117
- <td>
118
- iri
119
- | BlankNode
120
- | collection
121
- | blankNodePropertyList
122
- | literal
123
- </td>
124
- </tr>
125
- <tr id='grammar-production-literal'>
126
- <td>[13]</td>
127
- <td><code>literal</code></td>
128
- <td>::=</td>
129
- <td>
130
- RDFLiteral
131
- | NumericLiteral
132
- | BooleanLiteral
133
- </td>
134
- </tr>
135
- <tr id='grammar-production-blankNodePropertyList'>
136
- <td>[14]</td>
137
- <td><code>blankNodePropertyList</code></td>
138
- <td>::=</td>
139
- <td>
140
- "[" predicateObjectList "]"
141
- </td>
142
- </tr>
143
- <tr id='grammar-production-collection'>
144
- <td>[15]</td>
145
- <td><code>collection</code></td>
146
- <td>::=</td>
147
- <td>
148
- "(" object* ")"
149
- </td>
150
- </tr>
151
- <tr id='grammar-production-NumericLiteral'>
152
- <td>[16]</td>
153
- <td><code>NumericLiteral</code></td>
154
- <td>::=</td>
155
- <td>
156
- INTEGER | DECIMAL | DOUBLE
157
- </td>
158
- </tr>
159
- <tr id='grammar-production-RDFLiteral'>
160
- <td>[128s]</td>
161
- <td><code>RDFLiteral</code></td>
162
- <td>::=</td>
163
- <td>
164
- String (LANGTAG | "^^" iri)?
165
- </td>
166
- </tr>
167
- <tr id='grammar-production-BooleanLiteral'>
168
- <td>[133s]</td>
169
- <td><code>BooleanLiteral</code></td>
170
- <td>::=</td>
171
- <td>
172
- "true" | "false"
173
- </td>
174
- </tr>
175
- <tr id='grammar-production-String'>
176
- <td>[17]</td>
177
- <td><code>String</code></td>
178
- <td>::=</td>
179
- <td>
180
- STRING_LITERAL_QUOTE
181
- | STRING_LITERAL_SINGLE_QUOTE
182
- | STRING_LITERAL_LONG_SINGLE_QUOTE
183
- | STRING_LITERAL_LONG_QUOTE
184
- </td>
185
- </tr>
186
- <tr id='grammar-production-iri'>
187
- <td>[135s]</td>
188
- <td><code>iri</code></td>
189
- <td>::=</td>
190
- <td>
191
- IRIREF | PrefixedName
192
- </td>
193
- </tr>
194
- <tr id='grammar-production-PrefixedName'>
195
- <td>[136s]</td>
196
- <td><code>PrefixedName</code></td>
197
- <td>::=</td>
198
- <td>
199
- PNAME_LN | PNAME_NS
200
- </td>
201
- </tr>
202
- <tr id='grammar-production-BlankNode'>
203
- <td>[137s]</td>
204
- <td><code>BlankNode</code></td>
205
- <td>::=</td>
206
- <td>
207
- BLANK_NODE_LABEL | ANON
208
- </td>
209
- </tr>
210
- <tr id='grammar-production-IRIREF'>
211
- <td>[18]</td>
212
- <td><code>IRIREF</code></td>
213
- <td>::=</td>
214
- <td>
215
- "<"
216
- [^#x00-#x20<>"{}|^`]#x20|#x20UCHAR)*#x20'>']
217
- </td>
218
- </tr>
219
- <tr id='grammar-production-PNAME_NS'>
220
- <td>[139s]</td>
221
- <td><code>PNAME_NS</code></td>
222
- <td>::=</td>
223
- <td>
224
- PN_PREFIX? ":"
225
- </td>
226
- </tr>
227
- <tr id='grammar-production-PNAME_LN'>
228
- <td>[140s]</td>
229
- <td><code>PNAME_LN</code></td>
230
- <td>::=</td>
231
- <td>
232
- PNAME_NS PN_LOCAL
233
- </td>
234
- </tr>
235
- <tr id='grammar-production-BLANK_NODE_LABEL'>
236
- <td>[141s]</td>
237
- <td><code>BLANK_NODE_LABEL</code></td>
238
- <td>::=</td>
239
- <td>
240
- "_:"
241
- (PN_CHARS_U | [0-9])
242
- (PN_CHARS | ".")* PN_CHARS?
243
- </td>
244
- </tr>
245
- <tr id='grammar-production-LANGTAG'>
246
- <td>[144s]</td>
247
- <td><code>LANGTAG</code></td>
248
- <td>::=</td>
249
- <td>
250
- "@" ([a-zA-Z])+ ("-" ([a-zA-Z0-9])+)*
251
- </td>
252
- </tr>
253
- <tr id='grammar-production-INTEGER'>
254
- <td>[19]</td>
255
- <td><code>INTEGER</code></td>
256
- <td>::=</td>
257
- <td>
258
- ([+-])? ([0-9])+
259
- </td>
260
- </tr>
261
- <tr id='grammar-production-DECIMAL'>
262
- <td>[20]</td>
263
- <td><code>DECIMAL</code></td>
264
- <td>::=</td>
265
- <td>
266
- ([+-])? (([0-9])* "." ([0-9])+)
267
- </td>
268
- </tr>
269
- <tr id='grammar-production-DOUBLE'>
270
- <td>[21]</td>
271
- <td><code>DOUBLE</code></td>
272
- <td>::=</td>
273
- <td>
274
- ([+-])?
275
- (([0-9])+ "." ([0-9])* EXPONENT | "." ([0-9])+ EXPONENT | ([0-9])+ EXPONENT)
276
- </td>
277
- </tr>
278
- <tr id='grammar-production-EXPONENT'>
279
- <td>[154s]</td>
280
- <td><code>EXPONENT</code></td>
281
- <td>::=</td>
282
- <td>
283
- [eE] ([+-])? ([0-9])+
284
- </td>
285
- </tr>
286
- <tr id='grammar-production-STRING_LITERAL_QUOTE'>
287
- <td>[22]</td>
288
- <td><code>STRING_LITERAL_QUOTE</code></td>
289
- <td>::=</td>
290
- <td>
291
- '"'
292
- ([^#x22#x5C#xA#xD] | ECHAR | UCHAR)*
293
- '"'
294
- </td>
295
- </tr>
296
- <tr id='grammar-production-STRING_LITERAL_SINGLE_QUOTE'>
297
- <td>[23]</td>
298
- <td><code>STRING_LITERAL_SINGLE_QUOTE</code></td>
299
- <td>::=</td>
300
- <td>
301
- "'"
302
- ([^#x27#x5C#xA#xD] | ECHAR | UCHAR)*
303
- "'"
304
- </td>
305
- </tr>
306
- <tr id='grammar-production-STRING_LITERAL_LONG_SINGLE_QUOTE'>
307
- <td>[24]</td>
308
- <td><code>STRING_LITERAL_LONG_SINGLE_QUOTE</code></td>
309
- <td>::=</td>
310
- <td>
311
- "'''"
312
- (("'" | "''")? [^']#x20|#x20ECHAR#x20|#x20UCHAR#x20)#x20)*#x20"'''"])
313
- </td>
314
- </tr>
315
- <tr id='grammar-production-STRING_LITERAL_LONG_QUOTE'>
316
- <td>[25]</td>
317
- <td><code>STRING_LITERAL_LONG_QUOTE</code></td>
318
- <td>::=</td>
319
- <td>
320
- '"""'
321
- (('"' | '""')? [^"]#x20|#x20ECHAR#x20|#x20UCHAR#x20)#x20)*#x20'"""'])
322
- </td>
323
- </tr>
324
- <tr id='grammar-production-UCHAR'>
325
- <td>[26]</td>
326
- <td><code>UCHAR</code></td>
327
- <td>::=</td>
328
- <td>
329
- "u" HEX HEX HEX HEX
330
- | "U" HEX HEX HEX HEX HEX HEX HEX HEX
331
- </td>
332
- </tr>
333
- <tr id='grammar-production-ECHAR'>
334
- <td>[159s]</td>
335
- <td><code>ECHAR</code></td>
336
- <td>::=</td>
337
- <td>
338
- "\" [tbnrf"']
339
- </td>
340
- </tr>
341
- <tr id='grammar-production-SPARQL_PREFIX'>
342
- <td>[28t]</td>
343
- <td><code>SPARQL_PREFIX</code></td>
344
- <td>::=</td>
345
- <td>
346
- [Pp] [Rr] [Ee] [Ff] [Ii] [Xx]
347
- </td>
348
- </tr>
349
- <tr id='grammar-production-SPARQL_BASE'>
350
- <td>[29t]</td>
351
- <td><code>SPARQL_BASE</code></td>
352
- <td>::=</td>
353
- <td>
354
- [Bb] [Aa] [Ss] [Ee]
355
- </td>
356
- </tr>
357
- <tr id='grammar-production-WS'>
358
- <td>[161s]</td>
359
- <td><code>WS</code></td>
360
- <td>::=</td>
361
- <td>
362
- #x20 | #x9 | #xD | #xA
363
- </td>
364
- </tr>
365
- <tr id='grammar-production-ANON'>
366
- <td>[162s]</td>
367
- <td><code>ANON</code></td>
368
- <td>::=</td>
369
- <td>
370
- "[" WS* "]"
371
- </td>
372
- </tr>
373
- <tr id='grammar-production-PN_CHARS_BASE'>
374
- <td>[163s]</td>
375
- <td><code>PN_CHARS_BASE</code></td>
376
- <td>::=</td>
377
- <td>
378
- [A-Z]
379
- | [a-z]
380
- | [#x00C0-#x00D6]
381
- | [#x00D8-#x00F6]
382
- | [#x00F8-#x02FF]
383
- | [#x0370-#x037D]
384
- | [#x037F-#x1FFF]
385
- | [#x200C-#x200D]
386
- | [#x2070-#x218F]
387
- | [#x2C00-#x2FEF]
388
- | [#x3001-#xD7FF]
389
- | [#xF900-#xFDCF]
390
- | [#xFDF0-#xFFFD]
391
- | [#x10000-#xEFFFF]
392
- </td>
393
- </tr>
394
- <tr id='grammar-production-PN_CHARS_U'>
395
- <td>[164s]</td>
396
- <td><code>PN_CHARS_U</code></td>
397
- <td>::=</td>
398
- <td>
399
- PN_CHARS_BASE | "_"
400
- </td>
401
- </tr>
402
- <tr id='grammar-production-PN_CHARS'>
403
- <td>[166s]</td>
404
- <td><code>PN_CHARS</code></td>
405
- <td>::=</td>
406
- <td>
407
- PN_CHARS_U
408
- | "-"
409
- | [0-9]
410
- | #x00B7
411
- | [#x0300-#x036F]
412
- | [#x203F-#x2040]
413
- </td>
414
- </tr>
415
- <tr id='grammar-production-PN_PREFIX'>
416
- <td>[167s]</td>
417
- <td><code>PN_PREFIX</code></td>
418
- <td>::=</td>
419
- <td>
420
- PN_CHARS_BASE
421
- (PN_CHARS | ".")* PN_CHARS?
422
- </td>
423
- </tr>
424
- <tr id='grammar-production-PN_LOCAL'>
425
- <td>[168s]</td>
426
- <td><code>PN_LOCAL</code></td>
427
- <td>::=</td>
428
- <td>
429
- (PN_CHARS_U | ":" | [0-9] | PLX)
430
- (PN_CHARS | "." | ":" | PLX)* (PN_CHARS | ":" | PLX)?
431
- </td>
432
- </tr>
433
- <tr id='grammar-production-PLX'>
434
- <td>[169s]</td>
435
- <td><code>PLX</code></td>
436
- <td>::=</td>
437
- <td>
438
- PERCENT | PN_LOCAL_ESC
439
- </td>
440
- </tr>
441
- <tr id='grammar-production-PERCENT'>
442
- <td>[170s]</td>
443
- <td><code>PERCENT</code></td>
444
- <td>::=</td>
445
- <td>
446
- "%" HEX HEX
447
- </td>
448
- </tr>
449
- <tr id='grammar-production-HEX'>
450
- <td>[171s]</td>
451
- <td><code>HEX</code></td>
452
- <td>::=</td>
453
- <td>
454
- [0-9] | [A-F] | [a-f]
455
- </td>
456
- </tr>
457
- <tr id='grammar-production-PN_LOCAL_ESC'>
458
- <td>[172s]</td>
459
- <td><code>PN_LOCAL_ESC</code></td>
460
- <td>::=</td>
461
- <td>
462
- "\"
463
- ("_" | "~" | "." | "-" | #x21 | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "/" | "?" | "#" | "@" | "%")
464
- </td>
465
- </tr>
466
- </tbody>
1
+
2
+ <table class="grammar">
3
+ <tbody id="grammar-productions" class="ebnf">
4
+ <tr id="grammar-production-turtleDoc">
5
+ <td>[1]</td>
6
+ <td><code>turtleDoc</code></td>
7
+ <td>::=</td>
8
+ <td><a href="#grammar-production-statement">statement</a><code>*</code></td>
9
+ </tr>
10
+ <tr id="grammar-production-statement">
11
+ <td>[2]</td>
12
+ <td><code>statement</code></td>
13
+ <td>::=</td>
14
+ <td><a href="#grammar-production-directive">directive</a> <code>|</code> <code>(</code><a href="#grammar-production-triples">triples</a> "<code class="grammar-literal">.</code>"<code>)</code></td>
15
+ </tr>
16
+ <tr id="grammar-production-directive">
17
+ <td>[3]</td>
18
+ <td><code>directive</code></td>
19
+ <td>::=</td>
20
+ <td><a href="#grammar-production-prefixID">prefixID</a> <code>|</code> <a href="#grammar-production-base">base</a> <code>|</code> <a href="#grammar-production-sparqlPrefix">sparqlPrefix</a> <code>|</code> <a href="#grammar-production-sparqlBase">sparqlBase</a></td>
21
+ </tr>
22
+ <tr id="grammar-production-prefixID">
23
+ <td>[4]</td>
24
+ <td><code>prefixID</code></td>
25
+ <td>::=</td>
26
+ <td>&quot;@prefix&quot; <a href="#grammar-production-PNAME_NS">PNAME_NS</a> <a href="#grammar-production-IRIREF">IRIREF</a> "<code class="grammar-literal">.</code>"</td>
27
+ </tr>
28
+ <tr id="grammar-production-base">
29
+ <td>[5]</td>
30
+ <td><code>base</code></td>
31
+ <td>::=</td>
32
+ <td>&quot;@base&quot; <a href="#grammar-production-IRIREF">IRIREF</a> "<code class="grammar-literal">.</code>"</td>
33
+ </tr>
34
+ <tr id="grammar-production-sparqlPrefix">
35
+ <td>[28s]</td>
36
+ <td><code>sparqlPrefix</code></td>
37
+ <td>::=</td>
38
+ <td><a href="#grammar-production-SPARQL_PREFIX">SPARQL_PREFIX</a> <a href="#grammar-production-PNAME_NS">PNAME_NS</a> <a href="#grammar-production-IRIREF">IRIREF</a></td>
39
+ </tr>
40
+ <tr id="grammar-production-sparqlBase">
41
+ <td>[29s]</td>
42
+ <td><code>sparqlBase</code></td>
43
+ <td>::=</td>
44
+ <td><a href="#grammar-production-SPARQL_BASE">SPARQL_BASE</a> <a href="#grammar-production-IRIREF">IRIREF</a></td>
45
+ </tr>
46
+ <tr id="grammar-production-triples">
47
+ <td>[6]</td>
48
+ <td><code>triples</code></td>
49
+ <td>::=</td>
50
+ <td><code>(</code><a href="#grammar-production-subject">subject</a> <a href="#grammar-production-predicateObjectList">predicateObjectList</a><code>)</code> <code>|</code> <code>(</code><a href="#grammar-production-blankNodePropertyList">blankNodePropertyList</a> <a href="#grammar-production-predicateObjectList">predicateObjectList</a><code>?</code><code>)</code></td>
51
+ </tr>
52
+ <tr id="grammar-production-predicateObjectList">
53
+ <td>[7]</td>
54
+ <td><code>predicateObjectList</code></td>
55
+ <td>::=</td>
56
+ <td><a href="#grammar-production-verb">verb</a> <a href="#grammar-production-objectList">objectList</a> <code>(</code>"<code class="grammar-literal">;</code>" <code>(</code><a href="#grammar-production-verb">verb</a> <a href="#grammar-production-objectList">objectList</a><code>)</code><code>?</code><code>)</code><code>*</code></td>
57
+ </tr>
58
+ <tr id="grammar-production-objectList">
59
+ <td>[8]</td>
60
+ <td><code>objectList</code></td>
61
+ <td>::=</td>
62
+ <td><a href="#grammar-production-object">object</a> <code>(</code>"<code class="grammar-literal">,</code>" <a href="#grammar-production-object">object</a><code>)</code><code>*</code></td>
63
+ </tr>
64
+ <tr id="grammar-production-verb">
65
+ <td>[9]</td>
66
+ <td><code>verb</code></td>
67
+ <td>::=</td>
68
+ <td><a href="#grammar-production-predicate">predicate</a> <code>|</code> "<code class="grammar-literal">a</code>"</td>
69
+ </tr>
70
+ <tr id="grammar-production-subject">
71
+ <td>[10]</td>
72
+ <td><code>subject</code></td>
73
+ <td>::=</td>
74
+ <td><a href="#grammar-production-iri">iri</a> <code>|</code> <a href="#grammar-production-BlankNode">BlankNode</a> <code>|</code> <a href="#grammar-production-collection">collection</a></td>
75
+ </tr>
76
+ <tr id="grammar-production-predicate">
77
+ <td>[11]</td>
78
+ <td><code>predicate</code></td>
79
+ <td>::=</td>
80
+ <td><a href="#grammar-production-iri">iri</a></td>
81
+ </tr>
82
+ <tr id="grammar-production-object">
83
+ <td>[12]</td>
84
+ <td><code>object</code></td>
85
+ <td>::=</td>
86
+ <td><a href="#grammar-production-iri">iri</a> <code>|</code> <a href="#grammar-production-BlankNode">BlankNode</a> <code>|</code> <a href="#grammar-production-collection">collection</a> <code>|</code> <a href="#grammar-production-blankNodePropertyList">blankNodePropertyList</a> <code>|</code> <a href="#grammar-production-literal">literal</a></td>
87
+ </tr>
88
+ <tr id="grammar-production-literal">
89
+ <td>[13]</td>
90
+ <td><code>literal</code></td>
91
+ <td>::=</td>
92
+ <td><a href="#grammar-production-RDFLiteral">RDFLiteral</a> <code>|</code> <a href="#grammar-production-NumericLiteral">NumericLiteral</a> <code>|</code> <a href="#grammar-production-BooleanLiteral">BooleanLiteral</a></td>
93
+ </tr>
94
+ <tr id="grammar-production-blankNodePropertyList">
95
+ <td>[14]</td>
96
+ <td><code>blankNodePropertyList</code></td>
97
+ <td>::=</td>
98
+ <td>"<code class="grammar-literal">[</code>" <a href="#grammar-production-predicateObjectList">predicateObjectList</a> "<code class="grammar-literal">]</code>"</td>
99
+ </tr>
100
+ <tr id="grammar-production-collection">
101
+ <td>[15]</td>
102
+ <td><code>collection</code></td>
103
+ <td>::=</td>
104
+ <td>"<code class="grammar-literal">(</code>" <a href="#grammar-production-object">object</a><code>*</code> "<code class="grammar-literal">)</code>"</td>
105
+ </tr>
106
+ <tr id="grammar-production-NumericLiteral">
107
+ <td>[16]</td>
108
+ <td><code>NumericLiteral</code></td>
109
+ <td>::=</td>
110
+ <td><a href="#grammar-production-INTEGER">INTEGER</a> <code>|</code> <a href="#grammar-production-DECIMAL">DECIMAL</a> <code>|</code> <a href="#grammar-production-DOUBLE">DOUBLE</a></td>
111
+ </tr>
112
+ <tr id="grammar-production-RDFLiteral">
113
+ <td>[128s]</td>
114
+ <td><code>RDFLiteral</code></td>
115
+ <td>::=</td>
116
+ <td><a href="#grammar-production-String">String</a> <code>(</code><a href="#grammar-production-LANGTAG">LANGTAG</a> <code>|</code> <code>(</code>&quot;^^&quot; <a href="#grammar-production-iri">iri</a><code>)</code><code>)</code><code>?</code></td>
117
+ </tr>
118
+ <tr id="grammar-production-BooleanLiteral">
119
+ <td>[133s]</td>
120
+ <td><code>BooleanLiteral</code></td>
121
+ <td>::=</td>
122
+ <td>&quot;true&quot; <code>|</code> &quot;false&quot;</td>
123
+ </tr>
124
+ <tr id="grammar-production-String">
125
+ <td>[17]</td>
126
+ <td><code>String</code></td>
127
+ <td>::=</td>
128
+ <td><a href="#grammar-production-STRING_LITERAL_QUOTE">STRING_LITERAL_QUOTE</a> <code>|</code> <a href="#grammar-production-STRING_LITERAL_SINGLE_QUOTE">STRING_LITERAL_SINGLE_QUOTE</a> <code>|</code> <a href="#grammar-production-STRING_LITERAL_LONG_SINGLE_QUOTE">STRING_LITERAL_LONG_SINGLE_QUOTE</a> <code>|</code> <a href="#grammar-production-STRING_LITERAL_LONG_QUOTE">STRING_LITERAL_LONG_QUOTE</a></td>
129
+ </tr>
130
+ <tr id="grammar-production-iri">
131
+ <td>[135s]</td>
132
+ <td><code>iri</code></td>
133
+ <td>::=</td>
134
+ <td><a href="#grammar-production-IRIREF">IRIREF</a> <code>|</code> <a href="#grammar-production-PrefixedName">PrefixedName</a></td>
135
+ </tr>
136
+ <tr id="grammar-production-PrefixedName">
137
+ <td>[136s]</td>
138
+ <td><code>PrefixedName</code></td>
139
+ <td>::=</td>
140
+ <td><a href="#grammar-production-PNAME_LN">PNAME_LN</a> <code>|</code> <a href="#grammar-production-PNAME_NS">PNAME_NS</a></td>
141
+ </tr>
142
+ <tr id="grammar-production-BlankNode">
143
+ <td>[137s]</td>
144
+ <td><code>BlankNode</code></td>
145
+ <td>::=</td>
146
+ <td><a href="#grammar-production-BLANK_NODE_LABEL">BLANK_NODE_LABEL</a> <code>|</code> <a href="#grammar-production-ANON">ANON</a></td>
147
+ </tr>
148
+ <tr>
149
+ <td colspan=2>@terminals</td>
150
+ <td></td>
151
+ <td><strong># Productions for terminals</strong></td>
152
+ </tr>
153
+ <tr id="grammar-production-IRIREF">
154
+ <td>[18]</td>
155
+ <td><code>IRIREF</code></td>
156
+ <td>::=</td>
157
+ <td>"<code class="grammar-literal">&lt;</code>" <code>(</code><code>[</code><code class="grammar-literal">^&lt;&gt;&quot;{}|^`]-[</code><code class="grammar-char-escape"><abbr title="null">#x00</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code>]</code> <code>|</code> <a href="#grammar-production-UCHAR">UCHAR</a><code>)</code><code>*</code> "<code class="grammar-literal">&gt;</code>"</td>
158
+ </tr>
159
+ <tr id="grammar-production-PNAME_NS">
160
+ <td>[139s]</td>
161
+ <td><code>PNAME_NS</code></td>
162
+ <td>::=</td>
163
+ <td><a href="#grammar-production-PN_PREFIX">PN_PREFIX</a><code>?</code> "<code class="grammar-literal">:</code>"</td>
164
+ </tr>
165
+ <tr id="grammar-production-PNAME_LN">
166
+ <td>[140s]</td>
167
+ <td><code>PNAME_LN</code></td>
168
+ <td>::=</td>
169
+ <td><a href="#grammar-production-PNAME_NS">PNAME_NS</a> <a href="#grammar-production-PN_LOCAL">PN_LOCAL</a></td>
170
+ </tr>
171
+ <tr id="grammar-production-BLANK_NODE_LABEL">
172
+ <td>[141s]</td>
173
+ <td><code>BLANK_NODE_LABEL</code></td>
174
+ <td>::=</td>
175
+ <td>&quot;_:&quot; <code>(</code><a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> <code>|</code> <code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>)</code> <code>(</code><code>(</code><a href="#grammar-production-PN_CHARS">PN_CHARS</a> <code>|</code> "<code class="grammar-literal">.</code>"<code>)</code><code>*</code> <a href="#grammar-production-PN_CHARS">PN_CHARS</a><code>)</code><code>?</code></td>
176
+ </tr>
177
+ <tr id="grammar-production-LANGTAG">
178
+ <td>[144s]</td>
179
+ <td><code>LANGTAG</code></td>
180
+ <td>::=</td>
181
+ <td>"<code class="grammar-literal">@</code>" <code>[</code><code class="grammar-literal">a-zA-Z</code><code>]</code><code>+</code> <code>(</code>"<code class="grammar-literal">-</code>" <code>[</code><code class="grammar-literal">a-zA-Z0-9</code><code>]</code><code>+</code><code>)</code><code>*</code></td>
182
+ </tr>
183
+ <tr id="grammar-production-INTEGER">
184
+ <td>[19]</td>
185
+ <td><code>INTEGER</code></td>
186
+ <td>::=</td>
187
+ <td><code>[</code><code class="grammar-literal">+-</code><code>]</code><code>?</code> <code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>+</code></td>
188
+ </tr>
189
+ <tr id="grammar-production-DECIMAL">
190
+ <td>[20]</td>
191
+ <td><code>DECIMAL</code></td>
192
+ <td>::=</td>
193
+ <td><code>[</code><code class="grammar-literal">+-</code><code>]</code><code>?</code> <code>(</code><code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>*</code> "<code class="grammar-literal">.</code>" <code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>+</code><code>)</code></td>
194
+ </tr>
195
+ <tr id="grammar-production-DOUBLE">
196
+ <td>[21]</td>
197
+ <td><code>DOUBLE</code></td>
198
+ <td>::=</td>
199
+ <td><code>[</code><code class="grammar-literal">+-</code><code>]</code><code>?</code> <code>(</code><code>(</code><code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>+</code> "<code class="grammar-literal">.</code>" <code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>*</code> <a href="#grammar-production-EXPONENT">EXPONENT</a><code>)</code> <code>|</code> <code>(</code>"<code class="grammar-literal">.</code>" <code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>+</code> <a href="#grammar-production-EXPONENT">EXPONENT</a><code>)</code> <code>|</code> <code>(</code><code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>+</code> <a href="#grammar-production-EXPONENT">EXPONENT</a><code>)</code><code>)</code></td>
200
+ </tr>
201
+ <tr id="grammar-production-EXPONENT">
202
+ <td>[154s]</td>
203
+ <td><code>EXPONENT</code></td>
204
+ <td>::=</td>
205
+ <td><code>[</code><code class="grammar-literal">eE</code><code>]</code> <code>[</code><code class="grammar-literal">+-</code><code>]</code><code>?</code> <code>[</code><code class="grammar-literal">0-9</code><code>]</code><code>+</code></td>
206
+ </tr>
207
+ <tr id="grammar-production-STRING_LITERAL_QUOTE">
208
+ <td>[22]</td>
209
+ <td><code>STRING_LITERAL_QUOTE</code></td>
210
+ <td>::=</td>
211
+ <td>'<code class="grammar-literal">&quot;</code>' <code>(</code><code>[</code><code class="grammar-literal">^</code><code class="grammar-char-escape"><abbr title="quot">>&quot;</abbr></code><code class="grammar-char-escape"><abbr title="ascii '\'">#x5C</abbr></code><code class="grammar-char-escape"><abbr title="new line">#x0A</abbr></code><code class="grammar-char-escape"><abbr title="carriage return">#x0D</abbr></code><code>]</code> <code>|</code> <a href="#grammar-production-ECHAR">ECHAR</a> <code>|</code> <a href="#grammar-production-UCHAR">UCHAR</a><code>)</code><code>*</code> '<code class="grammar-literal">&quot;</code>'</td>
212
+ </tr>
213
+ <tr id="grammar-production-STRING_LITERAL_SINGLE_QUOTE">
214
+ <td>[23]</td>
215
+ <td><code>STRING_LITERAL_SINGLE_QUOTE</code></td>
216
+ <td>::=</td>
217
+ <td>"<code class="grammar-literal">&apos;</code>" <code>(</code><code>[</code><code class="grammar-literal">^</code><code class="grammar-char-escape"><abbr title="ascii '&apos;'">#x27</abbr></code><code class="grammar-char-escape"><abbr title="ascii '\'">#x5C</abbr></code><code class="grammar-char-escape"><abbr title="new line">#x0A</abbr></code><code class="grammar-char-escape"><abbr title="carriage return">#x0D</abbr></code><code>]</code> <code>|</code> <a href="#grammar-production-ECHAR">ECHAR</a> <code>|</code> <a href="#grammar-production-UCHAR">UCHAR</a><code>)</code><code>*</code> "<code class="grammar-literal">&apos;</code>"</td>
218
+ </tr>
219
+ <tr id="grammar-production-STRING_LITERAL_LONG_SINGLE_QUOTE">
220
+ <td>[24]</td>
221
+ <td><code>STRING_LITERAL_LONG_SINGLE_QUOTE</code></td>
222
+ <td>::=</td>
223
+ <td>&quot;&apos;&apos;&apos;&quot; <code>(</code><code>(</code>"<code class="grammar-literal">&apos;</code>" <code>|</code> &quot;&apos;&apos;&quot;<code>)</code><code>?</code> <code>[</code><code class="grammar-literal">^&apos;]</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">|</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">ECHAR</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">|</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">UCHAR</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">)</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">)*</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">&quot;&apos;&apos;&apos;&quot;</code><code>]</code><code>)</code></td>
224
+ </tr>
225
+ <tr id="grammar-production-STRING_LITERAL_LONG_QUOTE">
226
+ <td>[25]</td>
227
+ <td><code>STRING_LITERAL_LONG_QUOTE</code></td>
228
+ <td>::=</td>
229
+ <td>&apos;&quot;&quot;&quot;&apos; <code>(</code><code>(</code>'<code class="grammar-literal">&quot;</code>' <code>|</code> &apos;&quot;&quot;&apos;<code>)</code><code>?</code> <code>[</code><code class="grammar-literal">^&quot;]</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">|</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">ECHAR</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">|</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">UCHAR</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">)</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">)*</code><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code><code class="grammar-literal">&apos;&quot;&quot;&quot;&apos;</code><code>]</code><code>)</code></td>
230
+ </tr>
231
+ <tr id="grammar-production-UCHAR">
232
+ <td>[26]</td>
233
+ <td><code>UCHAR</code></td>
234
+ <td>::=</td>
235
+ <td><code>(</code>"<code class="grammar-literal">u</code>" <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a><code>)</code> <code>|</code> <code>(</code>"<code class="grammar-literal">U</code>" <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a><code>)</code></td>
236
+ </tr>
237
+ <tr id="grammar-production-ECHAR">
238
+ <td>[159s]</td>
239
+ <td><code>ECHAR</code></td>
240
+ <td>::=</td>
241
+ <td>"<code class="grammar-literal">\</code>" <code>[</code><code class="grammar-literal">tbnrf&quot;&apos;</code><code>]</code></td>
242
+ </tr>
243
+ <tr id="grammar-production-SPARQL_PREFIX">
244
+ <td>[28t]</td>
245
+ <td><code>SPARQL_PREFIX</code></td>
246
+ <td>::=</td>
247
+ <td><code>[</code><code class="grammar-literal">Pp</code><code>]</code> <code>[</code><code class="grammar-literal">Rr</code><code>]</code> <code>[</code><code class="grammar-literal">Ee</code><code>]</code> <code>[</code><code class="grammar-literal">Ff</code><code>]</code> <code>[</code><code class="grammar-literal">Ii</code><code>]</code> <code>[</code><code class="grammar-literal">Xx</code><code>]</code></td>
248
+ </tr>
249
+ <tr id="grammar-production-SPARQL_BASE">
250
+ <td>[29t]</td>
251
+ <td><code>SPARQL_BASE</code></td>
252
+ <td>::=</td>
253
+ <td><code>[</code><code class="grammar-literal">Bb</code><code>]</code> <code>[</code><code class="grammar-literal">Aa</code><code>]</code> <code>[</code><code class="grammar-literal">Ss</code><code>]</code> <code>[</code><code class="grammar-literal">Ee</code><code>]</code></td>
254
+ </tr>
255
+ <tr id="grammar-production-WS">
256
+ <td>[161s]</td>
257
+ <td><code>WS</code></td>
258
+ <td>::=</td>
259
+ <td><code class="grammar-char-escape"><abbr title="space">#x20</abbr></code> <code>|</code> <code class="grammar-char-escape"><abbr title="horizontal tab">#x09</abbr></code> <code>|</code> <code class="grammar-char-escape"><abbr title="carriage return">#x0D</abbr></code> <code>|</code> <code class="grammar-char-escape"><abbr title="new line">#x0A</abbr></code></td>
260
+ </tr>
261
+ <tr id="grammar-production-ANON">
262
+ <td>[162s]</td>
263
+ <td><code>ANON</code></td>
264
+ <td>::=</td>
265
+ <td>"<code class="grammar-literal">[</code>" <a href="#grammar-production-WS">WS</a><code>*</code> "<code class="grammar-literal">]</code>"</td>
266
+ </tr>
267
+ <tr id="grammar-production-PN_CHARS_BASE">
268
+ <td>[163s]</td>
269
+ <td><code>PN_CHARS_BASE</code></td>
270
+ <td>::=</td>
271
+ <td><code>[</code><code class="grammar-literal">A-Z</code><code>]</code></td>
272
+ </tr>
273
+ <tr>
274
+ <td colspan=2></td>
275
+ <td>|</td>
276
+ <td><code>[</code><code class="grammar-literal">a-z</code><code>]</code></td>
277
+ </tr>
278
+ <tr>
279
+ <td colspan=2></td>
280
+ <td>|</td>
281
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="extended ascii '#xC0'">#xC0</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="extended ascii '#xD6'">#xD6</abbr></code><code>]</code></td>
282
+ </tr>
283
+ <tr>
284
+ <td colspan=2></td>
285
+ <td>|</td>
286
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="extended ascii '#xD8'">#xD8</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="extended ascii '#xF6'">#xF6</abbr></code><code>]</code></td>
287
+ </tr>
288
+ <tr>
289
+ <td colspan=2></td>
290
+ <td>|</td>
291
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="extended ascii '#xF8'">#xF8</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x02FF</abbr></code><code>]</code></td>
292
+ </tr>
293
+ <tr>
294
+ <td colspan=2></td>
295
+ <td>|</td>
296
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x0370</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x037D</abbr></code><code>]</code></td>
297
+ </tr>
298
+ <tr>
299
+ <td colspan=2></td>
300
+ <td>|</td>
301
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x037F</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Reserved'">#x1FFF</abbr></code><code>]</code></td>
302
+ </tr>
303
+ <tr>
304
+ <td colspan=2></td>
305
+ <td>|</td>
306
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Format'">#x200C</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Format'">#x200D</abbr></code><code>]</code></td>
307
+ </tr>
308
+ <tr>
309
+ <td colspan=2></td>
310
+ <td>|</td>
311
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x2070</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Reserved'">#x218F</abbr></code><code>]</code></td>
312
+ </tr>
313
+ <tr>
314
+ <td colspan=2></td>
315
+ <td>|</td>
316
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x2C00</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Reserved'">#x2FEF</abbr></code><code>]</code></td>
317
+ </tr>
318
+ <tr>
319
+ <td colspan=2></td>
320
+ <td>|</td>
321
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x3001</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Reserved'">#xD7FF</abbr></code><code>]</code></td>
322
+ </tr>
323
+ <tr>
324
+ <td colspan=2></td>
325
+ <td>|</td>
326
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#xF900</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#xFDCF</abbr></code><code>]</code></td>
327
+ </tr>
328
+ <tr>
329
+ <td colspan=2></td>
330
+ <td>|</td>
331
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#xFDF0</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#xFFFD</abbr></code><code>]</code></td>
332
+ </tr>
333
+ <tr>
334
+ <td colspan=2></td>
335
+ <td>|</td>
336
+ <td><code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x00010000</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Noncharacter'">#x000EFFFF</abbr></code><code>]</code></td>
337
+ </tr>
338
+ <tr id="grammar-production-PN_CHARS_U">
339
+ <td>[164s]</td>
340
+ <td><code>PN_CHARS_U</code></td>
341
+ <td>::=</td>
342
+ <td><a href="#grammar-production-PN_CHARS_BASE">PN_CHARS_BASE</a> <code>|</code> "<code class="grammar-literal">_</code>"</td>
343
+ </tr>
344
+ <tr id="grammar-production-PN_CHARS">
345
+ <td>[166s]</td>
346
+ <td><code>PN_CHARS</code></td>
347
+ <td>::=</td>
348
+ <td><a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> <code>|</code> "<code class="grammar-literal">-</code>" <code>|</code> <code>[</code><code class="grammar-literal">0-9</code><code>]</code> <code>|</code> <code class="grammar-char-escape"><abbr title="extended ascii '#xB7'">#xB7</abbr></code> <code>|</code> <code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x0300</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x036F</abbr></code><code>]</code> <code>|</code> <code>[</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x203F</abbr></code><code class="grammar-literal">-</code><code class="grammar-char-escape"><abbr title="unicode 'Graphic'">#x2040</abbr></code><code>]</code></td>
349
+ </tr>
350
+ <tr id="grammar-production-PN_PREFIX">
351
+ <td>[167s]</td>
352
+ <td><code>PN_PREFIX</code></td>
353
+ <td>::=</td>
354
+ <td><a href="#grammar-production-PN_CHARS_BASE">PN_CHARS_BASE</a> <code>(</code><code>(</code><a href="#grammar-production-PN_CHARS">PN_CHARS</a> <code>|</code> "<code class="grammar-literal">.</code>"<code>)</code><code>*</code> <a href="#grammar-production-PN_CHARS">PN_CHARS</a><code>)</code><code>?</code></td>
355
+ </tr>
356
+ <tr id="grammar-production-PN_LOCAL">
357
+ <td>[168s]</td>
358
+ <td><code>PN_LOCAL</code></td>
359
+ <td>::=</td>
360
+ <td><code>(</code><a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> <code>|</code> "<code class="grammar-literal">:</code>" <code>|</code> <code>[</code><code class="grammar-literal">0-9</code><code>]</code> <code>|</code> <a href="#grammar-production-PLX">PLX</a><code>)</code> <code>(</code><code>(</code><a href="#grammar-production-PN_CHARS">PN_CHARS</a> <code>|</code> "<code class="grammar-literal">.</code>" <code>|</code> "<code class="grammar-literal">:</code>" <code>|</code> <a href="#grammar-production-PLX">PLX</a><code>)</code><code>*</code> <code>(</code><a href="#grammar-production-PN_CHARS">PN_CHARS</a> <code>|</code> "<code class="grammar-literal">:</code>" <code>|</code> <a href="#grammar-production-PLX">PLX</a><code>)</code><code>)</code><code>?</code></td>
361
+ </tr>
362
+ <tr id="grammar-production-PLX">
363
+ <td>[169s]</td>
364
+ <td><code>PLX</code></td>
365
+ <td>::=</td>
366
+ <td><a href="#grammar-production-PERCENT">PERCENT</a> <code>|</code> <a href="#grammar-production-PN_LOCAL_ESC">PN_LOCAL_ESC</a></td>
367
+ </tr>
368
+ <tr id="grammar-production-PERCENT">
369
+ <td>[170s]</td>
370
+ <td><code>PERCENT</code></td>
371
+ <td>::=</td>
372
+ <td>"<code class="grammar-literal">%</code>" <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a></td>
373
+ </tr>
374
+ <tr id="grammar-production-HEX">
375
+ <td>[171s]</td>
376
+ <td><code>HEX</code></td>
377
+ <td>::=</td>
378
+ <td><code>[</code><code class="grammar-literal">0-9A-Fa-f</code><code>]</code></td>
379
+ </tr>
380
+ <tr id="grammar-production-PN_LOCAL_ESC">
381
+ <td>[172s]</td>
382
+ <td><code>PN_LOCAL_ESC</code></td>
383
+ <td>::=</td>
384
+ <td>"<code class="grammar-literal">\</code>" <code>(</code>"<code class="grammar-literal">_</code>" <code>|</code> "<code class="grammar-literal">~</code>" <code>|</code> "<code class="grammar-literal">.</code>" <code>|</code> "<code class="grammar-literal">-</code>" <code>|</code> "<code class="grammar-literal">!</code>" <code>|</code> "<code class="grammar-literal">$</code>" <code>|</code> "<code class="grammar-literal">&amp;</code>" <code>|</code> "<code class="grammar-literal">&apos;</code>" <code>|</code> "<code class="grammar-literal">(</code>" <code>|</code> "<code class="grammar-literal">)</code>" <code>|</code> "<code class="grammar-literal">*</code>" <code>|</code> "<code class="grammar-literal">+</code>" <code>|</code> "<code class="grammar-literal">,</code>" <code>|</code> "<code class="grammar-literal">;</code>" <code>|</code> "<code class="grammar-literal">=</code>" <code>|</code> "<code class="grammar-literal">/</code>" <code>|</code> "<code class="grammar-literal">?</code>" <code>|</code> "<code class="grammar-literal">#</code>" <code>|</code> "<code class="grammar-literal">@</code>" <code>|</code> "<code class="grammar-literal">%</code>"<code>)</code></td>
385
+ </tr>
386
+ </tbody>
467
387
  </table>
388
+
data/lib/ebnf/native.rb CHANGED
@@ -289,7 +289,8 @@ module EBNF
289
289
  l, s = s[1..-1].split(m.rstrip, 2)
290
290
  [Unescape.unescape_string(l), s]
291
291
  when '[' # RANGE, O_RANGE
292
- l, s = s[1..-1].split(/(?<=[^\\])\]/, 2)
292
+ # Includes RANGE and O_RANGE which can't include a ']'
293
+ l, s = s[1..-1].split(']', 2)
293
294
  [[:range, Unescape.unescape_string(l)], s]
294
295
  when '#' # HEX
295
296
  s.match(/(#x\h+)(.*)$/)
data/lib/ebnf/writer.rb CHANGED
@@ -181,8 +181,9 @@ module EBNF
181
181
 
182
182
  if validate
183
183
  begin
184
+ require 'nokogiri'
184
185
  # Validate the output HTML
185
- doc = Nokogiri::HTML5("<!DOCTYPE html>" + html_result, max_errors: 10)
186
+ doc = ::Nokogiri::HTML5("<!DOCTYPE html>" + html_result, max_errors: 10)
186
187
  raise EncodingError, "Errors found in generated HTML:\n " +
187
188
  doc.errors.map(&:to_s).join("\n ") unless doc.errors.empty?
188
189
  rescue LoadError, NoMethodError
@@ -245,14 +246,14 @@ module EBNF
245
246
  format_ebnf_string(expr, expr.include?('"') ? "'" : '"')
246
247
  end
247
248
  parts = {
248
- alt: (@options[:html] ? "<code>|</code> " : "| "),
249
- diff: (@options[:html] ? "<code>-</code> " : "- "),
250
- star: (@options[:html] ? "<code>*</code> " : "*"),
251
- plus: (@options[:html] ? "<code>+</code> " : "+"),
252
- opt: (@options[:html] ? "<code>?</code> " : "?")
249
+ alt: (@options[:html] ? %(<code class="grammar-alt">|</code> ) : "| "),
250
+ diff: (@options[:html] ? %(<code class="grammar-diff">-</code> ) : "- "),
251
+ star: (@options[:html] ? %(<code class="grammar-star">*</code>) : "*"),
252
+ plus: (@options[:html] ? %(<code class="grammar-plus">+</code>) : "+"),
253
+ opt: (@options[:html] ? %(<code class="grammar-opt">?</code>) : "?")
253
254
  }
254
- lparen = (@options[:html] ? "<code>(</code> " : "(")
255
- rparen = (@options[:html] ? "<code>)</code> " : ")")
255
+ lparen = (@options[:html] ? %[<code class="grammar-paren">(</code>] : "(")
256
+ rparen = (@options[:html] ? %[<code class="grammar-paren">)</code>] : ")")
256
257
 
257
258
  case expr.first
258
259
  when :istr
@@ -322,8 +323,8 @@ module EBNF
322
323
 
323
324
  # Format a range
324
325
  def format_ebnf_range(string)
325
- lbrac = (@options[:html] ? "<code>[</code> " : "[")
326
- rbrac = (@options[:html] ? "<code>]</code> " : "]")
326
+ lbrac = (@options[:html] ? %(<code class="grammar-brac">[</code>) : "[")
327
+ rbrac = (@options[:html] ? %(<code class="grammar-brac">]</code>) : "]")
327
328
 
328
329
  buffer = lbrac
329
330
  s = StringScanner.new(string)
@@ -407,19 +408,19 @@ module EBNF
407
408
  seq.unshift(:seq)
408
409
  return format_abnf(seq, sep: nil, embedded: false)
409
410
  else
410
- return (@options[:html] ? %("<code class="grammar-literal">#{'%s' if sensitive}#{@coder.encode expr}</code>") : %(#{'%s' if sensitive}"#{expr}"))
411
+ return (@options[:html] ? %("<code class="grammar-literal">#{@coder.encode expr}</code>") : %("#{expr}"))
411
412
  end
412
413
  end
413
414
  parts = {
414
- alt: (@options[:html] ? "<code>/</code> " : "/ "),
415
- star: (@options[:html] ? "<code>*</code> " : "*"),
416
- plus: (@options[:html] ? "<code>+</code> " : "1*"),
417
- opt: (@options[:html] ? "<code>?</code> " : "?")
415
+ alt: (@options[:html] ? %(<code class="grammar-alt">/</code>) : "/ "),
416
+ star: (@options[:html] ? %(<code class="grammar-star">*</code>) : "*"),
417
+ plus: (@options[:html] ? %(<code class="grammar-plus">+</code>) : "1*"),
418
+ opt: (@options[:html] ? %(<code class="grammar-opt">?</code>) : "?")
418
419
  }
419
- lbrac = (@options[:html] ? "<code>[</code> " : "[")
420
- rbrac = (@options[:html] ? "<code>]</code> " : "]")
421
- lparen = (@options[:html] ? "<code>(</code> " : "(")
422
- rparen = (@options[:html] ? "<code>)</code> " : ")")
420
+ lbrac = (@options[:html] ? %(<code class="grammar-brac">[</code>) : "[")
421
+ rbrac = (@options[:html] ? %(<code class="grammar-brac">]</code>) : "]")
422
+ lparen = (@options[:html] ? %[<code class="grammar-paren">(</code>] : "(")
423
+ rparen = (@options[:html] ? %[<code class="grammar-paren">)</code>] : ")")
423
424
 
424
425
  case expr.first
425
426
  when :istr
@@ -464,6 +465,8 @@ module EBNF
464
465
  "#{parts[:star]}#{r}"
465
466
  elsif min > 0 && max == '*'
466
467
  "#{min}#{parts[:star]}#{r}"
468
+ elsif min == 0
469
+ "#{parts[:star]}#{max}#{r}"
467
470
  else
468
471
  "#{min}#{parts[:star]}#{max}#{r}"
469
472
  end
@@ -503,6 +506,7 @@ module EBNF
503
506
  # Append any decimal values
504
507
  alt << "%d" + deces.join(".") unless deces.empty?
505
508
  deces = []
509
+ hex = hex.upcase
506
510
 
507
511
  if in_range
508
512
  # Add "." sequences for any previous hexes
@@ -552,7 +556,7 @@ module EBNF
552
556
  when 0x0100..0xffff then "%04X"
553
557
  else "%08X"
554
558
  end
555
- char = "%x" + (fmt % u.ord)
559
+ char = "%x" + (fmt % u.ord).upcase
556
560
  if @options[:html]
557
561
  if u.ord <= 0x20
558
562
  char = %(<abbr title="#{ASCII_ESCAPE_NAMES[u.ord]}">#{@coder.encode char}</abbr>)
@@ -593,11 +597,11 @@ module EBNF
593
597
  end
594
598
  end
595
599
  parts = {
596
- alt: (@options[:html] ? "<code>|</code> " : "| "),
597
- diff: (@options[:html] ? "<code>-</code> " : "- "),
600
+ alt: (@options[:html] ? %(<code class="grammar-alt">|</code> ) : "| "),
601
+ diff: (@options[:html] ? %(<code class="grammar-diff">-</code> ) : "- "),
598
602
  }
599
- lparen = (@options[:html] ? "<code>(</code> " : "(")
600
- rparen = (@options[:html] ? "<code>)</code> " : ")")
603
+ lparen = (@options[:html] ? %[<code class="grammar-paren">(</code>] : "(")
604
+ rparen = (@options[:html] ? %[<code class="grammar-paren">)</code>] : ")")
601
605
 
602
606
  case expr.first
603
607
  when :istr
@@ -705,6 +709,7 @@ module EBNF
705
709
  end
706
710
 
707
711
  ERB_DESC = %q(
712
+ <!-- Generated with ebnf version #{EBNF::VERSION}. See https://github.com/dryruby/ebnf. -->
708
713
  <table class="grammar">
709
714
  <tbody id="grammar-productions" class="<%= @format %>">
710
715
  <% for rule in @rules %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebnf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-23 00:00:00.000000000 Z
11
+ date: 2023-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sxp
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.7'
75
+ version: '1.8'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.7'
82
+ version: '1.8'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: amazing_print
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -87,7 +87,7 @@ dependencies:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.4'
90
- type: :runtime
90
+ type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
@@ -128,14 +128,20 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.12'
131
+ version: '1.13'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 1.13.4
132
135
  type: :development
133
136
  prerelease: false
134
137
  version_requirements: !ruby/object:Gem::Requirement
135
138
  requirements:
136
139
  - - "~>"
137
140
  - !ruby/object:Gem::Version
138
- version: '1.12'
141
+ version: '1.13'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 1.13.4
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: erubis
141
147
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +162,14 @@ dependencies:
156
162
  requirements:
157
163
  - - "~>"
158
164
  - !ruby/object:Gem::Version
159
- version: '3.10'
165
+ version: '3.12'
160
166
  type: :development
161
167
  prerelease: false
162
168
  version_requirements: !ruby/object:Gem::Requirement
163
169
  requirements:
164
170
  - - "~>"
165
171
  - !ruby/object:Gem::Version
166
- version: '3.10'
172
+ version: '3.12'
167
173
  - !ruby/object:Gem::Dependency
168
174
  name: rspec-its
169
175
  requirement: !ruby/object:Gem::Requirement
@@ -294,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
300
  - !ruby/object:Gem::Version
295
301
  version: '0'
296
302
  requirements: []
297
- rubygems_version: 3.3.3
303
+ rubygems_version: 3.4.6
298
304
  signing_key:
299
305
  specification_version: 4
300
306
  summary: EBNF parser and parser generator in Ruby.