protected virtual object EvalStringLiteral(ParseTree tree, params object[] paramlist) { throw new NotImplementedException(); }
protected virtual object EvalExpression(ParseTree tree, params object[] paramlist) { throw new NotImplementedException(); }
/// <summary> /// this implements the evaluation functionality, cannot be used directly /// </summary> /// <param name="tree">the parsetree itself</param> /// <param name="paramlist">optional input parameters</param> /// <returns>a partial result of the evaluation</returns> internal object Eval(ParseTree tree, params object[] paramlist) { object Value = null; switch (Token.Type) { case TokenType.Start: Value = EvalStart(tree, paramlist); break; case TokenType.UnaryExpression: Value = EvalUnaryExpression(tree, paramlist); break; case TokenType.Function: Value = EvalFunction(tree, paramlist); break; case TokenType.PrimaryExpression: Value = EvalPrimaryExpression(tree, paramlist); break; case TokenType.ParenthesizedExpression: Value = EvalParenthesizedExpression(tree, paramlist); break; case TokenType.PowerExpression: Value = EvalPowerExpression(tree, paramlist); break; case TokenType.MultiplicativeExpression: Value = EvalMultiplicativeExpression(tree, paramlist); break; case TokenType.AdditiveExpression: Value = EvalAdditiveExpression(tree, paramlist); break; case TokenType.ConcatEpression: Value = EvalConcatEpression(tree, paramlist); break; case TokenType.RelationalExpression: Value = EvalRelationalExpression(tree, paramlist); break; case TokenType.EqualityExpression: Value = EvalEqualityExpression(tree, paramlist); break; case TokenType.ConditionalAndExpression: Value = EvalConditionalAndExpression(tree, paramlist); break; case TokenType.ConditionalOrExpression: Value = EvalConditionalOrExpression(tree, paramlist); break; case TokenType.Expression: Value = EvalExpression(tree, paramlist); break; case TokenType.Params: Value = EvalParams(tree, paramlist); break; case TokenType.Literal: Value = EvalLiteral(tree, paramlist); break; case TokenType.IntegerLiteral: Value = EvalIntegerLiteral(tree, paramlist); break; case TokenType.RealLiteral: Value = EvalRealLiteral(tree, paramlist); break; case TokenType.StringLiteral: Value = EvalStringLiteral(tree, paramlist); break; default: Value = Token.Text; break; } return(Value); }
protected virtual object EvalStart(ParseTree tree, params object[] paramlist) { return("Could not interpret input; no semantics implemented."); }
protected object GetValue(ParseTree tree, TokenType type, int index) { return(GetValue(tree, type, ref index)); }