Merge pull request #411 from olasd/bugfix/382
Fix handling of comments at end of input
This commit is contained in:
commit
c213a4e122
@ -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+')
|
||||
|
||||
|
||||
|
@ -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")]
|
||||
|
Loading…
Reference in New Issue
Block a user