aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-03-02 01:50:52 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2013-03-02 01:50:52 +0200
commite2a53572820a4fb1a5f4edee44f5b6e1ff565dc3 (patch)
tree9946db2eabc9f7690b1c7971c653789a44210d37
parentadd94f96edbf09e8a7a151e1cd901692d55e71f6 (diff)
downloadmeson-e2a53572820a4fb1a5f4edee44f5b6e1ff565dc3.zip
meson-e2a53572820a4fb1a5f4edee44f5b6e1ff565dc3.tar.gz
meson-e2a53572820a4fb1a5f4edee44f5b6e1ff565dc3.tar.bz2
Do not lose line numbers to the great void of nothingness.
-rwxr-xr-xinterpreter.py2
-rw-r--r--mparser.py14
2 files changed, 9 insertions, 7 deletions
diff --git a/interpreter.py b/interpreter.py
index 1076805..4b95105 100755
--- a/interpreter.py
+++ b/interpreter.py
@@ -765,6 +765,8 @@ class Interpreter():
return arg.get_value()
elif isinstance(arg, nodes.ArrayStatement):
return [self.reduce_single(curarg) for curarg in arg.args.arguments]
+ elif isinstance(arg, nodes.IntStatement):
+ return arg.get_value()
else:
raise InvalidCode('Line %d: Irreducible argument.' % arg.lineno())
diff --git a/mparser.py b/mparser.py
index aae07d8..87782b2 100644
--- a/mparser.py
+++ b/mparser.py
@@ -103,7 +103,7 @@ def p_codeblock_emptyline(t):
def p_codeblock_last(t):
'codeblock : statement EOL'
- cb = nodes.CodeBlock(t.lineno(1))
+ cb = nodes.CodeBlock(t[1].lineno())
cb.prepend(t[1])
t[0] = cb
@@ -129,12 +129,12 @@ def p_expression_string(t):
def p_statement_assign(t):
'statement : expression ASSIGN statement'
- t[0] = nodes.Assignment(t[1], t[3], t.lineno(1))
+ t[0] = nodes.Assignment(t[1], t[3], t[1].lineno())
def p_statement_comparison(t):
'''statement : statement EQUALS statement
| statement NEQUALS statement'''
- t[0] = nodes.Comparison(t[1], t[2], t[3], t.lineno(1))
+ t[0] = nodes.Comparison(t[1], t[2], t[3], t[1].lineno())
def p_statement_array(t):
'''statement : LBRACKET args RBRACKET'''
@@ -142,11 +142,11 @@ def p_statement_array(t):
def p_statement_func_call(t):
'statement : expression LPAREN args RPAREN'
- t[0] = nodes.FunctionCall(t[1], t[3], t.lineno(1))
+ t[0] = nodes.FunctionCall(t[1], t[3], t[1].lineno())
def p_statement_method_call(t):
'statement : expression DOT expression LPAREN args RPAREN'
- t[0] = nodes.MethodCall(t[1], t[3], t[5], t.lineno(1))
+ t[0] = nodes.MethodCall(t[1], t[3], t[5], t[1].lineno())
def p_statement_if(t):
'statement : IF statement EOL codeblock elseblock ENDIF'
@@ -189,13 +189,13 @@ def p_kwargs_multiple(t):
def p_args_single_pos(t):
'args : statement'
- args = nodes.Arguments(t.lineno(1))
+ args = nodes.Arguments(t[1].lineno())
args.prepend(t[1])
t[0] = args
def p_args_single_kw(t):
'args : expression COLON statement'
- a = nodes.Arguments(t.lineno(1))
+ a = nodes.Arguments(t[1].lineno())
a.set_kwarg(t[1], t[3])
t[0] = a