[svn r38362] Fixed stupidity in the last checkin: only matching multi-line strings using

slashes if the slash is actually at the end of the line... :(

--HG--
branch : trunk
This commit is contained in:
guido 2007-02-10 12:06:58 +01:00
parent e04e08718f
commit 4d4ce90f73
2 changed files with 3 additions and 1 deletions

View File

@ -71,7 +71,7 @@ class Tokenizer(object):
j = schema.linejoin j = schema.linejoin
for d in schema.string + schema.multiline_string: for d in schema.string + schema.multiline_string:
self._re_strings_multiline.append( self._re_strings_multiline.append(
(re.compile('%s.*%s' % (d, j)), (re.compile('%s.*%s$' % (d, j)),
re.compile('.*?%s' % (d,)))) re.compile('.*?%s' % (d,))))
for d in schema.multiline_string: for d in schema.multiline_string:
self._re_strings_multiline.append((re.compile('%s.*' % (d,), re.S), self._re_strings_multiline.append((re.compile('%s.*' % (d,), re.S),

View File

@ -83,6 +83,8 @@ class TestTokenizer(object):
assert res == [Token("bar'", type='string')] assert res == [Token("bar'", type='string')]
res = list(t.tokenize("bar")) res = list(t.tokenize("bar"))
assert res == [Token('bar', type='word')] assert res == [Token('bar', type='word')]
res = list(t.tokenize('"foo\\bar"'))
assert res == [Token('"foo\\bar"', type="string")]
def test_string_following_printable(self): def test_string_following_printable(self):
assert self.tokens('."foo"') == [Token('.', type='unknown'), assert self.tokens('."foo"') == [Token('.', type='unknown'),