sre_parse
index
/usr/lib/python1.6/sre_parse.py

# Secret Labs' Regular Expression Engine
#
# convert re-style regular expression to sre pattern
#
# Copyright (c) 1998-2000 by Secret Labs AB.  All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#

 
Modules
            
string
sys

 
Classes
            
Pattern
SubPattern
Tokenizer

 
class Pattern
       
  
__init__(self)
# master pattern object.  keeps track of global attributes
getgroup(self, name=None)

 
class SubPattern
       
  
__delitem__(self, index)
__getitem__(self, index)
__getslice__(self, start, stop)
__init__(self, pattern, data=None)
# a subpattern, in intermediate form
__len__(self)
__repr__(self)
__setitem__(self, index, code)
append(self, code)
dump(self, level=0)
getwidth(self)
insert(self, index, code)

 
class Tokenizer
       
  
_Tokenizer__next = __next(self)
__init__(self, string)
get(self)
match(self, char)
seek(self, index)
tell(self)

 
Functions
            
_class_escape(source, escape)
_escape(source, escape, state)
_group(escape, groups)
_parse(source, state)
_parse_sub(source, state, nested=1)
expand_template(template, match)
isdigit(char)
isident(char)
isname(name)
parse(str, flags=0, pattern=None)
parse_template(source, pattern)

 
Data
             ANY = 'any'
ANY_ALL = 'any_all'
ASSERT = 'assert'
ASSERT_NOT = 'assert_not'
AT = 'at'
ATCODES = {'at_beginning': 0, 'at_beginning_line': 1, 'at_boundary': 2, 'at_end': 4, 'at_end_line': 5, 'at_non_boundary': 3}
AT_BEGINNING = 'at_beginning'
AT_BEGINNING_LINE = 'at_beginning_line'
AT_BOUNDARY = 'at_boundary'
AT_END = 'at_end'
AT_END_LINE = 'at_end_line'
AT_MULTILINE = {'at_beginning': 'at_beginning_line', 'at_end': 'at_end_line'}
AT_NON_BOUNDARY = 'at_non_boundary'
BRANCH = 'branch'
CALL = 'call'
CATEGORIES = {r'\A': ('at', 'at_beginning'), r'\B': ('at', 'at_non_boundary'), r'\D': ('in', [('category', 'category_not_digit')]), r'\S': ('in', [('category', 'category_not_space')]), r'\W': ('in', [('category', 'category_not_word')]), r'\Z': ('at', 'at_end'), r'\b': ('at', 'at_boundary'), r'\d': ('in', [('category', 'category_digit')]), r'\s': ('in', [('category', 'category_space')]), r'\w': ('in', [('category', 'category_word')])}
CATEGORY = 'category'
CATEGORY_DIGIT = 'category_digit'
CATEGORY_LINEBREAK = 'category_linebreak'
CATEGORY_LOC_NOT_WORD = 'category_loc_not_word'
CATEGORY_LOC_WORD = 'category_loc_word'
CATEGORY_NOT_DIGIT = 'category_not_digit'
CATEGORY_NOT_LINEBREAK = 'category_not_linebreak'
CATEGORY_NOT_SPACE = 'category_not_space'
CATEGORY_NOT_WORD = 'category_not_word'
CATEGORY_SPACE = 'category_space'
CATEGORY_UNI_DIGIT = 'category_uni_digit'
CATEGORY_UNI_LINEBREAK = 'category_uni_linebreak'
CATEGORY_UNI_NOT_DIGIT = 'category_uni_not_digit'
CATEGORY_UNI_NOT_LINEBREAK = 'category_uni_not_linebreak'
CATEGORY_UNI_NOT_SPACE = 'category_uni_not_space'
CATEGORY_UNI_NOT_WORD = 'category_uni_not_word'
CATEGORY_UNI_SPACE = 'category_uni_space'
CATEGORY_UNI_WORD = 'category_uni_word'
CATEGORY_WORD = 'category_word'
CHARMASK = 255
CHARSET = 'charset'
CHCODES = {'category_digit': 0, 'category_linebreak': 6, 'category_loc_not_word': 9, 'category_loc_word': 8, 'category_not_digit': 1, 'category_not_linebreak': 7, 'category_not_space': 3, 'category_not_word': 5, 'category_space': 2, 'category_uni_digit': 10, ...}
CH_LOCALE = {'category_digit': 'category_digit', 'category_linebreak': 'category_linebreak', 'category_not_digit': 'category_not_digit', 'category_not_linebreak': 'category_not_linebreak', 'category_not_space': 'category_not_space', 'category_not_word': 'category_loc_not_word', 'category_space': 'category_space', 'category_word': 'category_loc_word'}
CH_UNICODE = {'category_digit': 'category_uni_digit', 'category_linebreak': 'category_uni_linebreak', 'category_not_digit': 'category_uni_not_digit', 'category_not_linebreak': 'category_uni_not_linebreak', 'category_not_space': 'category_uni_not_space', 'category_not_word': 'category_uni_not_word', 'category_space': 'category_uni_space', 'category_word': 'category_uni_word'}
DIGITS = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
ESCAPES = {r'\\': ('literal', 92), r'\a': ('literal', 7), r'\b': ('literal', 8), r'\f': ('literal', 12), r'\n': ('literal', 10), r'\r': ('literal', 13), r'\t': ('literal', 9), r'\v': ('literal', 11)}
FAILURE = 'failure'
FLAGS = {'L': 4, 'i': 2, 'm': 8, 's': 16, 't': 1, 'u': 32, 'x': 64}
GROUPREF = 'groupref'
GROUPREF_IGNORE = 'groupref_ignore'
HEXDIGITS = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', ...)
IN = 'in'
INFO = 'info'
IN_IGNORE = 'in_ignore'
JUMP = 'jump'
LITERAL = 'literal'
LITERAL_IGNORE = 'literal_ignore'
MARK = 'mark'
MAXREPEAT = 65535
MAX_REPEAT = 'max_repeat'
MAX_UNTIL = 'max_until'
MIN_REPEAT = 'min_repeat'
MIN_UNTIL = 'min_until'
NEGATE = 'negate'
NOT_LITERAL = 'not_literal'
NOT_LITERAL_IGNORE = 'not_literal_ignore'
OCTDIGITS = ('0', '1', '2', '3', '4', '5', '6', '7')
OPCODES = {'any': 2, 'any_all': 3, 'assert': 4, 'assert_not': 5, 'at': 6, 'branch': 7, 'call': 8, 'category': 9, 'charset': 10, 'failure': 0, ...}
OP_IGNORE = {'groupref': 'groupref_ignore', 'in': 'in_ignore', 'literal': 'literal_ignore', 'not_literal': 'not_literal_ignore'}
RANGE = 'range'
REPEAT = 'repeat'
REPEAT_CHARS = '*+?{'
REPEAT_ONE = 'repeat_one'
SPECIAL_CHARS = r'.\[{()*+?^$|'
SRE_FLAG_DOTALL = 16
SRE_FLAG_IGNORECASE = 2
SRE_FLAG_LOCALE = 4
SRE_FLAG_MULTILINE = 8
SRE_FLAG_TEMPLATE = 1
SRE_FLAG_UNICODE = 32
SRE_FLAG_VERBOSE = 64
SRE_INFO_CHARSET = 4
SRE_INFO_LITERAL = 2
SRE_INFO_PREFIX = 1
SUBPATTERN = 'subpattern'
SUCCESS = 'success'
WHITESPACE = (' ', '\011', '\012', '\015', '\013', '\014')
__file__ = '/usr/lib/python1.6/sre_parse.pyc'
__name__ = 'sre_parse'