Version 1.0
Copyright © 2022 Lowell D. Thomas
Python APG
 … an ABNF Parser Generator
Functions | Variables
examples.exp.udts Namespace Reference

Functions

def u_digits (cb_data)
 A handwritten code snippet to recognize an IPv4 digit 0 - 255. More...
 

Variables

string title
 
string pattern = 'ipv4 = %^ u_digits %d46 u_digits %d46 u_digits %d46 u_digits %$\n'
 
string header = 'RESULT'
 
int testno = 0
 
 exp = ApgExp(pattern)
 
string input = '192.168.001.1'
 
 result = exp.exec(input)
 

Function Documentation

◆ u_digits()

def examples.exp.udts.u_digits (   cb_data)

A handwritten code snippet to recognize an IPv4 digit 0 - 255.

Definition at line 40 of file udts.py.

Variable Documentation

◆ exp

examples.exp.udts.exp = ApgExp(pattern)

Definition at line 64 of file udts.py.

◆ header

string examples.exp.udts.header = 'RESULT'

Definition at line 36 of file udts.py.

◆ input

string examples.exp.udts.input = '192.168.001.1'

Definition at line 67 of file udts.py.

◆ pattern

string examples.exp.udts.pattern = 'ipv4 = %^ u_digits %d46 u_digits %d46 u_digits %d46 u_digits %$\n'

Definition at line 32 of file udts.py.

◆ result

examples.exp.udts.result = exp.exec(input)

Definition at line 68 of file udts.py.

◆ testno

int examples.exp.udts.testno = 0

Definition at line 37 of file udts.py.

◆ title

string examples.exp.udts.title
Initial value:
1 = '''This example will demonstrate how to use
2 handwritten code snippets to match patterns that are
3 difficult to describe with an SABNF grammar.
4 An IPv4 address is simple to describe verbally,
5 but the constraints on the digits are quite complicated
6 in the ABNF syntax. For example, with the form
7 xxx.xxx.xxx.xxx
8 xxx can be any number 0-255. However,
9  - it may or may not have leading zeros
10  - if three digits, the first must be <= 2
11  - if 2, the second digit must be <= 5
12  - if 2 and the second digit is 5 then the third must be <= 5
13 Straight forward verbally but not a simple ABNF problem.
14 Here we show a brute force the solution with a handwritten
15 phrase-matching terminal, an APG UDT.
16 '''

Definition at line 13 of file udts.py.

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