PyXR

c:\python24\lib \ regex_syntax.py



0001 """Constants for selecting regexp syntaxes for the obsolete regex module.
0002 
0003 This module is only for backward compatibility.  "regex" has now
0004 been replaced by the new regular expression module, "re".
0005 
0006 These bits are passed to regex.set_syntax() to choose among
0007 alternative regexp syntaxes.
0008 """
0009 
0010 # 1 means plain parentheses serve as grouping, and backslash
0011 #   parentheses are needed for literal searching.
0012 # 0 means backslash-parentheses are grouping, and plain parentheses
0013 #   are for literal searching.
0014 RE_NO_BK_PARENS = 1
0015 
0016 # 1 means plain | serves as the "or"-operator, and \| is a literal.
0017 # 0 means \| serves as the "or"-operator, and | is a literal.
0018 RE_NO_BK_VBAR = 2
0019 
0020 # 0 means plain + or ? serves as an operator, and \+, \? are literals.
0021 # 1 means \+, \? are operators and plain +, ? are literals.
0022 RE_BK_PLUS_QM = 4
0023 
0024 # 1 means | binds tighter than ^ or $.
0025 # 0 means the contrary.
0026 RE_TIGHT_VBAR = 8
0027 
0028 # 1 means treat \n as an _OR operator
0029 # 0 means treat it as a normal character
0030 RE_NEWLINE_OR = 16
0031 
0032 # 0 means that a special characters (such as *, ^, and $) always have
0033 #   their special meaning regardless of the surrounding context.
0034 # 1 means that special characters may act as normal characters in some
0035 #   contexts.  Specifically, this applies to:
0036 #       ^ - only special at the beginning, or after ( or |
0037 #       $ - only special at the end, or before ) or |
0038 #       *, +, ? - only special when not after the beginning, (, or |
0039 RE_CONTEXT_INDEP_OPS = 32
0040 
0041 # ANSI sequences (\n etc) and \xhh
0042 RE_ANSI_HEX = 64
0043 
0044 # No GNU extensions
0045 RE_NO_GNU_EXTENSIONS = 128
0046 
0047 # Now define combinations of bits for the standard possibilities.
0048 RE_SYNTAX_AWK = (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS)
0049 RE_SYNTAX_EGREP = (RE_SYNTAX_AWK | RE_NEWLINE_OR)
0050 RE_SYNTAX_GREP = (RE_BK_PLUS_QM | RE_NEWLINE_OR)
0051 RE_SYNTAX_EMACS = 0
0052 
0053 # (Python's obsolete "regexp" module used a syntax similar to awk.)
0054 

Generated by PyXR 0.9.4
SourceForge.net Logo