Skip to content
Permalink
Browse files

Fixed #785 -- corrected parsing of `ident:symbol` after a newline

  • Loading branch information
alex committed Jun 30, 2013
1 parent 228d1f6 commit 5309bf554adf088e2afcdb5614ae3ba6fbc413e6
Showing with 16 additions and 0 deletions.
  1. +12 −0 tests/test_parser.py
  2. +4 −0 topaz/lexer.py
@@ -2764,3 +2764,15 @@ def test_multiline_comments_lineno(self, space):
assert r == ast.Main(ast.Block([
ast.Statement(ast.Send(ast.ConstantInt(1), "+", [ast.ConstantInt(1)], None, 6))
]))

def test_call_no_space_symbol(self, space):
r = space.parse("""
def f
end
f:bar
""")
assert r == ast.Main(ast.Block([
ast.Statement(ast.Function(None, "f", [], None, None, ast.Nil())),
ast.Statement(ast.Send(ast.Self(5), "f", [ast.ConstantSymbol("bar")], None, 5))
]))
@@ -147,6 +147,10 @@ def tokenize(self):
self.EXPR_VALUE, self.EXPR_FNAME,
self.EXPR_CLASS]:
self.add("\n")
while self.peek() in "\r\n ":
ch = self.read()
if ch in "\r\n":
self.newline(ch)
self.command_start = True
self.state = self.EXPR_BEG
yield self.emit("LITERAL_NEWLINE")

0 comments on commit 5309bf5

Please sign in to comment.