private void AcceptEvent(LALRParser parser, AcceptEventArgs args) { NonterminalToken nonterminalToken = (NonterminalToken)args.Token; RuleContext.EnterCheckCodeInterface = this.EnterCheckCodeInterface; RuleContext.ClearState(); EnterRule program = EnterRule.BuildStatments(RuleContext, nonterminalToken); program.Execute(); if (RuleContext.IsVariableValidationEnable) { RuleContext.CheckCommandVariables(); } }
private void AcceptEvent(LALRParser parser, AcceptEventArgs args) { //System.Console.WriteLine("AcceptEvent "); NonterminalToken T = (NonterminalToken)args.Token; /* * try * { * Configuration.Load(Configuration.DefaultConfigurationPath); * this.Context.module = new MemoryRegion(); * } * catch (System.Exception ex) * { * Configuration.CreateDefaultConfiguration(); * Configuration.Load(Configuration.DefaultConfigurationPath); * this.Context.module = new MemoryRegion(); * }*/ mContext.EnterCheckCodeInterface = this.EnterCheckCodeInterface; mContext.ClearState(); EnterRule program = EnterRule.BuildStatments(mContext, T); program.Execute(); mContext.CheckAssignedVariables(); /* * if (this.IsExecuteMode && this.host.IsExecutionEnabled) * { * program.Execute(); * } * * if (mContext.DefineVariablesCheckcode != null) * { * * }*/ //this.ProgramStart //this.ProgramStart.Execute(); }
static public List <EnterRule> GetFunctionParameters(Rule_Context pContext, Token pToken) { List <EnterRule> result = new List <EnterRule>(); if (pToken is NonterminalToken) { NonterminalToken NT = (NonterminalToken)pToken; switch (NT.Symbol.ToString()) { case "<NonEmptyFunctionParameterList>": //this.paramList.Push(new Rule_NonEmptyFunctionParameterList(T, this.paramList)); result.AddRange(EnterRule.GetFunctionParameters(pContext, NT)); break; case "<SingleFunctionParameterList>": result.AddRange(EnterRule.GetFunctionParameters(pContext, NT)); break; case "<EmptyFunctionParameterList>": //this.paramList = new Rule_EmptyFunctionParameterList(T); // do nothing the parameterlist is empty break; case "<MultipleFunctionParameterList>": //this.MultipleParameterList = new Rule_MultipleFunctionParameterList(pToken); //<NonEmptyFunctionParameterList> ',' <Expression> //result.Add(AnalysisRule.BuildStatments(pContext, NT.Tokens[0])); result.AddRange(EnterRule.GetFunctionParameters(pContext, NT.Tokens[0])); result.Add(EnterRule.BuildStatments(pContext, NT.Tokens[2])); break; case "<FuncName2>": case "<Expression>": case "<expression>": case "<FunctionCall>": default: result.Add(EnterRule.BuildStatments(pContext, NT)); break; } } else { TerminalToken TT = (TerminalToken)pToken; if (TT.Text != ",") { result.Add(new Rule_Value(pContext, pToken)); } } /* * <FunctionCall> ::= Identifier '(' <FunctionParameterList> ')' | FORMAT '(' <FunctionParameterList> ')' | <FuncName2> | ! | <FuncName1> '(' <FunctionCall> ')' | <FunctionParameterList> ::= <EmptyFunctionParameterList> | <NonEmptyFunctionParameterList> | <NonEmptyFunctionParameterList> ::= <MultipleFunctionParameterList> | <SingleFunctionParameterList> | | <MultipleFunctionParameterList> ::= <NonEmptyFunctionParameterList> ',' <Expression> | <SingleFunctionParameterList> ::= <expression> | <EmptyFunctionParameterList> ::= */ /* * foreach (Token T in pToken.Tokens) * { * if (T is NonterminalToken) * { * * NonterminalToken NT = (NonterminalToken)T; * * switch (NT.Rule.Lhs.ToString()) * { * case "<NonEmptyFunctionParameterList>": * * * //this.paramList.Push(new Rule_NonEmptyFunctionParameterList(T, this.paramList)); * result.AddRange(EnterRule.GetFunctionParameters(pContext, NT)); * break; * case "<SingleFunctionParameterList>": * * result.AddRange(EnterRule.GetFunctionParameters(pContext, NT)); * break; * case "<EmptyFunctionParameterList>": * //this.paramList = new Rule_EmptyFunctionParameterList(T); * // do nothing the parameterlist is empty * break; * case "<MultipleFunctionParameterList>": * * //this.MultipleParameterList = new Rule_MultipleFunctionParameterList(pToken); * result.AddRange(EnterRule.GetFunctionParameters(pContext, NT)); * break; * case "<FuncName2>": * case "<Expression>": * case "<expression>": * case "<FunctionCall>": * * result.Add(EnterRule.BuildStatments(pContext, NT)); * break; * default: * result.Add(new Rule_Value(pContext, T)); * break; * } * } * else * { * TerminalToken TT = (TerminalToken)T; * if (TT.Text != ",") * { * result.Add(new Rule_Value(pContext, TT)); * } * } * }*/ return(result); }