Merge pull request #411 from olasd/bugfix/382

Fix handling of comments at end of input
This commit is contained in:
Bob Tolbert 2014-01-01 18:56:04 -08:00
commit c213a4e122
2 changed files with 7 additions and 1 deletions

View File

@ -60,7 +60,7 @@ lg.add('STRING', r'''(?x)
lg.add('IDENTIFIER', r'[^()\[\]{}\'"\s;]+')
lg.ignore(r';.*[\r\n]+')
lg.ignore(r';.*(?=\r|\n|$)')
lg.ignore(r'\s+')

View File

@ -260,3 +260,9 @@ def test_reader_macro():
assert entry[0][0] == HySymbol("dispatch_reader_macro")
assert entry[0][1] == HyExpression([HySymbol("quote"), HyString("^")])
assert len(entry[0]) == 3
def test_lex_comment_382():
"""Ensure that we can tokenize sources with a comment at the end"""
entry = tokenize("foo ;bar\n;baz")
assert entry == [HySymbol("foo")]