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

Module Martel.convert_re

Converts a regular expression pattern string into an Expression tree.

This is not meant to be an externally usable module.

This works by using msre_parse.py to parse the pattern. The result is a tree data structure, where the nodes in the tree are tuples. The first element of the tuple is the name of the node type. The format of the other elements depends on the type.

The conversion routine is pretty simple - convert each msre_parse tuple node into a Martel Expression node. It's a recusive implementation.

'msre_parse.py' is a modified version of Secret Labs' 'sre_parse.py'
Classes
GroupNames  

Function Summary
  convert_any(group_names, name, ignore)
  convert_assert(group_names, name, (direction, terms))
  convert_assert_not(group_names, name, (direction, terms))
  convert_at(group_names, name, where)
  convert_branch(group_names, name, (ignore, branches))
  convert_groupref(group_names, name, id)
  convert_in(group_names, name, terms)
  convert_list(group_names, terms)
  convert_literal(group_names, name, val)
  convert_max_repeat(group_names, name, (min_count, max_count, terms))
  convert_newline(group_names, name, ignore)
  convert_not_literal(group_names, name, val)
  convert_subpattern(group_names, name, (id, terms))
  invert(s)
s -> a string containing all the characters not present in s
  make_expression(pattern)
pattern -> the Expression tree for the given pattern string

Function Details

invert(s)

s -> a string containing all the characters not present in s

make_expression(pattern)

pattern -> the Expression tree for the given pattern string

Generated by Epydoc 2.1 on Mon Aug 27 16:13:08 2007 http://epydoc.sf.net