Exemplo n.º 1
0
 /// <summary>
 /// 2 &lt;PList&gt; ::= &lt;Vn&gt; "::=" &lt;VList&gt; ";" &lt;PList&gt;;
 /// <para>3 &lt;PList&gt; ::= null;</para>
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="syntaxTree"></param>
 private static void GetFormattedPList(StringBuilder builder, SyntaxTree <EnumTokenTypeCG, EnumVTypeCG, TreeNodeValueCG> syntaxTree)
 {//<PList> ::= <Vn> "::=" <VList> ";" <PList> | null; 2 3
     if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_PList___tail_lessThan_Leave())
     {
         GetFormattedVn(builder, syntaxTree.Children[0]);
         builder.Append(" ");
         GetFormattedpointToLeave(builder, syntaxTree.Children[1]);
         builder.Append(" ");
         GetFormattedVList(builder, syntaxTree.Children[2]);
         GetFormattedsemicolonLeave(builder, syntaxTree.Children[3]);
         builder.AppendLine();
         GetFormattedPList(builder, syntaxTree.Children[4]);
     }
     else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_PList___tail_startEndLeave())
     {
         // nothing to do
         //GetFormattednull(builder, syntaxTree.Children[0]);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 2 &lt;PList&gt; ::= &lt;Vn&gt; "::=" &lt;VList&gt; ";" &lt;PList&gt;;
        /// <para>3 &lt;PList&gt; ::= null;</para>
        /// </summary>
        /// <param name="plist"></param>
        /// <param name="syntaxTree"></param>
        private static void GetGrammarPList(
            ContextfreeProductionList plist, SyntaxTree <EnumTokenTypeCG, EnumVTypeCG, TreeNodeValueCG> syntaxTree)
        {//<PList> ::= <Vn> "::=" <VList> ";" <PList> | null; 2 3
            if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_PList___tail_lessThan_Leave())
            {
                ContextfreeProduction production = new ContextfreeProduction();
                plist.Add(production);

                var vn = GetGrammarVn(syntaxTree.Children[0]);
                production.Left = vn;

                var vlist = GetGrammarVList(syntaxTree.Children[2]);
                production.RightCollection = vlist;

                GetGrammarPList(plist, syntaxTree.Children[4]);
            }
            else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_PList___tail_startEndLeave())
            {
                // nothing to do
                //GetGrammarnull(syntaxTree.Children[0]);
            }
        }