Version 1.0
Copyright © 2022 Lowell D. Thomas
Python APG
 … an ABNF Parser Generator
abnf.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 = 4
7 # udts = 0
8 # opcodes = 10
9 # --- ABNF original opcodes
10 # ALT = 1
11 # CAT = 1
12 # REP = 1
13 # RNM = 3
14 # TLS = 2
15 # TBS = 1
16 # TRG = 1
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 = [67 - 255]
27 #
28 
29 # RULES
30 rules = ({'name': 'abnf',
31  'lower': 'abnf',
32  'index': 0,
33  'line': 0,
34  'is_bkru': False,
35  'is_bkrr': False,
36  'has_bkrr': False,
37  'opcodes': ({'type': 1, 'children': (1, 2, 3)},
38  {'type': 4, 'index': 1},
39  {'type': 4, 'index': 2},
40  {'type': 4, 'index': 3})},
41  {'name': 'tls',
42  'lower': 'tls',
43  'index': 1,
44  'line': 1,
45  'is_bkru': False,
46  'is_bkrr': False,
47  'has_bkrr': False,
48  'opcodes': ({'type': 2, 'children': (1, 2)},
49  {'type': 7, 'string': (97,)},
50  {'type': 7, 'string': (98,)})},
51  {'name': 'tbs',
52  'lower': 'tbs',
53  'index': 2,
54  'line': 2,
55  'is_bkru': False,
56  'is_bkrr': False,
57  'has_bkrr': False,
58  'opcodes': ({'type': 6, 'string': (67, 68)},)},
59  {'name': 'trg',
60  'lower': 'trg',
61  'index': 3,
62  'line': 3,
63  'is_bkru': False,
64  'is_bkrr': False,
65  'has_bkrr': False,
66  'opcodes': ({'type': 3, 'min': 1, 'max': 9223372036854775807},
67  {'type': 5, 'min': 128, 'max': 255})})
68 
69 # UDTS
70 udts = ()
71 
72 has_bkru = False
73 has_bkrr = False
74 
75 
76 def to_string():
77  '''Displays the original SABNF syntax.'''
78  sabnf = ""
79  sabnf += "abnf = tls / tbs/ trg\n"
80  sabnf += "tls = \"A\" \"B\"\n"
81  sabnf += "tbs = %d67.68\n"
82  sabnf += "trg = 1*%d128-255\n"
83  return sabnf
84 
def to_string()
Displays the original SABNF syntax.
Definition: abnf.py:76
Python APG, Version 1.0, is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.