more whitspace fixes

This commit is contained in:
Anthony Scopatz 2015-01-23 20:45:45 -06:00
parent 9afa5d9fc5
commit 2e52ce54b9
2 changed files with 9 additions and 2 deletions

View file

@ -48,7 +48,7 @@ def assert_tokens_equal(x, y):
if len(diffs) > 0:
msg = ['The token sequnces differ: ']
for a, b in diffs:
msg += ['', '- ' + repr(x), '+ ' + repr(y)]
msg += ['', '- ' + repr(a), '+ ' + repr(b)]
msg = '\n'.join(msg)
raise AssertionError(msg)
@ -80,6 +80,13 @@ def test_post_whitespace():
exp = [('INT_LITERAL', '42', 1, 0)]
yield check_tokens, input, exp
def test_internal_whitespace():
input = '42 +\t65'
exp = [('INT_LITERAL', '42', 1, 0),
('PLUS', '+', 1, 4),
('INT_LITERAL', '65', 1, 6),]
yield check_tokens, input, exp
if __name__ == '__main__':

View file

@ -146,7 +146,7 @@ class Lexer(object):
# Rules
#
t_INDENT = r'^[ \t]+'
t_ignore_WHITESPACE = r' \t'
t_ignore_WHITESPACE = r'[ \t]+'
# Newlines
def t_NEWLINE(self, t):