Demonstrates how to display a trace of the parser's path through the parse tree. More...
Go to the source code of this file.
Namespaces | |
examples.basics.trace | |
Variables | |
string | examples.basics.trace.title |
string | examples.basics.trace.float |
string | examples.basics.trace.bad_float |
examples.basics.trace.api = Api() | |
examples.basics.trace.grammar = api.generate(float) | |
examples.basics.trace.parser = Parser(grammar) | |
examples.basics.trace.trace = Trace(parser, mode='dc') | |
string | examples.basics.trace.input_string = '-123,456789E-10' |
examples.basics.trace.result = parser.parse(utils.string_to_tuple(input_string)) | |
examples.basics.trace.end | |
Demonstrates how to display a trace of the parser's path through the parse tree.
Tracing my generate a lot of output. It may be advantagous to pipe stdout to an alternate location for more casual perusal. For example, if using linux:
python3 examples/basics/trace.py | less
or
python3 examples/basics/trace.py > /tmp/trace
vi /tmp/trace
Definition in file trace.py.