aboutsummaryrefslogtreecommitdiff
path: root/parser.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2012-12-26 21:38:36 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2012-12-26 21:38:36 +0200
commitbc249bc697aad332c70635dc78c77737be7577bb (patch)
tree0133af8926155de0ff683a137403415118d00050 /parser.py
parent6cfd7d65d96ec3c5d6b85fd579240333ad343fc0 (diff)
downloadmeson-bc249bc697aad332c70635dc78c77737be7577bb.zip
meson-bc249bc697aad332c70635dc78c77737be7577bb.tar.gz
meson-bc249bc697aad332c70635dc78c77737be7577bb.tar.bz2
Deal with empty lines in input.
Diffstat (limited to 'parser.py')
-rwxr-xr-xparser.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/parser.py b/parser.py
index 2fd6343..e3da802 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))