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

Functions

def float (state, input, index, length, data)
 
def sign (state, input, index, length, data)
 
def integer (state, input, index, length, data)
 
def fraction (state, input, index, length, data)
 
def esign (state, input, index, length, data)
 
def exponent (state, input, index, length, data)
 
def fn (input, result)
 

Variables

string title
 
string pattern
 
string input = '[ 123 ]'
 
string header = 'RESULT'
 
int testno = 0
 
 exp = ApgExp(pattern, 'g')
 
 result = exp.exec(input)
 
dictionary data = {}
 
 match
 
 end
 

Function Documentation

◆ esign()

def examples.exp.ast_translate.esign (   state,
  input,
  index,
  length,
  data 
)

Definition at line 74 of file ast_translate.py.

◆ exponent()

def examples.exp.ast_translate.exponent (   state,
  input,
  index,
  length,
  data 
)

Definition at line 82 of file ast_translate.py.

◆ float()

def examples.exp.ast_translate.float (   state,
  input,
  index,
  length,
  data 
)

Definition at line 31 of file ast_translate.py.

◆ fn()

def examples.exp.ast_translate.fn (   input,
  result 
)

Definition at line 141 of file ast_translate.py.

◆ fraction()

def examples.exp.ast_translate.fraction (   state,
  input,
  index,
  length,
  data 
)

Definition at line 65 of file ast_translate.py.

◆ integer()

def examples.exp.ast_translate.integer (   state,
  input,
  index,
  length,
  data 
)

Definition at line 56 of file ast_translate.py.

◆ sign()

def examples.exp.ast_translate.sign (   state,
  input,
  index,
  length,
  data 
)

Definition at line 48 of file ast_translate.py.

Variable Documentation

◆ data

dictionary examples.exp.ast_translate.data = {}

Definition at line 134 of file ast_translate.py.

◆ end

examples.exp.ast_translate.end

Definition at line 136 of file ast_translate.py.

◆ exp

examples.exp.ast_translate.exp = ApgExp(pattern, 'g')

Definition at line 120 of file ast_translate.py.

◆ header

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

Definition at line 116 of file ast_translate.py.

◆ input

string examples.exp.ast_translate.input = '[ 123 ]'

Definition at line 104 of file ast_translate.py.

◆ match

examples.exp.ast_translate.match

Definition at line 136 of file ast_translate.py.

◆ pattern

string examples.exp.ast_translate.pattern
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 90 of file ast_translate.py.

◆ result

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

Definition at line 122 of file ast_translate.py.

◆ testno

int examples.exp.ast_translate.testno = 0

Definition at line 117 of file ast_translate.py.

◆ title

string examples.exp.ast_translate.title
Initial value:
1 = '''This example will demonstrate how to use the AST
2 for matched result translations. ApgExp will be used to match
3 floating point numbers and the AST will be used to put the
4 numbers in a "normalized" form.
5 A second example will use the same AST to create a replacement
6 function to do replacements with the translated matches.
7 See also the examples/exp/ast.py and examples/exp/replace.py examples.
8 '''

Definition at line 17 of file ast_translate.py.

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