From bc249bc697aad332c70635dc78c77737be7577bb Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Wed, 26 Dec 2012 21:38:36 +0200 Subject: [PATCH] Deal with empty lines in input. --- parser.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parser.py b/parser.py index 2fd634328..e3da80279 100755 --- a/parser.py +++ b/parser.py @@ -73,6 +73,10 @@ def p_codeblock(t): cb = t[3] cb.prepend(t[1]) t[0] = cb + +def p_codeblock_emptyline(t): + 'codeblock : EOL codeblock' + t[0] = t[2] def p_codeblock_last(t): 'codeblock : statement EOL' @@ -141,6 +145,7 @@ def test_lexer(): def test_parser(): code = """func_call('something', 'or else') objectname.methodname(abc) + emptycall()""" print(build_ast(code))