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

Variables

string title
 
string abnf_syntax = 'S = "a" S / "y"\n'
 
string abnf_syntax_strict = 'S = "a" S / "y"\r\n'
 
string input_string = 'aaay'
 
 api = Api()
 
 grammar = api.generate(abnf_syntax)
 
 parser = Parser(grammar)
 
 result = parser.parse(utils.string_to_tuple(input_string))
 

Variable Documentation

◆ abnf_syntax

string examples.basics.parsing_basics.abnf_syntax = 'S = "a" S / "y"\n'

Definition at line 25 of file parsing_basics.py.

◆ abnf_syntax_strict

string examples.basics.parsing_basics.abnf_syntax_strict = 'S = "a" S / "y"\r\n'

Definition at line 26 of file parsing_basics.py.

◆ api

examples.basics.parsing_basics.api = Api()

Definition at line 30 of file parsing_basics.py.

◆ grammar

examples.basics.parsing_basics.grammar = api.generate(abnf_syntax)

Definition at line 31 of file parsing_basics.py.

◆ input_string

string examples.basics.parsing_basics.input_string = 'aaay'

Definition at line 27 of file parsing_basics.py.

◆ parser

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

Definition at line 39 of file parsing_basics.py.

◆ result

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

Definition at line 40 of file parsing_basics.py.

◆ title

string examples.basics.parsing_basics.title
Initial value:
1 = '''A simple demonstration of parsing basics.
2 Generate a grammar object from an ABNF grammar syntax.
3 Use the grammar object to parse an input string that matches the grammar.
4 '''

Definition at line 18 of file parsing_basics.py.

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