Parse function and method calls properly.

pull/15/head
Jussi Pakkanen 11 years ago
parent 371e747ca4
commit 17ba9bccd0
  1. 1
      interpreter.py
  2. 8
      mparser.py

@ -1379,6 +1379,7 @@ class Interpreter():
for i in node.ifs:
result = self.evaluate_statement(i.condition)
if not(isinstance(result, bool)):
print(result)
raise InvalidCode('If clause does not evaluate to true or false.')
if result:
self.evaluate_codeblock(i.block)

@ -343,15 +343,15 @@ class Parser:
def e6(self):
left = self.e7()
if self.accept('dot'):
return self.method_call(left)
elif self.accept('lparen'):
if self.accept('lparen'):
args = self.args()
self.expect('rparen')
if not isinstance(left, IdNode):
raise ParseException('Function call must be applied to plain id',
left.lineno, left.colno)
return FunctionNode(left.lineno, left.colno, left.value, args)
left = FunctionNode(left.lineno, left.colno, left.value, args)
while self.accept('dot'):
left = self.method_call(left)
return left
def e7(self):

Loading…
Cancel
Save