Version 1.0
Copyright © 2022 Lowell D. Thomas
Python APG
… an
A
BNF
P
arser
G
enerator
Main Page
Related Pages
Packages
Packages
Package Functions
All
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
x
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
x
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
Classes
Class List
Class Index
Class Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Functions
_
a
c
d
e
f
g
h
i
o
p
r
s
t
u
w
Variables
a
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
Files
File List
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
apg_py
api
sabnf_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 = 83
7
# udts = 0
8
# opcodes = 314
9
# --- ABNF original opcodes
10
# ALT = 32
11
# CAT = 43
12
# REP = 27
13
# RNM = 135
14
# TLS = 0
15
# TBS = 59
16
# TRG = 18
17
# --- SABNF super set opcodes
18
# UDT = 0
19
# AND = 0
20
# NOT = 0
21
# BKA = 0
22
# BKN = 0
23
# BKR = 0
24
# ABG = 0
25
# AEN = 0
26
# characters = [9 - 126]
27
#
28
29
# RULES
30
rules = ({
'name'
:
'file'
,
31
'lower'
:
'file'
,
32
'index'
: 0,
33
'line'
: 56,
34
'is_bkru'
:
False
,
35
'is_bkrr'
:
False
,
36
'has_bkrr'
:
False
,
37
'opcodes'
: ({
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
38
{
'type'
: 1,
'children'
: (2, 3)},
39
{
'type'
: 4,
'index'
: 1},
40
{
'type'
: 4,
'index'
: 2})},
41
{
'name'
:
'blank-line'
,
42
'lower'
:
'blank-line'
,
43
'index'
: 1,
44
'line'
: 57,
45
'is_bkru'
:
False
,
46
'is_bkrr'
:
False
,
47
'has_bkrr'
:
False
,
48
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 5, 7)},
49
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
50
{
'type'
: 1,
'children'
: (3, 4)},
51
{
'type'
: 6,
'string'
: (32,)},
52
{
'type'
: 6,
'string'
: (9,)},
53
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
54
{
'type'
: 4,
'index'
: 80},
55
{
'type'
: 4,
'index'
: 81})},
56
{
'name'
:
'rule'
,
57
'lower'
:
'rule'
,
58
'index'
: 2,
59
'line'
: 58,
60
'is_bkru'
:
False
,
61
'is_bkrr'
:
False
,
62
'has_bkrr'
:
False
,
63
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 3, 4, 5)},
64
{
'type'
: 4,
'index'
: 3},
65
{
'type'
: 4,
'index'
: 77},
66
{
'type'
: 4,
'index'
: 8},
67
{
'type'
: 4,
'index'
: 77},
68
{
'type'
: 4,
'index'
: 81})},
69
{
'name'
:
'rule-lookup'
,
70
'lower'
:
'rule-lookup'
,
71
'index'
: 3,
72
'line'
: 59,
73
'is_bkru'
:
False
,
74
'is_bkrr'
:
False
,
75
'has_bkrr'
:
False
,
76
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 3)},
77
{
'type'
: 4,
'index'
: 5},
78
{
'type'
: 4,
'index'
: 77},
79
{
'type'
: 4,
'index'
: 4})},
80
{
'name'
:
'equals'
,
81
'lower'
:
'equals'
,
82
'index'
: 4,
83
'line'
: 60,
84
'is_bkru'
:
False
,
85
'is_bkrr'
:
False
,
86
'has_bkrr'
:
False
,
87
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2)},
88
{
'type'
: 4,
'index'
: 7},
89
{
'type'
: 4,
'index'
: 6})},
90
{
'name'
:
'rule-name'
,
91
'lower'
:
'rule-name'
,
92
'index'
: 5,
93
'line'
: 61,
94
'is_bkru'
:
False
,
95
'is_bkrr'
:
False
,
96
'has_bkrr'
:
False
,
97
'opcodes'
: ({
'type'
: 4,
'index'
: 76},)},
98
{
'name'
:
'defined'
,
99
'lower'
:
'defined'
,
100
'index'
: 6,
101
'line'
: 62,
102
'is_bkru'
:
False
,
103
'is_bkrr'
:
False
,
104
'has_bkrr'
:
False
,
105
'opcodes'
: ({
'type'
: 6,
'string'
: (61,)},)},
106
{
'name'
:
'inc-alt'
,
107
'lower'
:
'inc-alt'
,
108
'index'
: 7,
109
'line'
: 63,
110
'is_bkru'
:
False
,
111
'is_bkrr'
:
False
,
112
'has_bkrr'
:
False
,
113
'opcodes'
: ({
'type'
: 6,
'string'
: (61, 47)},)},
114
{
'name'
:
'alternation'
,
115
'lower'
:
'alternation'
,
116
'index'
: 8,
117
'line'
: 64,
118
'is_bkru'
:
False
,
119
'is_bkrr'
:
False
,
120
'has_bkrr'
:
False
,
121
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
122
{
'type'
: 4,
'index'
: 9},
123
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
124
{
'type'
: 2,
'children'
: (4, 5, 6)},
125
{
'type'
: 4,
'index'
: 77},
126
{
'type'
: 4,
'index'
: 34},
127
{
'type'
: 4,
'index'
: 9})},
128
{
'name'
:
'concatenation'
,
129
'lower'
:
'concatenation'
,
130
'index'
: 9,
131
'line'
: 65,
132
'is_bkru'
:
False
,
133
'is_bkrr'
:
False
,
134
'has_bkrr'
:
False
,
135
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
136
{
'type'
: 4,
'index'
: 10},
137
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
138
{
'type'
: 2,
'children'
: (4, 5)},
139
{
'type'
: 4,
'index'
: 35},
140
{
'type'
: 4,
'index'
: 10})},
141
{
'name'
:
'repetition'
,
142
'lower'
:
'repetition'
,
143
'index'
: 10,
144
'line'
: 66,
145
'is_bkru'
:
False
,
146
'is_bkrr'
:
False
,
147
'has_bkrr'
:
False
,
148
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 3)},
149
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
150
{
'type'
: 4,
'index'
: 11},
151
{
'type'
: 1,
'children'
: (4, 5, 6)},
152
{
'type'
: 4,
'index'
: 14},
153
{
'type'
: 4,
'index'
: 16},
154
{
'type'
: 4,
'index'
: 13})},
155
{
'name'
:
'modifier'
,
156
'lower'
:
'modifier'
,
157
'index'
: 11,
158
'line'
: 67,
159
'is_bkru'
:
False
,
160
'is_bkrr'
:
False
,
161
'has_bkrr'
:
False
,
162
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 5)},
163
{
'type'
: 2,
'children'
: (2, 3)},
164
{
'type'
: 4,
'index'
: 12},
165
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
166
{
'type'
: 4,
'index'
: 33},
167
{
'type'
: 4,
'index'
: 33})},
168
{
'name'
:
'predicate'
,
169
'lower'
:
'predicate'
,
170
'index'
: 12,
171
'line'
: 69,
172
'is_bkru'
:
False
,
173
'is_bkrr'
:
False
,
174
'has_bkrr'
:
False
,
175
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2, 3, 4)},
176
{
'type'
: 4,
'index'
: 39},
177
{
'type'
: 4,
'index'
: 40},
178
{
'type'
: 4,
'index'
: 37},
179
{
'type'
: 4,
'index'
: 38})},
180
{
'name'
:
'element'
,
181
'lower'
:
'element'
,
182
'index'
: 13,
183
'line'
: 73,
184
'is_bkru'
:
False
,
185
'is_bkrr'
:
False
,
186
'has_bkrr'
:
False
,
187
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)},
188
{
'type'
: 4,
'index'
: 30},
189
{
'type'
: 4,
'index'
: 19},
190
{
'type'
: 4,
'index'
: 43},
191
{
'type'
: 4,
'index'
: 44},
192
{
'type'
: 4,
'index'
: 45},
193
{
'type'
: 4,
'index'
: 50},
194
{
'type'
: 4,
'index'
: 20},
195
{
'type'
: 4,
'index'
: 41},
196
{
'type'
: 4,
'index'
: 42},
197
{
'type'
: 4,
'index'
: 53})},
198
{
'name'
:
'group'
,
199
'lower'
:
'group'
,
200
'index'
: 14,
201
'line'
: 83,
202
'is_bkru'
:
False
,
203
'is_bkrr'
:
False
,
204
'has_bkrr'
:
False
,
205
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 3, 4)},
206
{
'type'
: 6,
'string'
: (40,)},
207
{
'type'
: 4,
'index'
: 77},
208
{
'type'
: 4,
'index'
: 8},
209
{
'type'
: 4,
'index'
: 15})},
210
{
'name'
:
'group-close'
,
211
'lower'
:
'group-close'
,
212
'index'
: 15,
213
'line'
: 84,
214
'is_bkru'
:
False
,
215
'is_bkrr'
:
False
,
216
'has_bkrr'
:
False
,
217
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
218
{
'type'
: 4,
'index'
: 77},
219
{
'type'
: 6,
'string'
: (41,)})},
220
{
'name'
:
'option'
,
221
'lower'
:
'option'
,
222
'index'
: 16,
223
'line'
: 85,
224
'is_bkru'
:
False
,
225
'is_bkrr'
:
False
,
226
'has_bkrr'
:
False
,
227
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 3, 4)},
228
{
'type'
: 4,
'index'
: 17},
229
{
'type'
: 4,
'index'
: 77},
230
{
'type'
: 4,
'index'
: 8},
231
{
'type'
: 4,
'index'
: 18})},
232
{
'name'
:
'option-open'
,
233
'lower'
:
'option-open'
,
234
'index'
: 17,
235
'line'
: 86,
236
'is_bkru'
:
False
,
237
'is_bkrr'
:
False
,
238
'has_bkrr'
:
False
,
239
'opcodes'
: ({
'type'
: 6,
'string'
: (91,)},)},
240
{
'name'
:
'option-close'
,
241
'lower'
:
'option-close'
,
242
'index'
: 18,
243
'line'
: 87,
244
'is_bkru'
:
False
,
245
'is_bkrr'
:
False
,
246
'has_bkrr'
:
False
,
247
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
248
{
'type'
: 4,
'index'
: 77},
249
{
'type'
: 6,
'string'
: (93,)})},
250
{
'name'
:
'rnm-op'
,
251
'lower'
:
'rnm-op'
,
252
'index'
: 19,
253
'line'
: 88,
254
'is_bkru'
:
False
,
255
'is_bkrr'
:
False
,
256
'has_bkrr'
:
False
,
257
'opcodes'
: ({
'type'
: 4,
'index'
: 76},)},
258
{
'name'
:
'bkr-op'
,
259
'lower'
:
'bkr-op'
,
260
'index'
: 20,
261
'line'
: 89,
262
'is_bkru'
:
False
,
263
'is_bkrr'
:
False
,
264
'has_bkrr'
:
False
,
265
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 4)},
266
{
'type'
: 6,
'string'
: (92,)},
267
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
268
{
'type'
: 4,
'index'
: 21},
269
{
'type'
: 4,
'index'
: 26})},
270
{
'name'
:
'bkrModifier'
,
271
'lower'
:
'bkrmodifier'
,
272
'index'
: 21,
273
'line'
: 90,
274
'is_bkru'
:
False
,
275
'is_bkrr'
:
False
,
276
'has_bkrr'
:
False
,
277
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 7, 13, 19)},
278
{
'type'
: 2,
'children'
: (2, 3)},
279
{
'type'
: 4,
'index'
: 22},
280
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
281
{
'type'
: 1,
'children'
: (5, 6)},
282
{
'type'
: 4,
'index'
: 24},
283
{
'type'
: 4,
'index'
: 25},
284
{
'type'
: 2,
'children'
: (8, 9)},
285
{
'type'
: 4,
'index'
: 23},
286
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
287
{
'type'
: 1,
'children'
: (11, 12)},
288
{
'type'
: 4,
'index'
: 24},
289
{
'type'
: 4,
'index'
: 25},
290
{
'type'
: 2,
'children'
: (14, 15)},
291
{
'type'
: 4,
'index'
: 24},
292
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
293
{
'type'
: 1,
'children'
: (17, 18)},
294
{
'type'
: 4,
'index'
: 22},
295
{
'type'
: 4,
'index'
: 23},
296
{
'type'
: 2,
'children'
: (20, 21)},
297
{
'type'
: 4,
'index'
: 25},
298
{
'type'
: 3,
'min'
: 0,
'max'
: 1},
299
{
'type'
: 1,
'children'
: (23, 24)},
300
{
'type'
: 4,
'index'
: 22},
301
{
'type'
: 4,
'index'
: 23})},
302
{
'name'
:
'cs'
,
303
'lower'
:
'cs'
,
304
'index'
: 22,
305
'line'
: 91,
306
'is_bkru'
:
False
,
307
'is_bkrr'
:
False
,
308
'has_bkrr'
:
False
,
309
'opcodes'
: ({
'type'
: 6,
'string'
: (37, 115)},)},
310
{
'name'
:
'ci'
,
311
'lower'
:
'ci'
,
312
'index'
: 23,
313
'line'
: 92,
314
'is_bkru'
:
False
,
315
'is_bkrr'
:
False
,
316
'has_bkrr'
:
False
,
317
'opcodes'
: ({
'type'
: 6,
'string'
: (37, 105)},)},
318
{
'name'
:
'um'
,
319
'lower'
:
'um'
,
320
'index'
: 24,
321
'line'
: 93,
322
'is_bkru'
:
False
,
323
'is_bkrr'
:
False
,
324
'has_bkrr'
:
False
,
325
'opcodes'
: ({
'type'
: 6,
'string'
: (37, 117)},)},
326
{
'name'
:
'rm'
,
327
'lower'
:
'rm'
,
328
'index'
: 25,
329
'line'
: 94,
330
'is_bkru'
:
False
,
331
'is_bkrr'
:
False
,
332
'has_bkrr'
:
False
,
333
'opcodes'
: ({
'type'
: 6,
'string'
: (37, 114)},)},
334
{
'name'
:
'bkr-name'
,
335
'lower'
:
'bkr-name'
,
336
'index'
: 26,
337
'line'
: 95,
338
'is_bkru'
:
False
,
339
'is_bkrr'
:
False
,
340
'has_bkrr'
:
False
,
341
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2, 3)},
342
{
'type'
: 4,
'index'
: 28},
343
{
'type'
: 4,
'index'
: 29},
344
{
'type'
: 4,
'index'
: 27})},
345
{
'name'
:
'rname'
,
346
'lower'
:
'rname'
,
347
'index'
: 27,
348
'line'
: 96,
349
'is_bkru'
:
False
,
350
'is_bkrr'
:
False
,
351
'has_bkrr'
:
False
,
352
'opcodes'
: ({
'type'
: 4,
'index'
: 76},)},
353
{
'name'
:
'uname'
,
354
'lower'
:
'uname'
,
355
'index'
: 28,
356
'line'
: 97,
357
'is_bkru'
:
False
,
358
'is_bkrr'
:
False
,
359
'has_bkrr'
:
False
,
360
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
361
{
'type'
: 6,
'string'
: (117, 95)},
362
{
'type'
: 4,
'index'
: 76})},
363
{
'name'
:
'ename'
,
364
'lower'
:
'ename'
,
365
'index'
: 29,
366
'line'
: 98,
367
'is_bkru'
:
False
,
368
'is_bkrr'
:
False
,
369
'has_bkrr'
:
False
,
370
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
371
{
'type'
: 6,
'string'
: (101, 95)},
372
{
'type'
: 4,
'index'
: 76})},
373
{
'name'
:
'udt-op'
,
374
'lower'
:
'udt-op'
,
375
'index'
: 30,
376
'line'
: 99,
377
'is_bkru'
:
False
,
378
'is_bkrr'
:
False
,
379
'has_bkrr'
:
False
,
380
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2)},
381
{
'type'
: 4,
'index'
: 32},
382
{
'type'
: 4,
'index'
: 31})},
383
{
'name'
:
'udt-non-empty'
,
384
'lower'
:
'udt-non-empty'
,
385
'index'
: 31,
386
'line'
: 101,
387
'is_bkru'
:
False
,
388
'is_bkrr'
:
False
,
389
'has_bkrr'
:
False
,
390
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
391
{
'type'
: 6,
'string'
: (117, 95)},
392
{
'type'
: 4,
'index'
: 76})},
393
{
'name'
:
'udt-empty'
,
394
'lower'
:
'udt-empty'
,
395
'index'
: 32,
396
'line'
: 102,
397
'is_bkru'
:
False
,
398
'is_bkrr'
:
False
,
399
'has_bkrr'
:
False
,
400
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
401
{
'type'
: 6,
'string'
: (101, 95)},
402
{
'type'
: 4,
'index'
: 76})},
403
{
'name'
:
'rep-op'
,
404
'lower'
:
'rep-op'
,
405
'index'
: 33,
406
'line'
: 103,
407
'is_bkru'
:
False
,
408
'is_bkrr'
:
False
,
409
'has_bkrr'
:
False
,
410
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 5, 8, 11, 12)},
411
{
'type'
: 2,
'children'
: (2, 3, 4)},
412
{
'type'
: 4,
'index'
: 57},
413
{
'type'
: 4,
'index'
: 36},
414
{
'type'
: 4,
'index'
: 59},
415
{
'type'
: 2,
'children'
: (6, 7)},
416
{
'type'
: 4,
'index'
: 57},
417
{
'type'
: 4,
'index'
: 36},
418
{
'type'
: 2,
'children'
: (9, 10)},
419
{
'type'
: 4,
'index'
: 36},
420
{
'type'
: 4,
'index'
: 59},
421
{
'type'
: 4,
'index'
: 36},
422
{
'type'
: 4,
'index'
: 58})},
423
{
'name'
:
'alt-op'
,
424
'lower'
:
'alt-op'
,
425
'index'
: 34,
426
'line'
: 108,
427
'is_bkru'
:
False
,
428
'is_bkrr'
:
False
,
429
'has_bkrr'
:
False
,
430
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
431
{
'type'
: 6,
'string'
: (47,)},
432
{
'type'
: 4,
'index'
: 77})},
433
{
'name'
:
'cat-op'
,
434
'lower'
:
'cat-op'
,
435
'index'
: 35,
436
'line'
: 109,
437
'is_bkru'
:
False
,
438
'is_bkrr'
:
False
,
439
'has_bkrr'
:
False
,
440
'opcodes'
: ({
'type'
: 4,
'index'
: 78},)},
441
{
'name'
:
'star-op'
,
442
'lower'
:
'star-op'
,
443
'index'
: 36,
444
'line'
: 110,
445
'is_bkru'
:
False
,
446
'is_bkrr'
:
False
,
447
'has_bkrr'
:
False
,
448
'opcodes'
: ({
'type'
: 6,
'string'
: (42,)},)},
449
{
'name'
:
'and-op'
,
450
'lower'
:
'and-op'
,
451
'index'
: 37,
452
'line'
: 111,
453
'is_bkru'
:
False
,
454
'is_bkrr'
:
False
,
455
'has_bkrr'
:
False
,
456
'opcodes'
: ({
'type'
: 6,
'string'
: (38,)},)},
457
{
'name'
:
'not-op'
,
458
'lower'
:
'not-op'
,
459
'index'
: 38,
460
'line'
: 112,
461
'is_bkru'
:
False
,
462
'is_bkrr'
:
False
,
463
'has_bkrr'
:
False
,
464
'opcodes'
: ({
'type'
: 6,
'string'
: (33,)},)},
465
{
'name'
:
'bka-op'
,
466
'lower'
:
'bka-op'
,
467
'index'
: 39,
468
'line'
: 113,
469
'is_bkru'
:
False
,
470
'is_bkrr'
:
False
,
471
'has_bkrr'
:
False
,
472
'opcodes'
: ({
'type'
: 6,
'string'
: (38, 38)},)},
473
{
'name'
:
'bkn-op'
,
474
'lower'
:
'bkn-op'
,
475
'index'
: 40,
476
'line'
: 114,
477
'is_bkru'
:
False
,
478
'is_bkrr'
:
False
,
479
'has_bkrr'
:
False
,
480
'opcodes'
: ({
'type'
: 6,
'string'
: (33, 33)},)},
481
{
'name'
:
'abg-op'
,
482
'lower'
:
'abg-op'
,
483
'index'
: 41,
484
'line'
: 115,
485
'is_bkru'
:
False
,
486
'is_bkrr'
:
False
,
487
'has_bkrr'
:
False
,
488
'opcodes'
: ({
'type'
: 6,
'string'
: (37, 94)},)},
489
{
'name'
:
'aen-op'
,
490
'lower'
:
'aen-op'
,
491
'index'
: 42,
492
'line'
: 116,
493
'is_bkru'
:
False
,
494
'is_bkrr'
:
False
,
495
'has_bkrr'
:
False
,
496
'opcodes'
: ({
'type'
: 6,
'string'
: (37, 36)},)},
497
{
'name'
:
'trg-op'
,
498
'lower'
:
'trg-op'
,
499
'index'
: 43,
500
'line'
: 117,
501
'is_bkru'
:
False
,
502
'is_bkrr'
:
False
,
503
'has_bkrr'
:
False
,
504
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
505
{
'type'
: 6,
'string'
: (37,)},
506
{
'type'
: 1,
'children'
: (3, 8, 13)},
507
{
'type'
: 2,
'children'
: (4, 5, 6, 7)},
508
{
'type'
: 4,
'index'
: 64},
509
{
'type'
: 4,
'index'
: 67},
510
{
'type'
: 6,
'string'
: (45,)},
511
{
'type'
: 4,
'index'
: 68},
512
{
'type'
: 2,
'children'
: (9, 10, 11, 12)},
513
{
'type'
: 4,
'index'
: 65},
514
{
'type'
: 4,
'index'
: 71},
515
{
'type'
: 6,
'string'
: (45,)},
516
{
'type'
: 4,
'index'
: 72},
517
{
'type'
: 2,
'children'
: (14, 15, 16, 17)},
518
{
'type'
: 4,
'index'
: 66},
519
{
'type'
: 4,
'index'
: 69},
520
{
'type'
: 6,
'string'
: (45,)},
521
{
'type'
: 4,
'index'
: 70})},
522
{
'name'
:
'tbs-op'
,
523
'lower'
:
'tbs-op'
,
524
'index'
: 44,
525
'line'
: 120,
526
'is_bkru'
:
False
,
527
'is_bkrr'
:
False
,
528
'has_bkrr'
:
False
,
529
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
530
{
'type'
: 6,
'string'
: (37,)},
531
{
'type'
: 1,
'children'
: (3, 10, 17)},
532
{
'type'
: 2,
'children'
: (4, 5, 6)},
533
{
'type'
: 4,
'index'
: 64},
534
{
'type'
: 4,
'index'
: 61},
535
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
536
{
'type'
: 2,
'children'
: (8, 9)},
537
{
'type'
: 6,
'string'
: (46,)},
538
{
'type'
: 4,
'index'
: 61},
539
{
'type'
: 2,
'children'
: (11, 12, 13)},
540
{
'type'
: 4,
'index'
: 65},
541
{
'type'
: 4,
'index'
: 62},
542
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
543
{
'type'
: 2,
'children'
: (15, 16)},
544
{
'type'
: 6,
'string'
: (46,)},
545
{
'type'
: 4,
'index'
: 62},
546
{
'type'
: 2,
'children'
: (18, 19, 20)},
547
{
'type'
: 4,
'index'
: 66},
548
{
'type'
: 4,
'index'
: 63},
549
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
550
{
'type'
: 2,
'children'
: (22, 23)},
551
{
'type'
: 6,
'string'
: (46,)},
552
{
'type'
: 4,
'index'
: 63})},
553
{
'name'
:
'tls-op'
,
554
'lower'
:
'tls-op'
,
555
'index'
: 45,
556
'line'
: 123,
557
'is_bkru'
:
False
,
558
'is_bkrr'
:
False
,
559
'has_bkrr'
:
False
,
560
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 3, 4)},
561
{
'type'
: 4,
'index'
: 46},
562
{
'type'
: 6,
'string'
: (34,)},
563
{
'type'
: 4,
'index'
: 48},
564
{
'type'
: 4,
'index'
: 47})},
565
{
'name'
:
'tls-case'
,
566
'lower'
:
'tls-case'
,
567
'index'
: 46,
568
'line'
: 124,
569
'is_bkru'
:
False
,
570
'is_bkrr'
:
False
,
571
'has_bkrr'
:
False
,
572
'opcodes'
: ({
'type'
: 3,
'min'
: 0,
'max'
: 1},
573
{
'type'
: 1,
'children'
: (2, 3)},
574
{
'type'
: 4,
'index'
: 23},
575
{
'type'
: 4,
'index'
: 22})},
576
{
'name'
:
'tls-close'
,
577
'lower'
:
'tls-close'
,
578
'index'
: 47,
579
'line'
: 125,
580
'is_bkru'
:
False
,
581
'is_bkrr'
:
False
,
582
'has_bkrr'
:
False
,
583
'opcodes'
: ({
'type'
: 6,
'string'
: (34,)},)},
584
{
'name'
:
'tls-string'
,
585
'lower'
:
'tls-string'
,
586
'index'
: 48,
587
'line'
: 126,
588
'is_bkru'
:
False
,
589
'is_bkrr'
:
False
,
590
'has_bkrr'
:
False
,
591
'opcodes'
: ({
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
592
{
'type'
: 1,
'children'
: (2, 3, 4)},
593
{
'type'
: 5,
'min'
: 32,
'max'
: 33},
594
{
'type'
: 5,
'min'
: 35,
'max'
: 126},
595
{
'type'
: 4,
'index'
: 49})},
596
{
'name'
:
'string-tab'
,
597
'lower'
:
'string-tab'
,
598
'index'
: 49,
599
'line'
: 127,
600
'is_bkru'
:
False
,
601
'is_bkrr'
:
False
,
602
'has_bkrr'
:
False
,
603
'opcodes'
: ({
'type'
: 6,
'string'
: (9,)},)},
604
{
'name'
:
'cls-op'
,
605
'lower'
:
'cls-op'
,
606
'index'
: 50,
607
'line'
: 128,
608
'is_bkru'
:
False
,
609
'is_bkrr'
:
False
,
610
'has_bkrr'
:
False
,
611
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 3)},
612
{
'type'
: 6,
'string'
: (39,)},
613
{
'type'
: 4,
'index'
: 52},
614
{
'type'
: 4,
'index'
: 51})},
615
{
'name'
:
'cls-close'
,
616
'lower'
:
'cls-close'
,
617
'index'
: 51,
618
'line'
: 129,
619
'is_bkru'
:
False
,
620
'is_bkrr'
:
False
,
621
'has_bkrr'
:
False
,
622
'opcodes'
: ({
'type'
: 6,
'string'
: (39,)},)},
623
{
'name'
:
'cls-string'
,
624
'lower'
:
'cls-string'
,
625
'index'
: 52,
626
'line'
: 130,
627
'is_bkru'
:
False
,
628
'is_bkrr'
:
False
,
629
'has_bkrr'
:
False
,
630
'opcodes'
: ({
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
631
{
'type'
: 1,
'children'
: (2, 3, 4)},
632
{
'type'
: 5,
'min'
: 32,
'max'
: 38},
633
{
'type'
: 5,
'min'
: 40,
'max'
: 126},
634
{
'type'
: 4,
'index'
: 49})},
635
{
'name'
:
'pros-val'
,
636
'lower'
:
'pros-val'
,
637
'index'
: 53,
638
'line'
: 131,
639
'is_bkru'
:
False
,
640
'is_bkrr'
:
False
,
641
'has_bkrr'
:
False
,
642
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2, 3)},
643
{
'type'
: 4,
'index'
: 54},
644
{
'type'
: 4,
'index'
: 55},
645
{
'type'
: 4,
'index'
: 56})},
646
{
'name'
:
'pros-val-open'
,
647
'lower'
:
'pros-val-open'
,
648
'index'
: 54,
649
'line'
: 132,
650
'is_bkru'
:
False
,
651
'is_bkrr'
:
False
,
652
'has_bkrr'
:
False
,
653
'opcodes'
: ({
'type'
: 6,
'string'
: (60,)},)},
654
{
'name'
:
'pros-val-string'
,
655
'lower'
:
'pros-val-string'
,
656
'index'
: 55,
657
'line'
: 133,
658
'is_bkru'
:
False
,
659
'is_bkrr'
:
False
,
660
'has_bkrr'
:
False
,
661
'opcodes'
: ({
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
662
{
'type'
: 1,
'children'
: (2, 3, 4)},
663
{
'type'
: 5,
'min'
: 32,
'max'
: 61},
664
{
'type'
: 5,
'min'
: 63,
'max'
: 126},
665
{
'type'
: 4,
'index'
: 49})},
666
{
'name'
:
'pros-val-close'
,
667
'lower'
:
'pros-val-close'
,
668
'index'
: 56,
669
'line'
: 134,
670
'is_bkru'
:
False
,
671
'is_bkrr'
:
False
,
672
'has_bkrr'
:
False
,
673
'opcodes'
: ({
'type'
: 6,
'string'
: (62,)},)},
674
{
'name'
:
'rep-min'
,
675
'lower'
:
'rep-min'
,
676
'index'
: 57,
677
'line'
: 135,
678
'is_bkru'
:
False
,
679
'is_bkrr'
:
False
,
680
'has_bkrr'
:
False
,
681
'opcodes'
: ({
'type'
: 4,
'index'
: 60},)},
682
{
'name'
:
'rep-min-max'
,
683
'lower'
:
'rep-min-max'
,
684
'index'
: 58,
685
'line'
: 136,
686
'is_bkru'
:
False
,
687
'is_bkrr'
:
False
,
688
'has_bkrr'
:
False
,
689
'opcodes'
: ({
'type'
: 4,
'index'
: 60},)},
690
{
'name'
:
'rep-max'
,
691
'lower'
:
'rep-max'
,
692
'index'
: 59,
693
'line'
: 137,
694
'is_bkru'
:
False
,
695
'is_bkrr'
:
False
,
696
'has_bkrr'
:
False
,
697
'opcodes'
: ({
'type'
: 4,
'index'
: 60},)},
698
{
'name'
:
'rep-num'
,
699
'lower'
:
'rep-num'
,
700
'index'
: 60,
701
'line'
: 138,
702
'is_bkru'
:
False
,
703
'is_bkrr'
:
False
,
704
'has_bkrr'
:
False
,
705
'opcodes'
: ({
'type'
: 3,
'min'
: 1,
'max'
: 9223372036854775807},
706
{
'type'
: 5,
'min'
: 48,
'max'
: 57})},
707
{
'name'
:
'd-string'
,
708
'lower'
:
'd-string'
,
709
'index'
: 61,
710
'line'
: 139,
711
'is_bkru'
:
False
,
712
'is_bkrr'
:
False
,
713
'has_bkrr'
:
False
,
714
'opcodes'
: ({
'type'
: 4,
'index'
: 73},)},
715
{
'name'
:
'x-string'
,
716
'lower'
:
'x-string'
,
717
'index'
: 62,
718
'line'
: 140,
719
'is_bkru'
:
False
,
720
'is_bkrr'
:
False
,
721
'has_bkrr'
:
False
,
722
'opcodes'
: ({
'type'
: 4,
'index'
: 75},)},
723
{
'name'
:
'b-string'
,
724
'lower'
:
'b-string'
,
725
'index'
: 63,
726
'line'
: 141,
727
'is_bkru'
:
False
,
728
'is_bkrr'
:
False
,
729
'has_bkrr'
:
False
,
730
'opcodes'
: ({
'type'
: 4,
'index'
: 74},)},
731
{
'name'
:
'dec'
,
732
'lower'
:
'dec'
,
733
'index'
: 64,
734
'line'
: 142,
735
'is_bkru'
:
False
,
736
'is_bkrr'
:
False
,
737
'has_bkrr'
:
False
,
738
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2)},
739
{
'type'
: 6,
'string'
: (68,)},
740
{
'type'
: 6,
'string'
: (100,)})},
741
{
'name'
:
'hex'
,
742
'lower'
:
'hex'
,
743
'index'
: 65,
744
'line'
: 143,
745
'is_bkru'
:
False
,
746
'is_bkrr'
:
False
,
747
'has_bkrr'
:
False
,
748
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2)},
749
{
'type'
: 6,
'string'
: (88,)},
750
{
'type'
: 6,
'string'
: (120,)})},
751
{
'name'
:
'bin'
,
752
'lower'
:
'bin'
,
753
'index'
: 66,
754
'line'
: 144,
755
'is_bkru'
:
False
,
756
'is_bkrr'
:
False
,
757
'has_bkrr'
:
False
,
758
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2)},
759
{
'type'
: 6,
'string'
: (66,)},
760
{
'type'
: 6,
'string'
: (98,)})},
761
{
'name'
:
'dmin'
,
762
'lower'
:
'dmin'
,
763
'index'
: 67,
764
'line'
: 145,
765
'is_bkru'
:
False
,
766
'is_bkrr'
:
False
,
767
'has_bkrr'
:
False
,
768
'opcodes'
: ({
'type'
: 4,
'index'
: 73},)},
769
{
'name'
:
'dmax'
,
770
'lower'
:
'dmax'
,
771
'index'
: 68,
772
'line'
: 146,
773
'is_bkru'
:
False
,
774
'is_bkrr'
:
False
,
775
'has_bkrr'
:
False
,
776
'opcodes'
: ({
'type'
: 4,
'index'
: 73},)},
777
{
'name'
:
'bmin'
,
778
'lower'
:
'bmin'
,
779
'index'
: 69,
780
'line'
: 147,
781
'is_bkru'
:
False
,
782
'is_bkrr'
:
False
,
783
'has_bkrr'
:
False
,
784
'opcodes'
: ({
'type'
: 4,
'index'
: 74},)},
785
{
'name'
:
'bmax'
,
786
'lower'
:
'bmax'
,
787
'index'
: 70,
788
'line'
: 148,
789
'is_bkru'
:
False
,
790
'is_bkrr'
:
False
,
791
'has_bkrr'
:
False
,
792
'opcodes'
: ({
'type'
: 4,
'index'
: 74},)},
793
{
'name'
:
'xmin'
,
794
'lower'
:
'xmin'
,
795
'index'
: 71,
796
'line'
: 149,
797
'is_bkru'
:
False
,
798
'is_bkrr'
:
False
,
799
'has_bkrr'
:
False
,
800
'opcodes'
: ({
'type'
: 4,
'index'
: 75},)},
801
{
'name'
:
'xmax'
,
802
'lower'
:
'xmax'
,
803
'index'
: 72,
804
'line'
: 150,
805
'is_bkru'
:
False
,
806
'is_bkrr'
:
False
,
807
'has_bkrr'
:
False
,
808
'opcodes'
: ({
'type'
: 4,
'index'
: 75},)},
809
{
'name'
:
'dnum'
,
810
'lower'
:
'dnum'
,
811
'index'
: 73,
812
'line'
: 151,
813
'is_bkru'
:
False
,
814
'is_bkrr'
:
False
,
815
'has_bkrr'
:
False
,
816
'opcodes'
: ({
'type'
: 3,
'min'
: 1,
'max'
: 9223372036854775807},
817
{
'type'
: 5,
'min'
: 48,
'max'
: 57})},
818
{
'name'
:
'bnum'
,
819
'lower'
:
'bnum'
,
820
'index'
: 74,
821
'line'
: 152,
822
'is_bkru'
:
False
,
823
'is_bkrr'
:
False
,
824
'has_bkrr'
:
False
,
825
'opcodes'
: ({
'type'
: 3,
'min'
: 1,
'max'
: 9223372036854775807},
826
{
'type'
: 5,
'min'
: 48,
'max'
: 49})},
827
{
'name'
:
'xnum'
,
828
'lower'
:
'xnum'
,
829
'index'
: 75,
830
'line'
: 153,
831
'is_bkru'
:
False
,
832
'is_bkrr'
:
False
,
833
'has_bkrr'
:
False
,
834
'opcodes'
: ({
'type'
: 3,
'min'
: 1,
'max'
: 9223372036854775807},
835
{
'type'
: 1,
'children'
: (2, 3, 4)},
836
{
'type'
: 5,
'min'
: 48,
'max'
: 57},
837
{
'type'
: 5,
'min'
: 65,
'max'
: 70},
838
{
'type'
: 5,
'min'
: 97,
'max'
: 102})},
839
{
'name'
:
'alphanum'
,
840
'lower'
:
'alphanum'
,
841
'index'
: 76,
842
'line'
: 156,
843
'is_bkru'
:
False
,
844
'is_bkrr'
:
False
,
845
'has_bkrr'
:
False
,
846
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 4)},
847
{
'type'
: 1,
'children'
: (2, 3)},
848
{
'type'
: 5,
'min'
: 97,
'max'
: 122},
849
{
'type'
: 5,
'min'
: 65,
'max'
: 90},
850
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
851
{
'type'
: 1,
'children'
: (6, 7, 8, 9)},
852
{
'type'
: 5,
'min'
: 97,
'max'
: 122},
853
{
'type'
: 5,
'min'
: 65,
'max'
: 90},
854
{
'type'
: 5,
'min'
: 48,
'max'
: 57},
855
{
'type'
: 6,
'string'
: (45,)})},
856
{
'name'
:
'owsp'
,
857
'lower'
:
'owsp'
,
858
'index'
: 77,
859
'line'
: 157,
860
'is_bkru'
:
False
,
861
'is_bkrr'
:
False
,
862
'has_bkrr'
:
False
,
863
'opcodes'
: ({
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
864
{
'type'
: 4,
'index'
: 79})},
865
{
'name'
:
'wsp'
,
866
'lower'
:
'wsp'
,
867
'index'
: 78,
868
'line'
: 158,
869
'is_bkru'
:
False
,
870
'is_bkrr'
:
False
,
871
'has_bkrr'
:
False
,
872
'opcodes'
: ({
'type'
: 3,
'min'
: 1,
'max'
: 9223372036854775807},
873
{
'type'
: 4,
'index'
: 79})},
874
{
'name'
:
'space'
,
875
'lower'
:
'space'
,
876
'index'
: 79,
877
'line'
: 159,
878
'is_bkru'
:
False
,
879
'is_bkrr'
:
False
,
880
'has_bkrr'
:
False
,
881
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2, 3, 4)},
882
{
'type'
: 6,
'string'
: (32,)},
883
{
'type'
: 6,
'string'
: (9,)},
884
{
'type'
: 4,
'index'
: 80},
885
{
'type'
: 4,
'index'
: 82})},
886
{
'name'
:
'comment'
,
887
'lower'
:
'comment'
,
888
'index'
: 80,
889
'line'
: 163,
890
'is_bkru'
:
False
,
891
'is_bkrr'
:
False
,
892
'has_bkrr'
:
False
,
893
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 2)},
894
{
'type'
: 6,
'string'
: (59,)},
895
{
'type'
: 3,
'min'
: 0,
'max'
: 9223372036854775807},
896
{
'type'
: 1,
'children'
: (4, 5)},
897
{
'type'
: 5,
'min'
: 32,
'max'
: 126},
898
{
'type'
: 6,
'string'
: (9,)})},
899
{
'name'
:
'line-end'
,
900
'lower'
:
'line-end'
,
901
'index'
: 81,
902
'line'
: 164,
903
'is_bkru'
:
False
,
904
'is_bkrr'
:
False
,
905
'has_bkrr'
:
False
,
906
'opcodes'
: ({
'type'
: 1,
'children'
: (1, 2, 3)},
907
{
'type'
: 6,
'string'
: (13, 10)},
908
{
'type'
: 6,
'string'
: (10,)},
909
{
'type'
: 6,
'string'
: (13,)})},
910
{
'name'
:
'line-continue'
,
911
'lower'
:
'line-continue'
,
912
'index'
: 82,
913
'line'
: 167,
914
'is_bkru'
:
False
,
915
'is_bkrr'
:
False
,
916
'has_bkrr'
:
False
,
917
'opcodes'
: ({
'type'
: 2,
'children'
: (1, 5)},
918
{
'type'
: 1,
'children'
: (2, 3, 4)},
919
{
'type'
: 6,
'string'
: (13, 10)},
920
{
'type'
: 6,
'string'
: (10,)},
921
{
'type'
: 6,
'string'
: (13,)},
922
{
'type'
: 1,
'children'
: (6, 7)},
923
{
'type'
: 6,
'string'
: (32,)},
924
{
'type'
: 6,
'string'
: (9,)})})
925
926
# UDTS
927
udts = ()
928
929
has_bkru =
False
930
has_bkrr =
False
931
932
933
def
to_string
():
934
'''Displays the original SABNF syntax.'''
935
sabnf =
""
936
sabnf +=
";\n"
937
sabnf +=
"; ABNF for Python APG SABNF\n"
938
sabnf +=
"; 08/19/2022\n"
939
sabnf +=
"; RFC 5234 with some restrictions and additions.\n"
940
sabnf +=
"; Compliant with RFC 7405 for case-sensitive literal string notation\n"
941
sabnf +=
"; - accepts %s\"string\" as a case-sensitive string\n"
942
sabnf +=
"; - accepts %i\"string\" as a case-insensitive string\n"
943
sabnf +=
"; - accepts \"string\" as a case-insensitive string\n"
944
sabnf +=
"; - accepts 'string' as a case-sensitive string\n"
945
sabnf +=
";\n"
946
sabnf +=
"; Some restrictions:\n"
947
sabnf +=
"; 1. Rules must begin at first character of each line.\n"
948
sabnf +=
"; Indentations on first rule and rules thereafter are not allowed.\n"
949
sabnf +=
"; 2. Relaxed line endings. CRLF, LF or CR are accepted as valid line ending.\n"
950
sabnf +=
"; 3. Prose values, i.e. <prose value>, are accepted as valid grammar syntax.\n"
951
sabnf +=
"; However, a working parser cannot be generated from them.\n"
952
sabnf +=
";\n"
953
sabnf +=
"; Super set (SABNF) additions:\n"
954
sabnf +=
"; 1. Look-ahead (syntactic predicate) operators are accepted as element prefixes.\n"
955
sabnf +=
"; & is the positive look-ahead operator, succeeds and backtracks if the look-ahead phrase is found\n"
956
sabnf +=
"; ! is the negative look-ahead operator, succeeds and backtracks if the look-ahead phrase is NOT found\n"
957
sabnf +=
"; e.g. &%d13 or &rule or !(A / B)\n"
958
sabnf +=
"; 2. User-defined Terminals (UDT) of the form, u_name and e_name are accepted.\n"
959
sabnf +=
"; They indicate the the user will hand-write the phrase acceptance algorithm.\n"
960
sabnf +=
"; e_name may return an empty phrase.\n"
961
sabnf +=
"; u_name may not return an empty phrase. The parser will inforce this.\n"
962
sabnf +=
"; 'name' is alpha followed by alpha/num/hyphen just like a rule name.\n"
963
sabnf +=
"; u_name/e_name may be used as an element but no rule definition is given.\n"
964
sabnf +=
"; e.g. rule = A / u_myUdt\n"
965
sabnf +=
"; A = \"a\"\n"
966
sabnf +=
"; would be a valid grammar.\n"
967
sabnf +=
"; e_name \n"
968
sabnf +=
"; 3. Case-sensitive, single-quoted strings are accepted.\n"
969
sabnf +=
"; e.g. 'abc' would be equivalent to %d97.98.99\n"
970
sabnf +=
"; (kept for backward compatibility, but superseded by %s\"abc\") \n"
971
sabnf +=
"; 4. Look-behind operators are accepted as element prefixes.\n"
972
sabnf +=
"; && is the positive look-behind operator, succeeds and backtracks if the look-behind phrase is found\n"
973
sabnf +=
"; !! is the negative look-behind operator, succeeds and backtracks if the look-behind phrase is NOT found\n"
974
sabnf +=
"; e.g. &&%d13 or &&rule or !!(A / B)\n"
975
sabnf +=
"; 5. Back referencing operators, i.e. \\rulename or \\e_name or \\u_name, are accepted.\n"
976
sabnf +=
"; A back reference operator acts like a TLS or TBS terminal except that the phrase it attempts\n"
977
sabnf +=
"; to match is a phrase previously matched by the rule or UDT 'rulename', 'e_name' or 'u_name'.\n"
978
sabnf +=
"; There are two modes of previous phrase matching - the recursive mode and the universal mode.\n"
979
sabnf +=
"; In universal mode, \\rulename matches the last match to 'rulename' regardless of where it was found.\n"
980
sabnf +=
"; In recursive mode, \\rulename matches the last match found on the closest recursive parent.\n"
981
sabnf +=
"; It would be used primarily with \"nesting pairs\" type recursive rules.\n"
982
sabnf +=
"; Back reference modifiers can be used to specify case and mode.\n"
983
sabnf +=
"; \\A defaults to case-insensitive and universal mode, e.g. \\A === \\%i%uA\n"
984
sabnf +=
"; Modifiers %i and %s determine case-insensitive and case-sensitive mode, respectively.\n"
985
sabnf +=
"; Modifiers %u and %r determine universal mode and recursive mode, respectively.\n"
986
sabnf +=
"; Case and mode modifiers can appear in any order, e.g. \\%s%rA === \\%r%sA. \n"
987
sabnf +=
"; 7. String begin anchor, ABG(%^) matches the beginning of the input string location.\n"
988
sabnf +=
"; Returns EMPTY or NOMATCH. Never consumes any characters.\n"
989
sabnf +=
"; 8. String end anchor, AEN(%$) matches the end of the input string location.\n"
990
sabnf +=
"; Returns EMPTY or NOMATCH. Never consumes any characters.\n"
991
sabnf +=
";\n"
992
sabnf +=
"file = *(blank-line / rule)\n"
993
sabnf +=
"blank-line = *(%d32/%d9) [comment] line-end\n"
994
sabnf +=
"rule = rule-lookup owsp alternation owsp line-end\n"
995
sabnf +=
"rule-lookup = (rule-name) owsp equals\n"
996
sabnf +=
"equals = inc-alt / defined\n"
997
sabnf +=
"rule-name = alphanum\n"
998
sabnf +=
"defined = %d61\n"
999
sabnf +=
"inc-alt = %d61.47\n"
1000
sabnf +=
"alternation = concatenation *(owsp alt-op concatenation)\n"
1001
sabnf +=
"concatenation = repetition *(cat-op repetition)\n"
1002
sabnf +=
"repetition = [modifier] (group / option / element)\n"
1003
sabnf +=
"modifier = (predicate [rep-op])\n"
1004
sabnf +=
" / rep-op\n"
1005
sabnf +=
"predicate = bka-op\n"
1006
sabnf +=
" / bkn-op\n"
1007
sabnf +=
" / and-op\n"
1008
sabnf +=
" / not-op\n"
1009
sabnf +=
"element = udt-op\n"
1010
sabnf +=
" / rnm-op\n"
1011
sabnf +=
" / trg-op\n"
1012
sabnf +=
" / tbs-op\n"
1013
sabnf +=
" / tls-op\n"
1014
sabnf +=
" / cls-op\n"
1015
sabnf +=
" / bkr-op\n"
1016
sabnf +=
" / abg-op\n"
1017
sabnf +=
" / aen-op\n"
1018
sabnf +=
" / pros-val\n"
1019
sabnf +=
"group = %d40 owsp alternation group-close\n"
1020
sabnf +=
"group-close = owsp %d41\n"
1021
sabnf +=
"option = option-open owsp alternation option-close\n"
1022
sabnf +=
"option-open = %d91\n"
1023
sabnf +=
"option-close = owsp %d93\n"
1024
sabnf +=
"rnm-op = alphanum\n"
1025
sabnf +=
"bkr-op = %d92 [bkrModifier] bkr-name\n"
1026
sabnf +=
"bkrModifier = (cs [um / rm]) / (ci [um / rm]) / (um [cs /ci]) / (rm [cs / ci])\n"
1027
sabnf +=
"cs = '%s'\n"
1028
sabnf +=
"ci = '%i'\n"
1029
sabnf +=
"um = '%u'\n"
1030
sabnf +=
"rm = '%r'\n"
1031
sabnf +=
"bkr-name = uname / ename / rname\n"
1032
sabnf +=
"rname = alphanum\n"
1033
sabnf +=
"uname = %d117.95 alphanum\n"
1034
sabnf +=
"ename = %d101.95 alphanum\n"
1035
sabnf +=
"udt-op = udt-empty\n"
1036
sabnf +=
" / udt-non-empty\n"
1037
sabnf +=
"udt-non-empty = %d117.95 alphanum\n"
1038
sabnf +=
"udt-empty = %d101.95 alphanum\n"
1039
sabnf +=
"rep-op = (rep-min star-op rep-max)\n"
1040
sabnf +=
" / (rep-min star-op)\n"
1041
sabnf +=
" / (star-op rep-max)\n"
1042
sabnf +=
" / star-op\n"
1043
sabnf +=
" / rep-min-max\n"
1044
sabnf +=
"alt-op = %d47 owsp\n"
1045
sabnf +=
"cat-op = wsp\n"
1046
sabnf +=
"star-op = %d42\n"
1047
sabnf +=
"and-op = %d38\n"
1048
sabnf +=
"not-op = %d33\n"
1049
sabnf +=
"bka-op = %d38.38\n"
1050
sabnf +=
"bkn-op = %d33.33\n"
1051
sabnf +=
"abg-op = %d37.94\n"
1052
sabnf +=
"aen-op = %d37.36\n"
1053
sabnf +=
"trg-op = %d37 ((dec dmin %d45 dmax) \n"
1054
sabnf +=
" / (hex xmin %d45 xmax) \n"
1055
sabnf +=
" / (bin bmin %d45 bmax))\n"
1056
sabnf +=
"tbs-op = %d37 ((dec d-string *(%d46 d-string)) \n"
1057
sabnf +=
" / (hex x-string *(%d46 x-string)) \n"
1058
sabnf +=
" / (bin b-string *(%d46 b-string)))\n"
1059
sabnf +=
"tls-op = tls-case %d34 tls-string tls-close\n"
1060
sabnf +=
"tls-case = [ci / cs]\n"
1061
sabnf +=
"tls-close = %d34\n"
1062
sabnf +=
"tls-string = *(%d32-33/%d35-126/string-tab)\n"
1063
sabnf +=
"string-tab = %d9\n"
1064
sabnf +=
"cls-op = %d39 cls-string cls-close\n"
1065
sabnf +=
"cls-close = %d39\n"
1066
sabnf +=
"cls-string = *(%d32-38/%d40-126/string-tab)\n"
1067
sabnf +=
"pros-val = pros-val-open pros-val-string pros-val-close\n"
1068
sabnf +=
"pros-val-open = %d60\n"
1069
sabnf +=
"pros-val-string = *(%d32-61/%d63-126/string-tab)\n"
1070
sabnf +=
"pros-val-close = %d62\n"
1071
sabnf +=
"rep-min = rep-num\n"
1072
sabnf +=
"rep-min-max = rep-num\n"
1073
sabnf +=
"rep-max = rep-num\n"
1074
sabnf +=
"rep-num = 1*(%d48-57)\n"
1075
sabnf +=
"d-string = dnum\n"
1076
sabnf +=
"x-string = xnum\n"
1077
sabnf +=
"b-string = bnum\n"
1078
sabnf +=
"dec = (%d68/%d100)\n"
1079
sabnf +=
"hex = (%d88/%d120)\n"
1080
sabnf +=
"bin = (%d66/%d98)\n"
1081
sabnf +=
"dmin = dnum\n"
1082
sabnf +=
"dmax = dnum\n"
1083
sabnf +=
"bmin = bnum\n"
1084
sabnf +=
"bmax = bnum\n"
1085
sabnf +=
"xmin = xnum\n"
1086
sabnf +=
"xmax = xnum\n"
1087
sabnf +=
"dnum = 1*(%d48-57)\n"
1088
sabnf +=
"bnum = 1*%d48-49\n"
1089
sabnf +=
"xnum = 1*(%d48-57 / %d65-70 / %d97-102)\n"
1090
sabnf +=
";\n"
1091
sabnf +=
"; Basics\n"
1092
sabnf +=
"alphanum = (%d97-122/%d65-90) *(%d97-122/%d65-90/%d48-57/%d45)\n"
1093
sabnf +=
"owsp = *space\n"
1094
sabnf +=
"wsp = 1*space\n"
1095
sabnf +=
"space = %d32\n"
1096
sabnf +=
" / %d9\n"
1097
sabnf +=
" / comment\n"
1098
sabnf +=
" / line-continue\n"
1099
sabnf +=
"comment = %d59 *(%d32-126 / %d9)\n"
1100
sabnf +=
"line-end = %d13.10\n"
1101
sabnf +=
" / %d10\n"
1102
sabnf +=
" / %d13\n"
1103
sabnf +=
"line-continue = (%d13.10 / %d10 / %d13) (%d32 / %d9)\n"
1104
return
sabnf
1105
apg_py.api.sabnf_grammar.to_string
def to_string()
Displays the original SABNF syntax.
Definition:
sabnf_grammar.py:933
Generated by
1.9.1
Python APG, Version 1.0, is licensed under the
2-Clause BSD License
,
an
Open Source Initiative
Approved License.