summaryrefslogtreecommitdiffstats
path: root/Lib/sre_constants.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sre_constants.py')
-rw-r--r--Lib/sre_constants.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py
index f5e7894..45f4f48 100644
--- a/Lib/sre_constants.py
+++ b/Lib/sre_constants.py
@@ -23,6 +23,7 @@ SUCCESS = "success"
ANY = "any"
ASSERT = "assert"
+ASSERT_NOT = "assert_not"
AT = "at"
BRANCH = "branch"
CALL = "call"
@@ -81,7 +82,7 @@ OPCODES = [
FAILURE, SUCCESS,
ANY,
- ASSERT,
+ ASSERT, ASSERT_NOT,
AT,
BRANCH,
CALL,
@@ -121,8 +122,8 @@ def makedict(list):
d = {}
i = 0
for item in list:
- d[item] = i
- i = i + 1
+ d[item] = i
+ i = i + 1
return d
OPCODES = makedict(OPCODES)
@@ -176,12 +177,27 @@ SRE_FLAG_VERBOSE = 64
if __name__ == "__main__":
import string
def dump(f, d, prefix):
- items = d.items()
- items.sort(lambda a, b: cmp(a[1], b[1]))
- for k, v in items:
- f.write("#define %s_%s %s\n" % (prefix, string.upper(k), v))
+ items = d.items()
+ items.sort(lambda a, b: cmp(a[1], b[1]))
+ for k, v in items:
+ f.write("#define %s_%s %s\n" % (prefix, string.upper(k), v))
f = open("sre_constants.h", "w")
- f.write("/* generated from sre_constants.py */\n")
+ f.write("""\
+/*
+ * Secret Labs' Regular Expression Engine
+ *
+ * regular expression matching engine
+ *
+ * NOTE: This file is generated by sre_constants.py. If you need
+ * to change anything in here, edit sre_constants.py and run it.
+ *
+ * Copyright (c) 1997-2000 by Secret Labs AB. All rights reserved.
+ *
+ * See the _sre.c file for information on usage and redistribution.
+ */
+
+""")
+
dump(f, OPCODES, "SRE_OP")
dump(f, ATCODES, "SRE")
dump(f, CHCODES, "SRE")