Пример #1
0
        /// <summary>
        /// 11 &lt;Vt&gt; ::= "null";
        /// <para>12 &lt;Vt&gt; ::= "identifier";</para>
        /// <para>13 &lt;Vt&gt; ::= "number";</para>
        /// <para>14 &lt;Vt&gt; ::= "constString";</para>
        /// <para>15 &lt;Vt&gt; ::= identifier;</para>
        /// <para>16 &lt;Vt&gt; ::= number;</para>
        /// <para>17 &lt;Vt&gt; ::= constString;</para>
        /// </summary>
        /// <param name="syntaxTree"></param>
        private static ProductionNode GetGrammarVt(SyntaxTree <EnumTokenTypeCG, EnumVTypeCG, TreeNodeValueCG> syntaxTree)
        {//<Vt> ::= "null" | "identifier" | "number" | "constString" | identifier | number | constString; // 11 12 13 14 15 16 17
            ProductionNode result = null;

            if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_nullLeave())
            {
                result = ProductionNode.tail_null;
            }
            else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_identifierLeave())
            {
                result = ProductionNode.tail_identifier;
            }
            else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_numberLeave())
            {
                result = ProductionNode.tail_number;
            }
            else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_constStringLeave())
            {
                result = ProductionNode.tail_constString;
            }
            else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___constStringLeave())
            {
                var name = GetGrammarconstString(syntaxTree.Children[0]);
                result = new ProductionNode(name, name, EnumProductionNodePosition.Leave);
            }

            return(result);
        }
Пример #2
0
 /// <summary>
 /// 11 &lt;Vt&gt; ::= "null";
 /// <para>12 &lt;Vt&gt; ::= "identifier";</para>
 /// <para>13 &lt;Vt&gt; ::= "number";</para>
 /// <para>14 &lt;Vt&gt; ::= "constString";</para>
 /// <para>15 &lt;Vt&gt; ::= constString;</para>
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="syntaxTree"></param>
 private static void GetFormattedVt(StringBuilder builder, SyntaxTree <EnumTokenTypeCG, EnumVTypeCG, TreeNodeValueCG> syntaxTree)
 {//<Vt> ::= "null" | "identifier" | "number" | "constString" | constString; // 11 12 13 14 15
     if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_nullLeave())
     {
         builder.Append(ProductionNode.tail_null.NodeName);
         //GetFormattednull(builder, syntaxTree.Children[0]);
     }
     else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_identifierLeave())
     {
         builder.Append(ProductionNode.tail_identifier.NodeName);
         //GetFormattedidentifierLeave(builder, syntaxTree.Children[0]);
     }
     else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_numberLeave())
     {
         builder.Append(ProductionNode.tail_number.NodeName);
         //GetFormattednumberLeave(builder, syntaxTree.Children[0]);
     }
     else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___tail_constStringLeave())
     {
         builder.Append(ProductionNode.tail_constString.NodeName);
         //GetFormattedconstString(builder, syntaxTree.Children[0]);
     }
     else if (syntaxTree.CandidateFunc == LL1SyntaxParserCG.GetFuncParsecase_Vt___constStringLeave())
     {
         GetFormattedconstString(builder, syntaxTree.Children[0]);
     }
 }