30 rules = ({
'name':
'ini-file',
37 'opcodes': ({
'type': 2,
'children': (1, 5)},
38 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
39 {
'type': 1,
'children': (3, 4)},
40 {
'type': 4,
'index': 38},
41 {
'type': 4,
'index': 5},
42 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
43 {
'type': 4,
'index': 1})},
51 'opcodes': ({
'type': 2,
'children': (1, 2)},
52 {
'type': 4,
'index': 2},
53 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
54 {
'type': 1,
'children': (4, 5)},
55 {
'type': 4,
'index': 38},
56 {
'type': 4,
'index': 5})},
57 {
'name':
'section-line',
58 'lower':
'section-line',
64 'opcodes': ({
'type': 1,
'children': (1, 2)},
65 {
'type': 4,
'index': 3},
66 {
'type': 4,
'index': 4})},
67 {
'name':
'good-section-line',
68 'lower':
'good-section-line',
74 'opcodes': ({
'type': 2,
'children': (1, 2, 3, 4, 5, 6, 7, 9)},
75 {
'type': 7,
'string': (91,)},
76 {
'type': 4,
'index': 43},
77 {
'type': 4,
'index': 9},
78 {
'type': 4,
'index': 43},
79 {
'type': 7,
'string': (93,)},
80 {
'type': 4,
'index': 43},
81 {
'type': 3,
'min': 0,
'max': 1},
82 {
'type': 4,
'index': 42},
83 {
'type': 4,
'index': 41})},
84 {
'name':
'bad-section-line',
85 'lower':
'bad-section-line',
91 'opcodes': ({
'type': 2,
'children': (1, 2, 4)},
92 {
'type': 7,
'string': (91,)},
93 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
94 {
'type': 4,
'index': 47},
95 {
'type': 4,
'index': 41})},
96 {
'name':
'value-line',
97 'lower':
'value-line',
103 'opcodes': ({
'type': 1,
'children': (1, 2)},
104 {
'type': 4,
'index': 6},
105 {
'type': 4,
'index': 7})},
106 {
'name':
'good-value',
107 'lower':
'good-value',
113 'opcodes': ({
'type': 2,
'children': (1, 2, 3, 4, 5, 6, 7, 9)},
114 {
'type': 4,
'index': 10},
115 {
'type': 4,
'index': 43},
116 {
'type': 7,
'string': (61,)},
117 {
'type': 4,
'index': 43},
118 {
'type': 4,
'index': 8},
119 {
'type': 4,
'index': 43},
120 {
'type': 3,
'min': 0,
'max': 1},
121 {
'type': 4,
'index': 42},
122 {
'type': 4,
'index': 41})},
123 {
'name':
'bad-value-line',
124 'lower':
'bad-value-line',
130 'opcodes': ({
'type': 2,
'children': (1, 4, 6)},
131 {
'type': 1,
'children': (2, 3)},
132 {
'type': 5,
'min': 33,
'max': 90},
133 {
'type': 5,
'min': 92,
'max': 126},
134 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
135 {
'type': 4,
'index': 47},
136 {
'type': 4,
'index': 41})},
137 {
'name':
'value-array',
138 'lower':
'value-array',
144 'opcodes': ({
'type': 2,
'children': (1, 2)},
145 {
'type': 4,
'index': 11},
146 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
147 {
'type': 2,
'children': (4, 5, 6, 7)},
148 {
'type': 4,
'index': 43},
149 {
'type': 7,
'string': (44,)},
150 {
'type': 4,
'index': 43},
151 {
'type': 4,
'index': 11})},
152 {
'name':
'section-name',
153 'lower':
'section-name',
159 'opcodes': ({
'type': 4,
'index': 45},)},
167 'opcodes': ({
'type': 4,
'index': 45},)},
175 'opcodes': ({
'type': 1,
'children': (1, 2, 3, 4, 5)},
176 {
'type': 4,
'index': 16},
177 {
'type': 4,
'index': 12},
178 {
'type': 4,
'index': 18},
179 {
'type': 4,
'index': 20},
180 {
'type': 4,
'index': 17})},
188 'opcodes': ({
'type': 1,
'children': (1, 2, 3)},
189 {
'type': 4,
'index': 13},
190 {
'type': 4,
'index': 14},
191 {
'type': 4,
'index': 15})},
199 'opcodes': ({
'type': 1,
'children': (1, 2)},
200 {
'type': 7,
'string': (116, 114, 117, 101)},
201 {
'type': 7,
'string': (121, 101, 115)})},
209 'opcodes': ({
'type': 1,
'children': (1, 2)},
210 {
'type': 7,
'string': (102, 97, 108, 115, 101)},
211 {
'type': 7,
'string': (110, 111)})},
219 'opcodes': ({
'type': 1,
'children': (1, 2)},
220 {
'type': 7,
'string': (110, 117, 108, 108)},
221 {
'type': 7,
'string': (118, 111, 105, 100)})},
229 'opcodes': ({
'type': 3,
'min': 1,
'max': 9223372036854775807},
230 {
'type': 4,
'index': 46})},
238 'opcodes': ({
'type': 2,
'children': (1, 8)},
239 {
'type': 1,
'children': (2, 3, 4, 5, 6, 7)},
240 {
'type': 6,
'string': (33,)},
241 {
'type': 5,
'min': 35,
'max': 38},
242 {
'type': 5,
'min': 40,
'max': 43},
243 {
'type': 5,
'min': 45,
'max': 91},
244 {
'type': 5,
'min': 93,
'max': 126},
245 {
'type': 4,
'index': 22},
246 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
247 {
'type': 1,
'children': (10, 11, 12, 13)},
248 {
'type': 5,
'min': 32,
'max': 43},
249 {
'type': 5,
'min': 45,
'max': 91},
250 {
'type': 5,
'min': 93,
'max': 126},
251 {
'type': 4,
'index': 22})},
252 {
'name':
'd-quoted-string',
253 'lower':
'd-quoted-string',
259 'opcodes': ({
'type': 2,
'children': (1, 2, 3)},
260 {
'type': 6,
'string': (34,)},
261 {
'type': 4,
'index': 19},
262 {
'type': 6,
'string': (34,)})},
263 {
'name':
'd-quoted-value',
264 'lower':
'd-quoted-value',
270 'opcodes': ({
'type': 3,
'min': 1,
'max': 9223372036854775807},
271 {
'type': 1,
'children': (2, 3, 4, 5)},
272 {
'type': 5,
'min': 32,
'max': 33},
273 {
'type': 5,
'min': 35,
'max': 91},
274 {
'type': 5,
'min': 93,
'max': 126},
275 {
'type': 4,
'index': 22})},
276 {
'name':
's-quoted-string',
277 'lower':
's-quoted-string',
283 'opcodes': ({
'type': 2,
'children': (1, 2, 3)},
284 {
'type': 6,
'string': (39,)},
285 {
'type': 4,
'index': 21},
286 {
'type': 6,
'string': (39,)})},
287 {
'name':
's-quoted-value',
288 'lower':
's-quoted-value',
294 'opcodes': ({
'type': 3,
'min': 1,
'max': 9223372036854775807},
295 {
'type': 1,
'children': (2, 3, 4, 5)},
296 {
'type': 5,
'min': 32,
'max': 38},
297 {
'type': 5,
'min': 40,
'max': 91},
298 {
'type': 5,
'min': 93,
'max': 126},
299 {
'type': 4,
'index': 22})},
307 'opcodes': ({
'type': 2,
'children': (1, 2)},
308 {
'type': 6,
'string': (92,)},
310 'children': (3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)},
311 {
'type': 4,
'index': 23},
312 {
'type': 4,
'index': 24},
313 {
'type': 4,
'index': 25},
314 {
'type': 4,
'index': 26},
315 {
'type': 4,
'index': 27},
316 {
'type': 4,
'index': 28},
317 {
'type': 4,
'index': 29},
318 {
'type': 4,
'index': 30},
319 {
'type': 4,
'index': 31},
320 {
'type': 4,
'index': 32},
321 {
'type': 4,
'index': 33},
322 {
'type': 4,
'index': 34},
323 {
'type': 4,
'index': 35},
324 {
'type': 4,
'index': 36})},
325 {
'name':
'back-slash',
326 'lower':
'back-slash',
332 'opcodes': ({
'type': 6,
'string': (92,)},)},
333 {
'name':
'double-quote',
334 'lower':
'double-quote',
340 'opcodes': ({
'type': 6,
'string': (34,)},)},
348 'opcodes': ({
'type': 6,
'string': (35,)},)},
349 {
'name':
'single-quote',
350 'lower':
'single-quote',
356 'opcodes': ({
'type': 6,
'string': (39,)},)},
364 'opcodes': ({
'type': 6,
'string': (44,)},)},
372 'opcodes': ({
'type': 6,
'string': (58,)},)},
373 {
'name':
'semicolon',
374 'lower':
'semicolon',
380 'opcodes': ({
'type': 6,
'string': (59,)},)},
381 {
'name':
'equal-sign',
382 'lower':
'equal-sign',
388 'opcodes': ({
'type': 6,
'string': (61,)},)},
396 'opcodes': ({
'type': 6,
'string': (98,)},)},
404 'opcodes': ({
'type': 6,
'string': (116,)},)},
405 {
'name':
'line-feed',
406 'lower':
'line-feed',
412 'opcodes': ({
'type': 6,
'string': (110,)},)},
413 {
'name':
'carriage-return',
414 'lower':
'carriage-return',
420 'opcodes': ({
'type': 6,
'string': (114,)},)},
428 'opcodes': ({
'type': 2,
'children': (1, 2)},
429 {
'type': 6,
'string': (117,)},
430 {
'type': 3,
'min': 4,
'max': 4},
431 {
'type': 4,
'index': 37})},
432 {
'name':
'hexadecimal',
433 'lower':
'hexadecimal',
439 'opcodes': ({
'type': 2,
'children': (1, 2)},
440 {
'type': 6,
'string': (120,)},
441 {
'type': 3,
'min': 2,
'max': 2},
442 {
'type': 4,
'index': 37})},
450 'opcodes': ({
'type': 1,
'children': (1, 2, 3)},
451 {
'type': 5,
'min': 48,
'max': 57},
452 {
'type': 5,
'min': 65,
'max': 72},
453 {
'type': 5,
'min': 97,
'max': 104})},
454 {
'name':
'blank-line',
455 'lower':
'blank-line',
461 'opcodes': ({
'type': 1,
'children': (1, 2)},
462 {
'type': 4,
'index': 39},
463 {
'type': 4,
'index': 40})},
464 {
'name':
'good-blank-line',
465 'lower':
'good-blank-line',
471 'opcodes': ({
'type': 2,
'children': (1, 2, 4)},
472 {
'type': 4,
'index': 43},
473 {
'type': 3,
'min': 0,
'max': 1},
474 {
'type': 4,
'index': 42},
475 {
'type': 4,
'index': 41})},
476 {
'name':
'bad-blank-line',
477 'lower':
'bad-blank-line',
483 'opcodes': ({
'type': 2,
'children': (1, 4, 5, 8, 10)},
484 {
'type': 1,
'children': (2, 3)},
485 {
'type': 6,
'string': (32,)},
486 {
'type': 6,
'string': (9,)},
487 {
'type': 4,
'index': 43},
488 {
'type': 1,
'children': (6, 7)},
489 {
'type': 5,
'min': 33,
'max': 58},
490 {
'type': 5,
'min': 60,
'max': 126},
491 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
492 {
'type': 4,
'index': 47},
493 {
'type': 4,
'index': 41})},
501 'opcodes': ({
'type': 1,
'children': (1, 2, 3)},
502 {
'type': 6,
'string': (13, 10)},
503 {
'type': 6,
'string': (10,)},
504 {
'type': 6,
'string': (13,)})},
512 'opcodes': ({
'type': 2,
'children': (1, 2)},
513 {
'type': 6,
'string': (59,)},
514 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
515 {
'type': 4,
'index': 47})},
523 'opcodes': ({
'type': 3,
'min': 0,
'max': 9223372036854775807},
524 {
'type': 1,
'children': (2, 3)},
525 {
'type': 6,
'string': (32,)},
526 {
'type': 6,
'string': (9,)})},
534 'opcodes': ({
'type': 1,
'children': (1, 2)},
535 {
'type': 5,
'min': 65,
'max': 90},
536 {
'type': 5,
'min': 97,
'max': 122})},
544 'opcodes': ({
'type': 2,
'children': (1, 4)},
545 {
'type': 1,
'children': (2, 3)},
546 {
'type': 4,
'index': 44},
547 {
'type': 6,
'string': (95,)},
548 {
'type': 3,
'min': 0,
'max': 9223372036854775807},
549 {
'type': 1,
'children': (6, 7, 8)},
550 {
'type': 4,
'index': 44},
551 {
'type': 4,
'index': 46},
552 {
'type': 6,
'string': (95,)})},
560 'opcodes': ({
'type': 5,
'min': 48,
'max': 57},)},
568 'opcodes': ({
'type': 1,
'children': (1, 2)},
569 {
'type': 5,
'min': 32,
'max': 126},
570 {
'type': 6,
'string': (9,)})})
580 '''Displays the original SABNF syntax.'''
583 sabnf +=
"; Ref: https://en.wikipedia.org: INI File\n"
585 sabnf +=
"; comments begin with the semicolon, \";\" and continue to the end of the line\n"
586 sabnf +=
"; comments may appear on valid section and value lines as well as blank lines\n"
587 sabnf +=
"; line ends may be CRLF, LF or CR\n"
588 sabnf +=
"; tabs, 0x09, may NOT occur in quoted strings\n"
590 sabnf +=
"; keys may have multiple values\n"
591 sabnf +=
"; - multiple values may be given as a comma delimited list on a single line\n"
592 sabnf +=
"; - multiple values may be listed separately on separate lines with the same key name\n"
594 sabnf +=
"; section names are optional\n"
595 sabnf +=
"; - keys need not appear in a named section\n"
597 sabnf +=
"; sections are \"disjoint\",\n"
598 sabnf +=
"; - that is the keys in multiple occurrences of a section name are\n"
599 sabnf +=
"; - simply joined together as if they appeared contiguously in a single section\n"
601 sabnf +=
"; sections end at the beginning of a new section or the end of file\n"
603 sabnf +=
"; section and key names are alphanumeric + underscore (must begin with alpha or underscore)\n"
604 sabnf +=
"; values that are not alphanumeric must be single or double quoted\n"
606 sabnf +=
"; The grammar is designed to accept any string of ASCII characters without failure.\n"
607 sabnf +=
"; The \"error productions\", bad-section-line, bad-value-line, bad-blank-line are meant to accept all lines\n"
608 sabnf +=
"; that are not otherwise correct blank, section or value lines. This is so that\n"
609 sabnf +=
"; parser callback functions can recognize input errors and report or react to them\n"
610 sabnf +=
"; in an application-dependent manner.\n"
613 sabnf +=
"ini-file = *(blank-line / value-line) *section\n"
614 sabnf +=
"section = section-line *(blank-line / value-line)\n"
615 sabnf +=
"section-line = good-section-line / bad-section-line\n"
616 sabnf +=
"good-section-line = \"[\" wsp section-name wsp \"]\" wsp [comment] line-end\n"
617 sabnf +=
"bad-section-line = \"[\" *any line-end;\n"
618 sabnf +=
"value-line = good-value / bad-value-line\n"
619 sabnf +=
"good-value = key-name wsp \"=\" wsp value-array wsp [comment] line-end\n"
620 sabnf +=
"bad-value-line = (%d33-90 / %d92-126) *any line-end\n"
621 sabnf +=
"value-array = value *(wsp \",\" wsp value)\n"
622 sabnf +=
"section-name = alphanum\n"
623 sabnf +=
"key-name = alphanum\n"
624 sabnf +=
"value = number / boolean / d-quoted-string / s-quoted-string / string\n"
625 sabnf +=
"boolean = true / false / null\n"
626 sabnf +=
"true = \"true\" / \"yes\"\n"
627 sabnf +=
"false = \"false\" / \"no\"\n"
628 sabnf +=
"null = \"null\" / \"void\"\n"
629 sabnf +=
"number = 1*digit\n"
630 sabnf +=
"string = (%d33 / %d35-38 / %d40-43 / %d45-91 / %d93-126 / escaped) *(%d32-43 / %d45-91 / %d93-126 / escaped)\n"
631 sabnf +=
"d-quoted-string = %d34 d-quoted-value %d34\n"
632 sabnf +=
"d-quoted-value = 1*(%d32-33 / %d35-91 / %d93-126 / escaped)\n"
633 sabnf +=
"s-quoted-string = %d39 s-quoted-value %d39\n"
634 sabnf +=
"s-quoted-value = 1*(%d32-38 / %d40-91 / %d93-126 / escaped)\n"
635 sabnf +=
"escaped = %x5c (back-slash\n"
636 sabnf +=
" / double-quote\n"
638 sabnf +=
" / single-quote\n"
639 sabnf +=
" / comma\n"
640 sabnf +=
" / colon\n"
641 sabnf +=
" / semicolon\n"
642 sabnf +=
" / equal-sign\n"
643 sabnf +=
" / blank\n"
645 sabnf +=
" / line-feed\n"
646 sabnf +=
" / carriage-return\n"
647 sabnf +=
" / unicode\n"
648 sabnf +=
" / hexadecimal)\n"
649 sabnf +=
"back-slash = %x5c\n"
650 sabnf +=
"double-quote = %x22\n"
651 sabnf +=
"hash = %x23\n"
652 sabnf +=
"single-quote = %x27\n"
653 sabnf +=
"comma = %x2c\n"
654 sabnf +=
"colon = %x3a\n"
655 sabnf +=
"semicolon = %x3b\n"
656 sabnf +=
"equal-sign = %x3d\n"
657 sabnf +=
"blank = %s\"b\"\n"
658 sabnf +=
"tab = %s\"t\"\n"
659 sabnf +=
"line-feed = %s\"n\"\n"
660 sabnf +=
"carriage-return = %s\"r\"\n"
661 sabnf +=
"unicode = %s\"u\" 4hh\n"
662 sabnf +=
"hexadecimal = %s\"x\" 2hh\n"
663 sabnf +=
"hh = %d48-57 / %d65-72 / %d97-104\n"
664 sabnf +=
"blank-line = good-blank-line / bad-blank-line\n"
665 sabnf +=
"good-blank-line = wsp [comment] line-end\n"
666 sabnf +=
"bad-blank-line = (%d32 / %d9) wsp (%d33-58 / %d60-126) *any line-end\n"
667 sabnf +=
"line-end = %d13.10 / %d10 / %d13\n"
668 sabnf +=
"comment = %d59 *any\n"
669 sabnf +=
"wsp = *(%d32 / %d9)\n"
670 sabnf +=
"alpha = %d65-90 / %d97-122\n"
671 sabnf +=
"alphanum = (alpha / %d95) *(alpha / digit / %d95)\n"
672 sabnf +=
"digit = %d48-57\n"
673 sabnf +=
"any = %d32-126 / %d9\n"
def to_string()
Displays the original SABNF syntax.