public override LuaExpression Parse(INextAwareEnumerator<Token> reader, IParserContext context) { var variableName = reader.Current.Value; var visibleVariables = context.CurrentScope.GetVisibleVariables(); Variable variable; if (!visibleVariables.ContainsKey(variableName)) { context.AddError("Undefined variable: " + variableName); variable = new Variable(variableName); } else variable = visibleVariables[variableName]; reader.MoveNext(); return new VariableExpression(variable); }
public LuaExpression Parse(INextAwareEnumerator <Token> reader, IParserContext context) { var variableName = reader.Current.Value; var visibleVariables = context.CurrentScope.GetVisibleVariables(); Variable variable; if (!visibleVariables.ContainsKey(variableName)) { context.AddError("Undefined variable: " + variableName); variable = new Variable(variableName); } else { variable = visibleVariables[variableName]; } reader.MoveNext(); return(new VariableExpression(variable)); }