Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / lib / python2.4 / regex_syntax.py
CommitLineData
920dae64
AT
1"""Constants for selecting regexp syntaxes for the obsolete regex module.
2
3This module is only for backward compatibility. "regex" has now
4been replaced by the new regular expression module, "re".
5
6These bits are passed to regex.set_syntax() to choose among
7alternative regexp syntaxes.
8"""
9
10# 1 means plain parentheses serve as grouping, and backslash
11# parentheses are needed for literal searching.
12# 0 means backslash-parentheses are grouping, and plain parentheses
13# are for literal searching.
14RE_NO_BK_PARENS = 1
15
16# 1 means plain | serves as the "or"-operator, and \| is a literal.
17# 0 means \| serves as the "or"-operator, and | is a literal.
18RE_NO_BK_VBAR = 2
19
20# 0 means plain + or ? serves as an operator, and \+, \? are literals.
21# 1 means \+, \? are operators and plain +, ? are literals.
22RE_BK_PLUS_QM = 4
23
24# 1 means | binds tighter than ^ or $.
25# 0 means the contrary.
26RE_TIGHT_VBAR = 8
27
28# 1 means treat \n as an _OR operator
29# 0 means treat it as a normal character
30RE_NEWLINE_OR = 16
31
32# 0 means that a special characters (such as *, ^, and $) always have
33# their special meaning regardless of the surrounding context.
34# 1 means that special characters may act as normal characters in some
35# contexts. Specifically, this applies to:
36# ^ - only special at the beginning, or after ( or |
37# $ - only special at the end, or before ) or |
38# *, +, ? - only special when not after the beginning, (, or |
39RE_CONTEXT_INDEP_OPS = 32
40
41# ANSI sequences (\n etc) and \xhh
42RE_ANSI_HEX = 64
43
44# No GNU extensions
45RE_NO_GNU_EXTENSIONS = 128
46
47# Now define combinations of bits for the standard possibilities.
48RE_SYNTAX_AWK = (RE_NO_BK_PARENS | RE_NO_BK_VBAR | RE_CONTEXT_INDEP_OPS)
49RE_SYNTAX_EGREP = (RE_SYNTAX_AWK | RE_NEWLINE_OR)
50RE_SYNTAX_GREP = (RE_BK_PLUS_QM | RE_NEWLINE_OR)
51RE_SYNTAX_EMACS = 0
52
53# (Python's obsolete "regexp" module used a syntax similar to awk.)