Version 1.0
Copyright © 2023 Lowell D. Thomas
python-ini
 … powered by Python APG
grammar.py
Go to the documentation of this file.
1 # Copyright (c) 2022 Lowell D. Thomas, all rights reserved
2 # BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
3 #
4 
5 # SUMMARY
6 # rules = 61
7 # udts = 4
8 # opcodes = 292
9 # --- ABNF original opcodes
10 # ALT = 37
11 # CAT = 25
12 # REP = 31
13 # RNM = 95
14 # TLS = 15
15 # TBS = 49
16 # TRG = 32
17 # --- SABNF super set opcodes
18 # UDT = 4
19 # AND = 2
20 # NOT = 0
21 # BKA = 0
22 # BKN = 0
23 # BKR = 0
24 # ABG = 0
25 # AEN = 2
26 # characters = [9 - 126] + user defined
27 #
28 
29 # RULES
30 rules = ({'name': 'ini-file',
31  'lower': 'ini-file',
32  'index': 0,
33  'line': 42,
34  'is_bkru': False,
35  'is_bkrr': False,
36  'has_bkrr': False,
37  'opcodes': ({'type': 2, 'children': (1, 5)},
38  {'type': 3, 'min': 0, 'max': 9223372036854775807},
39  {'type': 1, 'children': (3, 4)},
40  {'type': 4, 'index': 49},
41  {'type': 4, 'index': 5},
42  {'type': 3, 'min': 0, 'max': 9223372036854775807},
43  {'type': 4, 'index': 1})},
44  {'name': 'section',
45  'lower': 'section',
46  'index': 1,
47  'line': 43,
48  'is_bkru': False,
49  'is_bkrr': False,
50  'has_bkrr': False,
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': 49},
56  {'type': 4, 'index': 5})},
57  {'name': 'section-line',
58  'lower': 'section-line',
59  'index': 2,
60  'line': 44,
61  'is_bkru': False,
62  'is_bkrr': False,
63  'has_bkrr': False,
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',
69  'index': 3,
70  'line': 45,
71  'is_bkru': False,
72  'is_bkrr': False,
73  'has_bkrr': False,
74  'opcodes': ({'type': 2, 'children': (1, 2, 3, 4, 5, 6, 7, 9)},
75  {'type': 6, 'string': (91,)},
76  {'type': 4, 'index': 56},
77  {'type': 4, 'index': 11},
78  {'type': 4, 'index': 56},
79  {'type': 6, 'string': (93,)},
80  {'type': 4, 'index': 56},
81  {'type': 3, 'min': 0, 'max': 1},
82  {'type': 4, 'index': 55},
83  {'type': 4, 'index': 52})},
84  {'name': 'bad-section-line',
85  'lower': 'bad-section-line',
86  'index': 4,
87  'line': 46,
88  'is_bkru': False,
89  'is_bkrr': False,
90  'has_bkrr': False,
91  'opcodes': ({'type': 2, 'children': (1, 2, 4)},
92  {'type': 6, 'string': (91,)},
93  {'type': 3, 'min': 0, 'max': 9223372036854775807},
94  {'type': 4, 'index': 60},
95  {'type': 4, 'index': 52})},
96  {'name': 'value-line',
97  'lower': 'value-line',
98  'index': 5,
99  'line': 47,
100  'is_bkru': False,
101  'is_bkrr': False,
102  'has_bkrr': False,
103  'opcodes': ({'type': 1, 'children': (1, 2)},
104  {'type': 4, 'index': 6},
105  {'type': 4, 'index': 8})},
106  {'name': 'good-value',
107  'lower': 'good-value',
108  'index': 6,
109  'line': 48,
110  'is_bkru': False,
111  'is_bkrr': False,
112  'has_bkrr': False,
113  'opcodes': ({'type': 2, 'children': (1, 2, 7, 8, 10)},
114  {'type': 4, 'index': 12},
115  {'type': 3, 'min': 0, 'max': 1},
116  {'type': 2, 'children': (4, 5)},
117  {'type': 4, 'index': 7},
118  {'type': 3, 'min': 0, 'max': 1},
119  {'type': 4, 'index': 9},
120  {'type': 4, 'index': 56},
121  {'type': 3, 'min': 0, 'max': 1},
122  {'type': 4, 'index': 55},
123  {'type': 4, 'index': 52})},
124  {'name': 'key-delim',
125  'lower': 'key-delim',
126  'index': 7,
127  'line': 49,
128  'is_bkru': False,
129  'is_bkrr': False,
130  'has_bkrr': False,
131  'opcodes': ({'type': 1, 'children': (1, 7)},
132  {'type': 2, 'children': (2, 3, 6)},
133  {'type': 4, 'index': 56},
134  {'type': 1, 'children': (4, 5)},
135  {'type': 6, 'string': (61,)},
136  {'type': 6, 'string': (58,)},
137  {'type': 4, 'index': 56},
138  {'type': 4, 'index': 57})},
139  {'name': 'bad-value-line',
140  'lower': 'bad-value-line',
141  'index': 8,
142  'line': 50,
143  'is_bkru': False,
144  'is_bkrr': False,
145  'has_bkrr': False,
146  'opcodes': ({'type': 2, 'children': (1, 4, 8)},
147  {'type': 1, 'children': (2, 3)},
148  {'type': 5, 'min': 33, 'max': 90},
149  {'type': 5, 'min': 92, 'max': 126},
150  {'type': 3, 'min': 0, 'max': 9223372036854775807},
151  {'type': 1, 'children': (6, 7)},
152  {'type': 4, 'index': 54},
153  {'type': 4, 'index': 60},
154  {'type': 4, 'index': 52})},
155  {'name': 'value-array',
156  'lower': 'value-array',
157  'index': 9,
158  'line': 51,
159  'is_bkru': False,
160  'is_bkrr': False,
161  'has_bkrr': False,
162  'opcodes': ({'type': 2, 'children': (1, 2)},
163  {'type': 4, 'index': 14},
164  {'type': 3, 'min': 0, 'max': 9223372036854775807},
165  {'type': 2, 'children': (4, 5)},
166  {'type': 4, 'index': 10},
167  {'type': 4, 'index': 14})},
168  {'name': 'value-delim',
169  'lower': 'value-delim',
170  'index': 10,
171  'line': 52,
172  'is_bkru': False,
173  'is_bkrr': False,
174  'has_bkrr': False,
175  'opcodes': ({'type': 1, 'children': (1, 5)},
176  {'type': 2, 'children': (2, 3, 4)},
177  {'type': 4, 'index': 56},
178  {'type': 6, 'string': (44,)},
179  {'type': 4, 'index': 56},
180  {'type': 4, 'index': 57})},
181  {'name': 'section-name',
182  'lower': 'section-name',
183  'index': 11,
184  'line': 53,
185  'is_bkru': False,
186  'is_bkrr': False,
187  'has_bkrr': False,
188  'opcodes': ({'type': 4, 'index': 13},)},
189  {'name': 'key-name',
190  'lower': 'key-name',
191  'index': 12,
192  'line': 54,
193  'is_bkru': False,
194  'is_bkrr': False,
195  'has_bkrr': False,
196  'opcodes': ({'type': 4, 'index': 13},)},
197  {'name': 'name',
198  'lower': 'name',
199  'index': 13,
200  'line': 55,
201  'is_bkru': False,
202  'is_bkrr': False,
203  'has_bkrr': False,
204  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
205  {'type': 1, 'children': (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)},
206  {'type': 5, 'min': 97, 'max': 122},
207  {'type': 5, 'min': 65, 'max': 90},
208  {'type': 5, 'min': 48, 'max': 57},
209  {'type': 6, 'string': (33,)},
210  {'type': 5, 'min': 36, 'max': 38},
211  {'type': 5, 'min': 40, 'max': 43},
212  {'type': 5, 'min': 45, 'max': 46},
213  {'type': 6, 'string': (60,)},
214  {'type': 5, 'min': 62, 'max': 64},
215  {'type': 5, 'min': 94, 'max': 95},
216  {'type': 5, 'min': 123, 'max': 126})},
217  {'name': 'value',
218  'lower': 'value',
219  'index': 14,
220  'line': 66,
221  'is_bkru': False,
222  'is_bkrr': False,
223  'has_bkrr': False,
224  'opcodes': ({'type': 1, 'children': (1, 2, 3, 4, 5)},
225  {'type': 4, 'index': 19},
226  {'type': 4, 'index': 15},
227  {'type': 4, 'index': 31},
228  {'type': 4, 'index': 33},
229  {'type': 4, 'index': 30})},
230  {'name': 'boolean',
231  'lower': 'boolean',
232  'index': 15,
233  'line': 67,
234  'is_bkru': False,
235  'is_bkrr': False,
236  'has_bkrr': False,
237  'opcodes': ({'type': 1, 'children': (1, 2, 3)},
238  {'type': 4, 'index': 18},
239  {'type': 4, 'index': 16},
240  {'type': 4, 'index': 17})},
241  {'name': 'true',
242  'lower': 'true',
243  'index': 16,
244  'line': 68,
245  'is_bkru': False,
246  'is_bkrr': False,
247  'has_bkrr': False,
248  'opcodes': ({'type': 1, 'children': (1, 2, 3)},
249  {'type': 7, 'string': (116, 114, 117, 101)},
250  {'type': 7, 'string': (121, 101, 115)},
251  {'type': 7, 'string': (111, 110)})},
252  {'name': 'false',
253  'lower': 'false',
254  'index': 17,
255  'line': 69,
256  'is_bkru': False,
257  'is_bkrr': False,
258  'has_bkrr': False,
259  'opcodes': ({'type': 1, 'children': (1, 2, 3)},
260  {'type': 7, 'string': (102, 97, 108, 115, 101)},
261  {'type': 7, 'string': (110, 111)},
262  {'type': 7, 'string': (111, 102, 102)})},
263  {'name': 'null',
264  'lower': 'null',
265  'index': 18,
266  'line': 70,
267  'is_bkru': False,
268  'is_bkrr': False,
269  'has_bkrr': False,
270  'opcodes': ({'type': 1, 'children': (1, 2, 3)},
271  {'type': 7, 'string': (110, 117, 108, 108)},
272  {'type': 7, 'string': (118, 111, 105, 100)},
273  {'type': 7, 'string': (110, 111, 110, 101)})},
274  {'name': 'number',
275  'lower': 'number',
276  'index': 19,
277  'line': 71,
278  'is_bkru': False,
279  'is_bkrr': False,
280  'has_bkrr': False,
281  'opcodes': ({'type': 2, 'children': (1, 4)},
282  {'type': 1, 'children': (2, 3)},
283  {'type': 4, 'index': 20},
284  {'type': 4, 'index': 21},
285  {'type': 12},
286  {'type': 1, 'children': (6, 7, 8)},
287  {'type': 6, 'string': (44,)},
288  {'type': 4, 'index': 57},
289  {'type': 4, 'index': 53})},
290  {'name': 'int',
291  'lower': 'int',
292  'index': 20,
293  'line': 74,
294  'is_bkru': False,
295  'is_bkrr': False,
296  'has_bkrr': False,
297  'opcodes': ({'type': 2, 'children': (1, 5, 7)},
298  {'type': 3, 'min': 0, 'max': 1},
299  {'type': 1, 'children': (3, 4)},
300  {'type': 6, 'string': (43,)},
301  {'type': 6, 'string': (45,)},
302  {'type': 3, 'min': 1, 'max': 9223372036854775807},
303  {'type': 4, 'index': 59},
304  {'type': 12},
305  {'type': 1, 'children': (9, 10, 11)},
306  {'type': 6, 'string': (44,)},
307  {'type': 4, 'index': 57},
308  {'type': 4, 'index': 53})},
309  {'name': 'float',
310  'lower': 'float',
311  'index': 21,
312  'line': 75,
313  'is_bkru': False,
314  'is_bkrr': False,
315  'has_bkrr': False,
316  'opcodes': ({'type': 2, 'children': (1, 3, 4)},
317  {'type': 3, 'min': 0, 'max': 1},
318  {'type': 4, 'index': 22},
319  {'type': 4, 'index': 23},
320  {'type': 3, 'min': 0, 'max': 1},
321  {'type': 4, 'index': 27})},
322  {'name': 'sign',
323  'lower': 'sign',
324  'index': 22,
325  'line': 76,
326  'is_bkru': False,
327  'is_bkrr': False,
328  'has_bkrr': False,
329  'opcodes': ({'type': 1, 'children': (1, 2)},
330  {'type': 7, 'string': (43,)},
331  {'type': 7, 'string': (45,)})},
332  {'name': 'decimal',
333  'lower': 'decimal',
334  'index': 23,
335  'line': 77,
336  'is_bkru': False,
337  'is_bkrr': False,
338  'has_bkrr': False,
339  'opcodes': ({'type': 1, 'children': (1, 8)},
340  {'type': 2, 'children': (2, 3)},
341  {'type': 4, 'index': 24},
342  {'type': 3, 'min': 0, 'max': 1},
343  {'type': 2, 'children': (5, 6)},
344  {'type': 4, 'index': 25},
345  {'type': 3, 'min': 0, 'max': 1},
346  {'type': 4, 'index': 26},
347  {'type': 2, 'children': (9, 10)},
348  {'type': 4, 'index': 25},
349  {'type': 4, 'index': 26})},
350  {'name': 'integer',
351  'lower': 'integer',
352  'index': 24,
353  'line': 79,
354  'is_bkru': False,
355  'is_bkrr': False,
356  'has_bkrr': False,
357  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
358  {'type': 5, 'min': 48, 'max': 57})},
359  {'name': 'dot',
360  'lower': 'dot',
361  'index': 25,
362  'line': 80,
363  'is_bkru': False,
364  'is_bkrr': False,
365  'has_bkrr': False,
366  'opcodes': ({'type': 7, 'string': (46,)},)},
367  {'name': 'fraction',
368  'lower': 'fraction',
369  'index': 26,
370  'line': 81,
371  'is_bkru': False,
372  'is_bkrr': False,
373  'has_bkrr': False,
374  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
375  {'type': 5, 'min': 48, 'max': 57})},
376  {'name': 'exponent',
377  'lower': 'exponent',
378  'index': 27,
379  'line': 82,
380  'is_bkru': False,
381  'is_bkrr': False,
382  'has_bkrr': False,
383  'opcodes': ({'type': 2, 'children': (1, 2, 4)},
384  {'type': 7, 'string': (101,)},
385  {'type': 3, 'min': 0, 'max': 1},
386  {'type': 4, 'index': 28},
387  {'type': 4, 'index': 29})},
388  {'name': 'esign',
389  'lower': 'esign',
390  'index': 28,
391  'line': 83,
392  'is_bkru': False,
393  'is_bkrr': False,
394  'has_bkrr': False,
395  'opcodes': ({'type': 1, 'children': (1, 2)},
396  {'type': 7, 'string': (43,)},
397  {'type': 7, 'string': (45,)})},
398  {'name': 'exp',
399  'lower': 'exp',
400  'index': 29,
401  'line': 84,
402  'is_bkru': False,
403  'is_bkrr': False,
404  'has_bkrr': False,
405  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
406  {'type': 5, 'min': 48, 'max': 57})},
407  {'name': 'string',
408  'lower': 'string',
409  'index': 30,
410  'line': 85,
411  'is_bkru': False,
412  'is_bkrr': False,
413  'has_bkrr': False,
414  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
415  {'type': 1, 'children': (2, 3, 4, 5, 6, 7, 8, 9, 10)},
416  {'type': 6, 'string': (33,)},
417  {'type': 5, 'min': 36, 'max': 38},
418  {'type': 5, 'min': 40, 'max': 43},
419  {'type': 5, 'min': 45, 'max': 46},
420  {'type': 5, 'min': 48, 'max': 57},
421  {'type': 6, 'string': (60,)},
422  {'type': 5, 'min': 62, 'max': 91},
423  {'type': 5, 'min': 93, 'max': 126},
424  {'type': 4, 'index': 35})},
425  {'name': 'd-quoted-string',
426  'lower': 'd-quoted-string',
427  'index': 31,
428  'line': 87,
429  'is_bkru': False,
430  'is_bkrr': False,
431  'has_bkrr': False,
432  'opcodes': ({'type': 2, 'children': (1, 2, 3)},
433  {'type': 6, 'string': (34,)},
434  {'type': 4, 'index': 32},
435  {'type': 6, 'string': (34,)})},
436  {'name': 'd-quoted-value',
437  'lower': 'd-quoted-value',
438  'index': 32,
439  'line': 88,
440  'is_bkru': False,
441  'is_bkrr': False,
442  'has_bkrr': False,
443  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
444  {'type': 1, 'children': (2, 3, 4, 5)},
445  {'type': 5, 'min': 32, 'max': 33},
446  {'type': 5, 'min': 35, 'max': 91},
447  {'type': 5, 'min': 93, 'max': 126},
448  {'type': 4, 'index': 35})},
449  {'name': 's-quoted-string',
450  'lower': 's-quoted-string',
451  'index': 33,
452  'line': 89,
453  'is_bkru': False,
454  'is_bkrr': False,
455  'has_bkrr': False,
456  'opcodes': ({'type': 2, 'children': (1, 2, 3)},
457  {'type': 6, 'string': (39,)},
458  {'type': 4, 'index': 34},
459  {'type': 6, 'string': (39,)})},
460  {'name': 's-quoted-value',
461  'lower': 's-quoted-value',
462  'index': 34,
463  'line': 90,
464  'is_bkru': False,
465  'is_bkrr': False,
466  'has_bkrr': False,
467  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
468  {'type': 1, 'children': (2, 3, 4, 5)},
469  {'type': 5, 'min': 32, 'max': 38},
470  {'type': 5, 'min': 40, 'max': 91},
471  {'type': 5, 'min': 93, 'max': 126},
472  {'type': 4, 'index': 35})},
473  {'name': 'escaped',
474  'lower': 'escaped',
475  'index': 35,
476  'line': 91,
477  'is_bkru': False,
478  'is_bkrr': False,
479  'has_bkrr': False,
480  'opcodes': ({'type': 2, 'children': (1, 2)},
481  {'type': 4, 'index': 36},
482  {'type': 1,
483  'children': (3,
484  4,
485  5,
486  6,
487  7,
488  8,
489  9,
490  10,
491  11,
492  12,
493  13,
494  14,
495  15,
496  16,
497  17,
498  18,
499  19)},
500  {'type': 4, 'index': 36},
501  {'type': 4, 'index': 41},
502  {'type': 4, 'index': 37},
503  {'type': 4, 'index': 38},
504  {'type': 4, 'index': 39},
505  {'type': 4, 'index': 40},
506  {'type': 4, 'index': 42},
507  {'type': 4, 'index': 43},
508  {'type': 4, 'index': 44},
509  {'type': 4, 'index': 45},
510  {'type': 4, 'index': 46},
511  {'type': 4, 'index': 47},
512  {'type': 4, 'index': 48},
513  {'type': 11, 'empty': False, 'index': 0},
514  {'type': 11, 'empty': False, 'index': 1},
515  {'type': 11, 'empty': False, 'index': 2},
516  {'type': 11, 'empty': False, 'index': 3})},
517  {'name': 'reverse-solidus',
518  'lower': 'reverse-solidus',
519  'index': 36,
520  'line': 113,
521  'is_bkru': False,
522  'is_bkrr': False,
523  'has_bkrr': False,
524  'opcodes': ({'type': 6, 'string': (92,)},)},
525  {'name': 'double-quote',
526  'lower': 'double-quote',
527  'index': 37,
528  'line': 114,
529  'is_bkru': False,
530  'is_bkrr': False,
531  'has_bkrr': False,
532  'opcodes': ({'type': 6, 'string': (34,)},)},
533  {'name': 'hash',
534  'lower': 'hash',
535  'index': 38,
536  'line': 115,
537  'is_bkru': False,
538  'is_bkrr': False,
539  'has_bkrr': False,
540  'opcodes': ({'type': 6, 'string': (35,)},)},
541  {'name': 'single-quote',
542  'lower': 'single-quote',
543  'index': 39,
544  'line': 116,
545  'is_bkru': False,
546  'is_bkrr': False,
547  'has_bkrr': False,
548  'opcodes': ({'type': 6, 'string': (39,)},)},
549  {'name': 'comma',
550  'lower': 'comma',
551  'index': 40,
552  'line': 117,
553  'is_bkru': False,
554  'is_bkrr': False,
555  'has_bkrr': False,
556  'opcodes': ({'type': 6, 'string': (44,)},)},
557  {'name': 'solidus',
558  'lower': 'solidus',
559  'index': 41,
560  'line': 118,
561  'is_bkru': False,
562  'is_bkrr': False,
563  'has_bkrr': False,
564  'opcodes': ({'type': 6, 'string': (47,)},)},
565  {'name': 'colon',
566  'lower': 'colon',
567  'index': 42,
568  'line': 119,
569  'is_bkru': False,
570  'is_bkrr': False,
571  'has_bkrr': False,
572  'opcodes': ({'type': 6, 'string': (58,)},)},
573  {'name': 'semicolon',
574  'lower': 'semicolon',
575  'index': 43,
576  'line': 120,
577  'is_bkru': False,
578  'is_bkrr': False,
579  'has_bkrr': False,
580  'opcodes': ({'type': 6, 'string': (59,)},)},
581  {'name': 'equal-sign',
582  'lower': 'equal-sign',
583  'index': 44,
584  'line': 121,
585  'is_bkru': False,
586  'is_bkrr': False,
587  'has_bkrr': False,
588  'opcodes': ({'type': 6, 'string': (61,)},)},
589  {'name': 'blank',
590  'lower': 'blank',
591  'index': 45,
592  'line': 122,
593  'is_bkru': False,
594  'is_bkrr': False,
595  'has_bkrr': False,
596  'opcodes': ({'type': 6, 'string': (98,)},)},
597  {'name': 'tab',
598  'lower': 'tab',
599  'index': 46,
600  'line': 123,
601  'is_bkru': False,
602  'is_bkrr': False,
603  'has_bkrr': False,
604  'opcodes': ({'type': 6, 'string': (116,)},)},
605  {'name': 'line-feed',
606  'lower': 'line-feed',
607  'index': 47,
608  'line': 124,
609  'is_bkru': False,
610  'is_bkrr': False,
611  'has_bkrr': False,
612  'opcodes': ({'type': 6, 'string': (110,)},)},
613  {'name': 'carriage-return',
614  'lower': 'carriage-return',
615  'index': 48,
616  'line': 125,
617  'is_bkru': False,
618  'is_bkrr': False,
619  'has_bkrr': False,
620  'opcodes': ({'type': 6, 'string': (114,)},)},
621  {'name': 'blank-line',
622  'lower': 'blank-line',
623  'index': 49,
624  'line': 126,
625  'is_bkru': False,
626  'is_bkrr': False,
627  'has_bkrr': False,
628  'opcodes': ({'type': 1, 'children': (1, 2)},
629  {'type': 4, 'index': 50},
630  {'type': 4, 'index': 51})},
631  {'name': 'good-blank-line',
632  'lower': 'good-blank-line',
633  'index': 50,
634  'line': 127,
635  'is_bkru': False,
636  'is_bkrr': False,
637  'has_bkrr': False,
638  'opcodes': ({'type': 2, 'children': (1, 2, 4)},
639  {'type': 4, 'index': 56},
640  {'type': 3, 'min': 0, 'max': 1},
641  {'type': 4, 'index': 55},
642  {'type': 4, 'index': 52})},
643  {'name': 'bad-blank-line',
644  'lower': 'bad-blank-line',
645  'index': 51,
646  'line': 128,
647  'is_bkru': False,
648  'is_bkrr': False,
649  'has_bkrr': False,
650  'opcodes': ({'type': 2, 'children': (1, 4, 5, 8, 10)},
651  {'type': 1, 'children': (2, 3)},
652  {'type': 6, 'string': (32,)},
653  {'type': 6, 'string': (9,)},
654  {'type': 4, 'index': 56},
655  {'type': 1, 'children': (6, 7)},
656  {'type': 5, 'min': 33, 'max': 58},
657  {'type': 5, 'min': 60, 'max': 126},
658  {'type': 3, 'min': 0, 'max': 9223372036854775807},
659  {'type': 4, 'index': 60},
660  {'type': 4, 'index': 52})},
661  {'name': 'line-end',
662  'lower': 'line-end',
663  'index': 52,
664  'line': 129,
665  'is_bkru': False,
666  'is_bkrr': False,
667  'has_bkrr': False,
668  'opcodes': ({'type': 1, 'children': (1, 2, 3, 4)},
669  {'type': 6, 'string': (13, 10)},
670  {'type': 6, 'string': (10,)},
671  {'type': 6, 'string': (13,)},
672  {'type': 18})},
673  {'name': 'digit-line-end',
674  'lower': 'digit-line-end',
675  'index': 53,
676  'line': 130,
677  'is_bkru': False,
678  'is_bkrr': False,
679  'has_bkrr': False,
680  'opcodes': ({'type': 1, 'children': (1, 2, 3, 4)},
681  {'type': 6, 'string': (13, 10)},
682  {'type': 6, 'string': (10,)},
683  {'type': 6, 'string': (13,)},
684  {'type': 18})},
685  {'name': 'line-continue',
686  'lower': 'line-continue',
687  'index': 54,
688  'line': 131,
689  'is_bkru': False,
690  'is_bkrr': False,
691  'has_bkrr': False,
692  'opcodes': ({'type': 2, 'children': (1, 2, 4, 5)},
693  {'type': 6, 'string': (47,)},
694  {'type': 3, 'min': 0, 'max': 9223372036854775807},
695  {'type': 4, 'index': 60},
696  {'type': 4, 'index': 52},
697  {'type': 3, 'min': 0, 'max': 9223372036854775807},
698  {'type': 1, 'children': (7, 8)},
699  {'type': 6, 'string': (32,)},
700  {'type': 6, 'string': (9,)})},
701  {'name': 'comment',
702  'lower': 'comment',
703  'index': 55,
704  'line': 132,
705  'is_bkru': False,
706  'is_bkrr': False,
707  'has_bkrr': False,
708  'opcodes': ({'type': 2, 'children': (1, 4)},
709  {'type': 1, 'children': (2, 3)},
710  {'type': 6, 'string': (35,)},
711  {'type': 6, 'string': (59,)},
712  {'type': 3, 'min': 0, 'max': 9223372036854775807},
713  {'type': 4, 'index': 60})},
714  {'name': 'owsp',
715  'lower': 'owsp',
716  'index': 56,
717  'line': 133,
718  'is_bkru': False,
719  'is_bkrr': False,
720  'has_bkrr': False,
721  'opcodes': ({'type': 3, 'min': 0, 'max': 9223372036854775807},
722  {'type': 1, 'children': (2, 3, 4)},
723  {'type': 6, 'string': (32,)},
724  {'type': 6, 'string': (9,)},
725  {'type': 4, 'index': 54})},
726  {'name': 'wsp',
727  'lower': 'wsp',
728  'index': 57,
729  'line': 134,
730  'is_bkru': False,
731  'is_bkrr': False,
732  'has_bkrr': False,
733  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
734  {'type': 1, 'children': (2, 3, 4)},
735  {'type': 6, 'string': (32,)},
736  {'type': 6, 'string': (9,)},
737  {'type': 4, 'index': 54})},
738  {'name': 'alpha',
739  'lower': 'alpha',
740  'index': 58,
741  'line': 135,
742  'is_bkru': False,
743  'is_bkrr': False,
744  'has_bkrr': False,
745  'opcodes': ({'type': 1, 'children': (1, 2)},
746  {'type': 5, 'min': 65, 'max': 90},
747  {'type': 5, 'min': 97, 'max': 122})},
748  {'name': 'digit',
749  'lower': 'digit',
750  'index': 59,
751  'line': 136,
752  'is_bkru': False,
753  'is_bkrr': False,
754  'has_bkrr': False,
755  'opcodes': ({'type': 5, 'min': 48, 'max': 57},)},
756  {'name': 'any',
757  'lower': 'any',
758  'index': 60,
759  'line': 137,
760  'is_bkru': False,
761  'is_bkrr': False,
762  'has_bkrr': False,
763  'opcodes': ({'type': 1, 'children': (1, 2)},
764  {'type': 5, 'min': 32, 'max': 126},
765  {'type': 6, 'string': (9,)})})
766 
767 # UDTS
768 udts = ({'name': 'u_unicode8',
769  'lower': 'u_unicode8',
770  'index': 0,
771  'is_bkru': False,
772  'is_bkrr': False,
773  'empty': False},
774  {'name': 'u_unicode4',
775  'lower': 'u_unicode4',
776  'index': 1,
777  'is_bkru': False,
778  'is_bkrr': False,
779  'empty': False},
780  {'name': 'u_hexadecimal',
781  'lower': 'u_hexadecimal',
782  'index': 2,
783  'is_bkru': False,
784  'is_bkrr': False,
785  'empty': False},
786  {'name': 'u_escaped-error',
787  'lower': 'u_escaped-error',
788  'index': 3,
789  'is_bkru': False,
790  'is_bkrr': False,
791  'empty': False})
792 
793 has_bkru = False
794 has_bkrr = False
795 
796 
797 def to_string():
798  '''Displays the original SABNF syntax.'''
799  sabnf = ""
800  sabnf += ";\n"
801  sabnf += "; Ref: https://en.wikipedia.org/wiki/INI_file\n"
802  sabnf += "; This SABNF grammar encompasses most of the stable and varying feature of the WikiPedia\n"
803  sabnf += "; artcle. The only significant ommission is that subsections are not supported.\n"
804  sabnf += ";\n"
805  sabnf += "; comments begin with the semicolon(;) or hash(#) and continue to the end of the line\n"
806  sabnf += "; comments may appear on valid section and value lines as well as blank lines\n"
807  sabnf += "; line ends may be CRLF, LF or CR\n"
808  sabnf += "; lines may be continued by ending them with a backslash and the following line begins with space or tab\n"
809  sabnf += "; e.g.\n"
810  sabnf += "; key = value , value, \\\n"
811  sabnf += "; value\n"
812  sabnf += ";\n"
813  sabnf += "; section and key names are case sensitive\n"
814  sabnf += "; section and key names are liberally defined as one or more characters from the set:\n"
815  sabnf += "; a-z\n"
816  sabnf += "; A-Z\n"
817  sabnf += "; 0-9\n"
818  sabnf += "; !$%&()*+-.<>?@^_`{|}~\n"
819  sabnf += "; (basically, alphabet, numeric, underscore, hyphen or any character not used as a special or reserved character)\n"
820  sabnf += ";\n"
821  sabnf += "; keys may have multiple values\n"
822  sabnf += "; - multiple values may be given as a comma or space delimited list on a single line\n"
823  sabnf += "; - values are \"disjoint\" - values listed for multiple occurrances of a key are concatenated\n"
824  sabnf += "; - values may be numbers, booleans, or strings\n"
825  sabnf += "; - strings may be single-quoted, double-quoted strings or unquoted\n"
826  sabnf += ";\n"
827  sabnf += "; keys appearing before the first section are allowed and termed the \"global\" section.\n"
828  sabnf += ";\n"
829  sabnf += "; section names are optional - the file may consist of only a \"global\" section\n"
830  sabnf += ";\n"
831  sabnf += "; sections are \"disjoint\",\n"
832  sabnf += "; - that is the keys in multiple occurrences of a section name are\n"
833  sabnf += "; joined together as if they appeared contiguously in a single section\n"
834  sabnf += ";\n"
835  sabnf += "; sections end at the beginning of a new section or the end of file\n"
836  sabnf += ";\n"
837  sabnf += "; The grammar is designed to accept any string of ASCII characters without failure.\n"
838  sabnf += "; The \"error productions\", bad-section-line, bad-value-line, bad-blank-line are meant to accept all lines\n"
839  sabnf += "; that are not otherwise correct blank, section or value lines. This allows the\n"
840  sabnf += "; parser to report the input errors in an application-dependent manner.\n"
841  sabnf += ";\n"
842  sabnf += "ini-file = *(blank-line / value-line) *section\n"
843  sabnf += "section = section-line *(blank-line / value-line)\n"
844  sabnf += "section-line = good-section-line / bad-section-line\n"
845  sabnf += "good-section-line = %d91 owsp section-name owsp %d93 owsp [comment] line-end\n"
846  sabnf += "bad-section-line = %d91 *any line-end;\n"
847  sabnf += "value-line = good-value / bad-value-line\n"
848  sabnf += "good-value = key-name [key-delim [value-array]] owsp [comment] line-end\n"
849  sabnf += "key-delim = (owsp (%d61 / %d58) owsp) / wsp ; = or : or white space\n"
850  sabnf += "bad-value-line = (%d33-90 / %d92-126) *(line-continue / any) line-end\n"
851  sabnf += "value-array = value *(value-delim value)\n"
852  sabnf += "value-delim = (owsp %d44 owsp) / wsp\n"
853  sabnf += "section-name = name\n"
854  sabnf += "key-name = name\n"
855  sabnf += "name = 1*(%d97-122 \n"
856  sabnf += " / %d65-90 \n"
857  sabnf += " / %d48-57 \n"
858  sabnf += " / %d33 \n"
859  sabnf += " / %d36-38\n"
860  sabnf += " / %d40-43\n"
861  sabnf += " / %d45-46\n"
862  sabnf += " / %d60 \n"
863  sabnf += " / %d62-64 \n"
864  sabnf += " / %d94-95\n"
865  sabnf += " / %d123-126)\n"
866  sabnf += "value = number / boolean / d-quoted-string / s-quoted-string / string\n"
867  sabnf += "boolean = null / true / false\n"
868  sabnf += "true = \"true\" / \"yes\" / \"on\"\n"
869  sabnf += "false = \"false\" / \"no\" / \"off\"\n"
870  sabnf += "null = \"null\" / \"void\" / \"none\"\n"
871  sabnf += "number = (int / float) &(%d44 / wsp / digit-line-end)\n"
872  sabnf += " ; digit-line-end is a line that does not increment the line counter\n"
873  sabnf += " ; numbers must be followed by a delimiter or line end\n"
874  sabnf += "int = [%d43 / %d45] 1*digit &(%d44 / wsp / digit-line-end)\n"
875  sabnf += "float = [sign] decimal [exponent]\n"
876  sabnf += "sign = \"+\" / \"-\"\n"
877  sabnf += "decimal = integer [dot [fraction]]\n"
878  sabnf += " / dot fraction\n"
879  sabnf += "integer = 1*%d48-57\n"
880  sabnf += "dot = \".\"\n"
881  sabnf += "fraction = 1*%d48-57\n"
882  sabnf += "exponent = \"e\" [esign] exp\n"
883  sabnf += "esign = \"+\" / \"-\"\n"
884  sabnf += "exp = 1*%d48-57 \n"
885  sabnf += "string = 1*(%d33 / %d36-38 / %d40-43 / %d45-46 / %d48-57 / %d60 / %d62-91 / %d93-126 / escaped)\n"
886  sabnf += " ; characters not allowed: space \" # ' , / : ; = \\\n"
887  sabnf += "d-quoted-string = %d34 d-quoted-value %d34\n"
888  sabnf += "d-quoted-value = 1*(%d32-33 / %d35-91 / %d93-126 / escaped)\n"
889  sabnf += "s-quoted-string = %d39 s-quoted-value %d39\n"
890  sabnf += "s-quoted-value = 1*(%d32-38 / %d40-91 / %d93-126 / escaped)\n"
891  sabnf += "escaped = reverse-solidus (reverse-solidus\n"
892  sabnf += " / solidus\n"
893  sabnf += " / double-quote\n"
894  sabnf += " / hash\n"
895  sabnf += " / single-quote\n"
896  sabnf += " / comma\n"
897  sabnf += " / colon\n"
898  sabnf += " / semicolon\n"
899  sabnf += " / equal-sign\n"
900  sabnf += " / blank\n"
901  sabnf += " / tab\n"
902  sabnf += " / line-feed\n"
903  sabnf += " / carriage-return\n"
904  sabnf += " / u_unicode8\n"
905  sabnf += " / u_unicode4\n"
906  sabnf += " / u_hexadecimal\n"
907  sabnf += " / u_escaped-error)\n"
908  sabnf += "; u_hexadecimal - UDT \"xhh\", exactly 2 hex digits [0-9a-fA-F] \n"
909  sabnf += "; u_unicode4 - UDT \"uhhhh\", exactly 4 hex digits and semantic checking for valid Unicode characters\n"
910  sabnf += "; surrogates, xd800 - xdfff, not allowed\n"
911  sabnf += "; u_unicode8 - UDT \"Uhhhhhhhh\", exactly 8 hex digits and semantic checking for valid Unicode characters\n"
912  sabnf += "; surrogates, xd800 - xdfff, and > x10ffff not allowed\n"
913  sabnf += "reverse-solidus = %x5c\n"
914  sabnf += "double-quote = %x22\n"
915  sabnf += "hash = %x23\n"
916  sabnf += "single-quote = %x27\n"
917  sabnf += "comma = %x2c\n"
918  sabnf += "solidus = %x2f\n"
919  sabnf += "colon = %x3a\n"
920  sabnf += "semicolon = %x3b\n"
921  sabnf += "equal-sign = %x3d\n"
922  sabnf += "blank = %s\"b\" ; %x20\n"
923  sabnf += "tab = %s\"t\" ; %x09\n"
924  sabnf += "line-feed = %s\"n\" ; %x0a\n"
925  sabnf += "carriage-return = %s\"r\" ; %x0d\n"
926  sabnf += "blank-line = good-blank-line / bad-blank-line\n"
927  sabnf += "good-blank-line = owsp [comment] line-end\n"
928  sabnf += "bad-blank-line = (%d32 / %d9) owsp (%d33-58 / %d60-126) *any line-end\n"
929  sabnf += "line-end = %d13.10 / %d10 / %d13 / %$\n"
930  sabnf += "digit-line-end = %d13.10 / %d10 / %d13 / %$\n"
931  sabnf += "line-continue = %d47 *any line-end *(%d32 / %d9)\n"
932  sabnf += "comment = (%d35 / %d59) *any\n"
933  sabnf += "owsp = *(%d32 / %d9 / line-continue)\n"
934  sabnf += "wsp = 1*(%d32 / %d9 / line-continue)\n"
935  sabnf += "alpha = %d65-90 / %d97-122\n"
936  sabnf += "digit = %d48-57\n"
937  sabnf += "any = %d32-126 / %d9\n"
938  return sabnf
939 
def to_string()
Displays the original SABNF syntax.
Definition: grammar.py:797
Python APG, Version 1.0, is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.