public override Expression Scan(ParseEngine engine) { var index = engine.Pointer; var chars = engine.Characters; if (ParseEngine.IsIdentifierStart(chars[index])) { index++; while (index < chars.Length && ParseEngine.IsIdentifierPart(chars[index])) { index++; } var name = new String(chars, engine.Pointer, index - engine.Pointer); if (engine.UseKeywords) { var keyword = engine.Elements.FindKeywordExpression(name, engine); if (keyword != null) { return(keyword); } } var exp = new SymbolExpression(engine, name); engine.SetPointer(index); return(exp); } return(null); }
Value Assign(SymbolExpression left, Value value, IDictionary <String, Value> symbols) { if (symbols.ContainsKey(left.SymbolName)) { symbols[left.SymbolName] = value.Copy(); } else { Context.AssignVariable(left.SymbolName, value.Copy()); } return(value); }
public static Boolean IsAssigned(this ContainerExpression container, SymbolExpression symbol) { var expressions = container.Expressions; if (expressions.Length > 0) { var leftExpression = expressions[0]; container = leftExpression as ContainerExpression; if (container != null) { return(container.IsAssigned(symbol)); } return(Object.ReferenceEquals(leftExpression, symbol)); } return(false); }