summaryrefslogtreecommitdiffstats
path: root/Lib/sre_compile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sre_compile.py')
-rw-r--r--Lib/sre_compile.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index 8a26a0f..ee0882d 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -145,6 +145,19 @@ def _compile(code, pattern, flags):
else:
emit(OPCODES[op])
emit(av-1)
+ elif op is GROUPREF_EXISTS:
+ emit(OPCODES[op])
+ emit((av[0]-1)*2)
+ skipyes = len(code); emit(0)
+ _compile(code, av[1], flags)
+ if av[2]:
+ emit(OPCODES[JUMP])
+ skipno = len(code); emit(0)
+ code[skipyes] = len(code) - skipyes + 1
+ _compile(code, av[2], flags)
+ code[skipno] = len(code) - skipno
+ else:
+ code[skipyes] = len(code) - skipyes + 1
else:
raise ValueError, ("unsupported operand type", op)