mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
fixed whitespace issue
This commit is contained in:
parent
5acaae9fd3
commit
044fca0df7
2 changed files with 12 additions and 3 deletions
|
@ -70,6 +70,15 @@ def test_indent():
|
|||
assert_tokens_equal(exp, obs)
|
||||
|
||||
|
||||
def test_post_whitespace():
|
||||
l = Lexer()
|
||||
l.build()
|
||||
l.input('42 \t ')
|
||||
obs = list(l)
|
||||
exp = [('INT_LITERAL', '42', 1, 0)]
|
||||
assert_tokens_equal(exp, obs)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -87,7 +87,7 @@ class Lexer(object):
|
|||
#
|
||||
tokens = pykeywords + (
|
||||
# Misc
|
||||
'ID', 'INDENT', 'NEWLINE',
|
||||
'ID', 'INDENT', 'NEWLINE', 'WHITESPACE',
|
||||
|
||||
# literals
|
||||
'INT_LITERAL', 'HEX_LITERAL', 'OCT_LITERAL', 'BIN_LITERAL',
|
||||
|
@ -145,8 +145,8 @@ class Lexer(object):
|
|||
#
|
||||
# Rules
|
||||
#
|
||||
t_INDENT = '^[ \t]+'
|
||||
t_ignore = ' \t'
|
||||
t_INDENT = r'^[ \t]+'
|
||||
t_ignore_WHITESPACE = r' \t'
|
||||
|
||||
# Newlines
|
||||
def t_NEWLINE(self, t):
|
||||
|
|
Loading…
Add table
Reference in a new issue