public static Expression Create(Token token) { switch (token.Type) { case Tokens.SYMBOL: return new SymbolExpression(token); case Tokens.INT: return new IntExpression(token); case Tokens.STRING: return new StringExpression(token); default: return new Expression(token); } }
public Expression(Token token) { Token = token; Elements = new List<Expression>(); }
public StringExpression(Token t) : base(t) { Value = Token.Text.Substring(1, Token.Text.Length - 2); }
public SymbolExpression(Token token) : base(token) { Value = token.Text; }
public IntExpression(Token t) : base(t) { Value = Int32.Parse(Token.Text); }