Updated syntax tree to support variables in the espression.
This commit is contained in:
@@ -7,6 +7,8 @@ def calculate_results(node):
|
||||
|
||||
if type(node) is parser.Num:
|
||||
return float(node.value)
|
||||
elif type(node) is parser.Variable:
|
||||
return node.value
|
||||
|
||||
left = calculate_results(node.left)
|
||||
right = calculate_results(node.right)
|
||||
|
||||
Reference in New Issue
Block a user