Package Martel :: Module Generate
[show private | hide private]
[frames | no frames]

Module Martel.Generate

Classes
CheckAssert  
CheckAssertNot  
CheckGroupRef  
GeneratorState  
HandleRepeatCount  
print_debug Print debug information
print_info Print information after each expression match
SetGroupValue  
_call_call  
_call_calltag  

Function Summary
  check_assert(text, x, end, tag_words)
  check_assert_not(text, x, end, tagtable)
  check_at_beginning(text, x, end)
  generate(expression, debug_level)
expression -> Parser for the Expression tree
  generate_alt(expression, genstate)
  generate_any(expression, genstate)
  generate_assert(expression, genstate)
  generate_at_beginning(expression, genstate)
  generate_at_end(expression, genstate)
  generate_debug(expression, genstate)
  generate_dot(expression, genstate)
  generate_eol(expression, genstate)
  generate_group(expression, genstate)
  generate_groupref(expression, genstate)
  generate_literal(expression, genstate)
  generate_max_repeat(expression, genstate)
  generate_named_max_repeat(expression, genstate)
  generate_null_op(expression, genstate)
  generate_parser(expression, debug_level)
  generate_pass_through(expression, genstate)
  generate_seq(expression, genstate)
  generate_str(expression, genstate)
  track_position(text, x, end)
store the start position of the farthest successful match
  _find_wanted_groupref_names(expression)
expression -> dict of group names wanted by elements of the tree
  _generate(expression, genstate)

Variable Summary
dict generate_table = {<class Martel.Expression.Any at 0x2aaa...
bool supports_lookahead = True
int _generate_count = 0                                                                     
int _position = -1                                                                    

Function Details

generate(expression, debug_level=0)

expression -> Parser for the Expression tree

track_position(text, x, end)

store the start position of the farthest successful match

This value is more useful than mxTextTools' default, which only points out the last text region successfully tagged at the top level. This value is the last region successfully tagged anywhere.

Uses a global variable so this is SINGLE THREADED!

_find_wanted_groupref_names(expression)

expression -> dict of group names wanted by elements of the tree

The dict is used to during tagtable generation to specify which groups need to save their match text. There's match-time overhead for doing that, and the code isn't thread safe, so the intent is to save only those groups that are needed.

The dict value is 1 if the group name is needed, else there is no entry in the dict.

XXX need to make this a method!

Variable Details

generate_table

Type:
dict
Value:
{<class Martel.Expression.Any at 0x2aaaada83890>: <function generate_a\
ny at 0x2aaaae7e16e0>,
 <class Martel.Expression.Assert at 0x2aaaada838f0>: <function generat\
e_assert at 0x2aaaae7e0410>,
 <class Martel.Expression.AtBeginning at 0x2aaaada83950>: <function ge\
nerate_at_beginning at 0x2aaaae7e0050>,
 <class Martel.Expression.AtEnd at 0x2aaaada839b0>: <function generate\
_at_end at 0x2aaaae7e00c8>,
...                                                                    

supports_lookahead

Type:
bool
Value:
True                                                                   

_generate_count

Type:
int
Value:
0                                                                     

_position

Type:
int
Value:
-1                                                                    

Generated by Epydoc 2.1 on Thu Jun 30 22:05:33 2005 http://epydoc.sf.net