Exemple #1
0
        static public List <AnalysisRule> GetFunctionParameters(Rule_Context context, Token token)
        {
            List <AnalysisRule> result = new List <AnalysisRule>();

            if (token is NonterminalToken)
            {
                NonterminalToken nonterminal = (NonterminalToken)token;

                switch (nonterminal.Symbol.ToString())
                {
                case "<NonEmptyFunctionParameterList>":
                    result.AddRange(AnalysisRule.GetFunctionParameters(context, nonterminal));
                    break;

                case "<SingleFunctionParameterList>":
                    result.AddRange(AnalysisRule.GetFunctionParameters(context, nonterminal));
                    break;

                case "<EmptyFunctionParameterList>":
                    break;

                case "<MultipleFunctionParameterList>":
                    result.AddRange(AnalysisRule.GetFunctionParameters(context, nonterminal.Tokens[0]));
                    result.Add(AnalysisRule.BuildStatments(context, nonterminal.Tokens[2]));
                    break;

                case "<FuncName2>":
                case "<Expression>":
                case "<expression>":
                case "<FunctionCall>":
                default:
                    result.Add(AnalysisRule.BuildStatments(context, nonterminal));
                    break;
                }
            }
            else
            {
                TerminalToken terminal = (TerminalToken)token;
                if (terminal.Text != ",")
                {
                    result.Add(new Rule_Value(context, token));
                }
            }

            return(result);
        }