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

Module Martel.Expression

Classes for nodes in the Expression tree.

Expression
 |--- Any           - match (or don't match) a set of characters
 |--- AnyEol        - match any newline representation ("
", "
" or "
")
 |--- Assert        - used for positive and negative lookahead assertions 
 |--- AtBeginning   - match the beginning of a line
 |--- AtEnd         - match the end of a line
 |--- Debug         - print a debug message
 |--- Dot           - match any character except newline
 |--- Group         - give a group name to an expression
 |--- GroupRef      - match a previously identified expression
 |--- Literal       - match (or don't match) a single character
 |--- MaxRepeat     - greedy repeat of an expression, within min/max bounds
 |--- NullOp        - does nothing (useful as an initial seed)
 |--- PassThrough   - used when overriding 'make_parser'; match its subexp
 |      |--- FastFeature  - keeps information about possibly optional tags
 |      |--- HeaderFooter - files with a header, records and a footer
 |      `--- ParseRecords - parse a record at a time
 |--- Str           - match a given string
 `--- ExpressionList  - expressions containing several subexpressions
        |--- Alt    - subexp1 or subexp2 or subexp3 or ...
        `--- Seq    - subexp1 followed by subexp2 followed by subexp3 ...

Classes
Alt An Expression tree with a list of alternate matches.
Any  
AnyEol Match a newline (" ", " " or " ")
Assert  
AtBeginning Match the beginning of a line
AtEnd Match the end of a line
Debug  
Dot Match any character except newline
Expression Base class for nodes in the Expression tree
ExpressionList shares implementation used by 'Expressions with subexpressions'
FastFeature  
Group  
GroupRef  
HeaderFooter  
Literal  
MaxRepeat  
NullOp  
ParseRecords  
PassThrough  
Seq An Expression matching a set of subexpressions, in sequential order
Str  

Function Summary
  escape(pattern)
Escape all non-alphanumeric characters in pattern.
  NoCase(expr)
expression -> expression where the text is case insensitive
  _make_fast_lookup()
  _make_group_pattern(name, expression, attrs)
  _make_no_case(node)
modify an expression in place to remove case dependencies
  _minimize_any_range(s)
s -> a string useable inside [] which matches all the characters in s
  _minimize_escape_char(c)
(c) -> into an appropriately escaped pattern for the character
  _minimize_escape_range(c1, c2)
(c1, c2) -> the pattern for the range bounded by those two characters
  _quote(s)
  _verify_name(s)

Variable Summary
int MAXREPEAT = 65535                                                                 
NoneType _fast_quote_lookup = None                                                                  
dict _minimize_escape_chars = {'\x07': '\\a', '\t': '\\t', '\...

Function Details

escape(pattern)

Escape all non-alphanumeric characters in pattern.

NoCase(expr)

expression -> expression where the text is case insensitive

_make_no_case(node)

modify an expression in place to remove case dependencies

may return a new top-level node

_minimize_any_range(s)

s -> a string useable inside [] which matches all the characters in s

For example, passing in "0123456789" returns "\d".

This code isn't perfect.

_minimize_escape_char(c)

(c) -> into an appropriately escaped pattern for the character

_minimize_escape_range(c1, c2)

(c1, c2) -> the pattern for the range bounded by those two characters

Variable Details

MAXREPEAT

Type:
int
Value:
65535                                                                 

_fast_quote_lookup

Type:
NoneType
Value:
None                                                                  

_minimize_escape_chars

Type:
dict
Value:
{'\x07': '\\a',
 '\x08': '\\b',
 '\t': '\\t',
 '\n': '\\n',
 '\x0b': '\\v',
 '\x0c': '\\f',
 '\r': '\\r',
 '[': '\\[',
...                                                                    

Generated by Epydoc 2.1 on Thu Aug 10 20:01:06 2006 http://epydoc.sf.net