Version 1.0
Copyright © 2022 Lowell D. Thomas
Python APG
 … an ABNF Parser Generator
Variables
examples.basics.trace Namespace Reference

Variables

string title
 
string float
 
string bad_float
 
 api = Api()
 
 grammar = api.generate(float)
 
 parser = Parser(grammar)
 
 trace = Trace(parser, mode='dc')
 
string input_string = '-123,456789E-10'
 
 result = parser.parse(utils.string_to_tuple(input_string))
 
 end
 

Variable Documentation

◆ api

examples.basics.trace.api = Api()

Definition at line 60 of file trace.py.

◆ bad_float

string examples.basics.trace.bad_float
Initial value:
1 = '''float = sign decimal exponent
2 sign = ["+" / "-"]
3 decimal = integer [dot fraction]
4  / dot fraction
5 integer = 1*%d48-57
6 dot = ","
7 fraction = *%d48-57
8 exponent = ["e" esign exp]
9 esign = ["+" / "-"]
10 exp = 1*%d48-57
11 '''

Definition at line 47 of file trace.py.

◆ end

examples.basics.trace.end

Definition at line 73 of file trace.py.

◆ float

string examples.basics.trace.float
Initial value:
1 = '''float = sign decimal exponent
2 sign = ["+" / "-"]
3 decimal = integer [dot fraction]
4  / dot fraction
5 integer = 1*%d48-57
6 dot = "."
7 fraction = *%d48-57
8 exponent = ["e" esign exp]
9 esign = ["+" / "-"]
10 exp = 1*%d48-57
11 '''

Definition at line 36 of file trace.py.

◆ grammar

examples.basics.trace.grammar = api.generate(float)

Definition at line 61 of file trace.py.

◆ input_string

string examples.basics.trace.input_string = '-123,456789E-10'

Definition at line 70 of file trace.py.

◆ parser

examples.basics.trace.parser = Parser(grammar)

Definition at line 67 of file trace.py.

◆ result

examples.basics.trace.result = parser.parse(utils.string_to_tuple(input_string))

Definition at line 71 of file trace.py.

◆ title

string examples.basics.trace.title
Initial value:
1 = '''Demonstrate the display a trace of the parser's path
2 through the parse tree.
3 Tracing my generate a lot of output. It may be advantagous to
4 pipe stdout to an alternate location for more casual perusal.
5 For example, if using linux:
6 python3 examples/trace.py | less
7 '''

Definition at line 25 of file trace.py.

◆ trace

examples.basics.trace.trace = Trace(parser, mode='dc')

Definition at line 69 of file trace.py.

Python APG, Version 1.0, is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.