private dynamic ExpressStatement(List <string> tokens, Value.Value_Type valueType, bool fromVariable = true) { dynamic value; switch (valueType) { case Value.Value_Type.Double: value = valueHanlder.ParseDoubleExpression(tokens, fromVariable); break; case Value.Value_Type.Float: value = valueHanlder.ParseFloatExpression(tokens, fromVariable); break; case Value.Value_Type.Int: value = valueHanlder.ParseIntExpression(tokens, fromVariable); break; case Value.Value_Type.Long: value = valueHanlder.ParseLongExpression(tokens, fromVariable); break; case Value.Value_Type.Bool: value = valueHanlder.ParseBoolExpression(tokens, fromVariable); //To be implemented (Bool) break; case Value.Value_Type.String: value = valueHanlder.ParseStringExpression(tokens, fromVariable); break; case Value.Value_Type.Other: //Throw exception //To be implemented value = null; break; default: //Throw exception //To be implemented value = null; break; } return(value); }
private void SetupNormalVariable(Statement statement, string variableName, Value.Value_Type valueType, bool isPublic) { dynamic value = ExpressStatement(statement.tokens, valueType); if (isPublic) { GlobalVariables.AddVariable(variableName, value, valueType); } else if (OuterVariables != null && OuterVariables.IsVariable(variableName)) { OuterVariables.AddVariable(variableName, value, valueType); } else { InnerVariables.AddVariable(variableName, value, valueType); } }
public void AddVariable(string name, dynamic value, Value.Value_Type valueType) { var v = new Variable(new Value(value, valueType)); AddVariable(name, v); }