Exemplo n.º 1
0
 /// <summary>
 /// 5 &lt;V&gt; ::= &lt;Vn&gt;;
 /// <para>6 &lt;V&gt; ::= &lt;Vt&gt;;</para>
 /// <para>7 &lt;V&gt; ::= identifier;</para>
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="syntaxTree"></param>
 private static void GetFormattedV(StringBuilder builder, SyntaxTree <EnumTokenTypeCG, EnumVTypeCG, TreeNodeValueCG> syntaxTree)
 {//<V> ::= <Vn> | <Vt> | identifier; 5 6 7
     if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_lessThan_Leave())
     {
         GetFormattedVn(builder, syntaxTree.Children[0]);
     }
     else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___constStringLeave() ||
              syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_constStringLeave() ||
              syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_identifierLeave() ||
              syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_nullLeave() ||
              syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_numberLeave())
     {
         GetFormattedVt(builder, syntaxTree.Children[0]);
     }
     else
     {
         builder.Append(string.Format("error: {0} not matching [{1}] or [{2}] or [{3}] or [{4}] or [{5}] or [{6}]",
                                      syntaxTree.Children[0].CandidateFunc,
                                      LL1SyntaxParserCG.GetFuncParsecase_V___tail_lessThan_Leave(),
                                      LL1SyntaxParserCG.GetFuncParsecase_V___constStringLeave(),
                                      LL1SyntaxParserCG.GetFuncParsecase_V___tail_constStringLeave(),
                                      LL1SyntaxParserCG.GetFuncParsecase_V___tail_identifierLeave(),
                                      LL1SyntaxParserCG.GetFuncParsecase_V___tail_nullLeave(),
                                      LL1SyntaxParserCG.GetFuncParsecase_V___tail_numberLeave()));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 5 &lt;V&gt; ::= &lt;Vn&gt;;
        /// <para>6 &lt;V&gt; ::= &lt;Vt&gt;;</para>
        /// <para>7 &lt;V&gt; ::= identifier;</para>
        /// </summary>
        /// <param name="syntaxTree"></param>
        private static ProductionNode GetGrammarV(SyntaxTree <EnumTokenTypeCG, EnumVTypeCG, TreeNodeValueCG> syntaxTree)
        {//<V> ::= <Vn> | <Vt>; 5 6
            ProductionNode result = null;

            if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_lessThan_Leave())
            {
                result = GetGrammarVn(syntaxTree.Children[0]);
            }
            else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___constStringLeave() ||
                     syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_constStringLeave() ||
                     syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_identifierLeave() ||
                     syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_nullLeave() ||
                     syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_V___tail_numberLeave())
            {
                result = GetGrammarVt(syntaxTree.Children[0]);
            }
            else
            {
                result = new ProductionNode(EnumVTypeCG.case_V.ToString(), EnumVTypeCG.case_V.ToString(), EnumProductionNodePosition.Unknown);
            }
            return(result);
        }