/// <summary> /// Interpret ListExpression /// </summary> /// <param name="expression">ListExpression to interpret</param> public override void Visit(ListExpression expression) { //Convert list to textvalue String tempList = "["; for (int i = 0; i < expression.GetExpressions().Count; i++) { Expression currentExpression = (Expression)expression.GetExpressions().Get(i); //Store Text and SymExpressions between " to see , as real separator if (currentExpression is TextExpression || currentExpression is SymExpression) { tempList += "\""; } //Store value in tempList currentExpression.AcceptVisitor(this); tempList += TextValue; if (currentExpression is TextExpression || currentExpression is SymExpression) { tempList += "\""; } //Add , seperator if (i != (expression.GetExpressions().Count - 1)) { tempList += ","; } } tempList += "]"; TextValue = tempList; }
/// <summary> /// Interpret FieldExpression /// </summary> /// <param name="expression">FieldExpression to interpret</param> public override void Visit(FieldExpression expression) { //Retrieve expression of field Expression expr = GetExpression(expression); if (expr != null) { expr.AcceptVisitor(this); } else { TextValue = "undef"; } }
/// <summary> /// Interpret VarExpression /// </summary> /// <param name="expression">VarExpression to interpret</param> public override void Visit(VarExpression expression) { //Check if variable does exist String varName = expression.GetVariableIdentifier(); Expression check = SymbolTable.GetVariableDefinition(varName); //If reference has been made to parent variable with same name, take parent reference if (check == expression && SymbolTable.GetParentSymbolTable() != null) { check = SymbolTable.GetParentSymbolTable().GetVariableDefinition(varName); } if (check != null) { //Visit variable to retrieve current value check.AcceptVisitor(this); } else { TextValue = "undef"; } }