Tested the Factor Engine, first round of testing passed. Fixed a bug in the JSON_Generator to stop expression variables from being added in reverse.
This commit is contained in:
@@ -30,6 +30,7 @@ class Variable:
|
||||
|
||||
@staticmethod
|
||||
def get_variable_type(variable_name):
|
||||
print(variable_name[0])
|
||||
if len(variable_name) == 0:
|
||||
return "Unknown"
|
||||
if not variable_name[0] in Variable.VARIABLE_TYPES:
|
||||
|
||||
@@ -2,6 +2,7 @@ import tokenizer
|
||||
import ctoken
|
||||
import expression
|
||||
import jsonpickle
|
||||
import copy
|
||||
|
||||
variables = {}
|
||||
def print_vars(vars):
|
||||
@@ -62,8 +63,10 @@ try:
|
||||
except ValueError:
|
||||
print("The anwser must be numeric! Will not be included in output file.")
|
||||
tokens = tokenizer.get_tokens_from_expression_string(exp)
|
||||
rev_tokens = copy.deepcopy(tokens)
|
||||
rev_tokens.reverse()
|
||||
|
||||
for t in tokens:
|
||||
for t in rev_tokens:
|
||||
if t.type == ctoken.TokenType.variable:
|
||||
variables[t.value] = expression.Variable(t.value, expression.Variable.get_variable_type(t.value))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user