Пример #1
0
 protected virtual object EvalParam(ParseTree tree, params object[] paramlist)
 {
     throw new NotImplementedException();
 }
Пример #2
0
 protected virtual object EvalVariablesDefinitions(ParseTree tree, params object[] paramlist)
 {
     throw new NotImplementedException();
 }
Пример #3
0
 protected virtual object EvalConstructorPrefix(ParseTree tree, params object[] paramlist)
 {
     throw new NotImplementedException();
 }
Пример #4
0
 protected virtual object EvalStart(ParseTree tree, params object[] paramlist)
 {
     return("Could not interpret input; no semantics implemented.");
 }
Пример #5
0
        /// <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.UseDirective:
                Value = EvalUseDirective(tree, paramlist);
                break;

            case TokenType.ClassDirective:
                Value = EvalClassDirective(tree, paramlist);
                break;

            case TokenType.BaseDirective:
                Value = EvalBaseDirective(tree, paramlist);
                break;

            case TokenType.OptionsDirective:
                Value = EvalOptionsDirective(tree, paramlist);
                break;

            case TokenType.Variable:
                Value = EvalVariable(tree, paramlist);
                break;

            case TokenType.FieldName:
                Value = EvalFieldName(tree, paramlist);
                break;

            case TokenType.Literal:
                Value = EvalLiteral(tree, paramlist);
                break;

            case TokenType.FunctionDefinition:
                Value = EvalFunctionDefinition(tree, paramlist);
                break;

            case TokenType.FunctionName:
                Value = EvalFunctionName(tree, paramlist);
                break;

            case TokenType.LocalVariables:
                Value = EvalLocalVariables(tree, paramlist);
                break;

            case TokenType.Body:
                Value = EvalBody(tree, paramlist);
                break;

            case TokenType.Call:
                Value = EvalCall(tree, paramlist);
                break;

            case TokenType.Function:
                Value = EvalFunction(tree, paramlist);
                break;

            case TokenType.FullFunctionName:
                Value = EvalFullFunctionName(tree, paramlist);
                break;

            case TokenType.StaticPrefix:
                Value = EvalStaticPrefix(tree, paramlist);
                break;

            case TokenType.InstancePrefix:
                Value = EvalInstancePrefix(tree, paramlist);
                break;

            case TokenType.ConstructorPrefix:
                Value = EvalConstructorPrefix(tree, paramlist);
                break;

            case TokenType.EvalConstruct:
                Value = EvalEvalConstruct(tree, paramlist);
                break;

            case TokenType.EvalBody:
                Value = EvalEvalBody(tree, paramlist);
                break;

            case TokenType.FormatString:
                Value = EvalFormatString(tree, paramlist);
                break;

            case TokenType.WhileCycle:
                Value = EvalWhileCycle(tree, paramlist);
                break;

            case TokenType.WhileCondition:
                Value = EvalWhileCondition(tree, paramlist);
                break;

            case TokenType.WhileBody:
                Value = EvalWhileBody(tree, paramlist);
                break;

            case TokenType.CycleSeparator:
                Value = EvalCycleSeparator(tree, paramlist);
                break;

            case TokenType.BoolCondition:
                Value = EvalBoolCondition(tree, paramlist);
                break;

            case TokenType.ForCycle:
                Value = EvalForCycle(tree, paramlist);
                break;

            case TokenType.ForCounter:
                Value = EvalForCounter(tree, paramlist);
                break;

            case TokenType.ForFrom:
                Value = EvalForFrom(tree, paramlist);
                break;

            case TokenType.ForTo:
                Value = EvalForTo(tree, paramlist);
                break;

            case TokenType.ForBody:
                Value = EvalForBody(tree, paramlist);
                break;

            case TokenType.IfCondition:
                Value = EvalIfCondition(tree, paramlist);
                break;

            case TokenType.IfTrueBranch:
                Value = EvalIfTrueBranch(tree, paramlist);
                break;

            case TokenType.IfFalseBranch:
                Value = EvalIfFalseBranch(tree, paramlist);
                break;

            case TokenType.Assignment:
                Value = EvalAssignment(tree, paramlist);
                break;

            case TokenType.AssignmentBody:
                Value = EvalAssignmentBody(tree, paramlist);
                break;

            case TokenType.MathOp:
                Value = EvalMathOp(tree, paramlist);
                break;

            case TokenType.HashAssignment:
                Value = EvalHashAssignment(tree, paramlist);
                break;

            case TokenType.Key:
                Value = EvalKey(tree, paramlist);
                break;

            case TokenType.VariablesDefinitions:
                Value = EvalVariablesDefinitions(tree, paramlist);
                break;

            case TokenType.ParamsDefinitions:
                Value = EvalParamsDefinitions(tree, paramlist);
                break;

            case TokenType.Params:
                Value = EvalParams(tree, paramlist);
                break;

            case TokenType.Param:
                Value = EvalParam(tree, paramlist);
                break;

            default:
                Value = Token.Text;
                break;
            }
            return(Value);
        }
Пример #6
0
 protected object GetValue(ParseTree tree, TokenType type, int index)
 {
     return(GetValue(tree, type, ref index));
 }