Kaydet (Commit) 4ccea941 authored tarafından Fredrik Lundh's avatar Fredrik Lundh

- reverted to "\x is binary byte"

- removed evil tabs from sre_parse and sre_compile
üst 1739be50
...@@ -39,7 +39,7 @@ def _compile(code, pattern, flags): ...@@ -39,7 +39,7 @@ def _compile(code, pattern, flags):
return _sre.getlower(literal, flags) return _sre.getlower(literal, flags)
else: else:
emit(OPCODES[op]) emit(OPCODES[op])
fixup = lambda x: x fixup = lambda x: x
skip = len(code); emit(0) skip = len(code); emit(0)
for op, av in av: for op, av in av:
emit(OPCODES[op]) emit(OPCODES[op])
......
...@@ -19,8 +19,9 @@ from sre_constants import * ...@@ -19,8 +19,9 @@ from sre_constants import *
# FIXME: should be 65535, but the arraymodule is still broken # FIXME: should be 65535, but the arraymodule is still broken
MAXREPEAT = 32767 MAXREPEAT = 32767
# FIXME: same here # FIXME: might change in 2.0 final. but for now, this seems
CHARMASK = 0x7fff # to be the best way to be compatible with 1.5.2
CHARMASK = 0xff
SPECIAL_CHARS = ".\\[{()*+?^$|" SPECIAL_CHARS = ".\\[{()*+?^$|"
REPEAT_CHARS = "*+?{" REPEAT_CHARS = "*+?{"
...@@ -616,9 +617,9 @@ def expand_template(template, match): ...@@ -616,9 +617,9 @@ def expand_template(template, match):
a = p.append a = p.append
sep = match.string[:0] sep = match.string[:0]
if type(sep) is type(""): if type(sep) is type(""):
char = chr char = chr
else: else:
char = unichr char = unichr
for c, s in template: for c, s in template:
if c is LITERAL: if c is LITERAL:
a(char(s)) a(char(s))
......
test_sre test_sre
=== Failed incorrectly ('\\x00ffffffffffffff', '\377', 0, 'found', '\377')
=== Failed incorrectly ('^(.+)?B', 'AB', 0, 'g1', 'A') === Failed incorrectly ('^(.+)?B', 'AB', 0, 'g1', 'A')
=== Failed incorrectly ('(a+)+\\1', 'aa', 0, 'found+"-"+g1', 'aa-a') === Failed incorrectly ('(a+)+\\1', 'aa', 0, 'found+"-"+g1', 'aa-a')
=== grouping error ('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', 0, 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/') 'd:msgs/tdir/sub1/-trial/' should be 'd:msgs/tdir/sub1/-tdir/' === grouping error ('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', 0, 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/') 'd:msgs/tdir/sub1/-trial/' should be 'd:msgs/tdir/sub1/-tdir/'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment