Exemplo n.º 1
0
 public override Choice GetLL1EBNFBlock(GrammarAST ebnfRoot, IList<CodeBlockForAlt> alts)
 {
     int ebnf = 0;
     if (ebnfRoot != null)
         ebnf = ebnfRoot.Type;
     Choice c = null;
     switch (ebnf)
     {
     case ANTLRParser.OPTIONAL:
         if (alts.Count == 1)
             c = new LL1OptionalBlockSingleAlt(this, ebnfRoot, alts);
         else
             c = new LL1OptionalBlock(this, ebnfRoot, alts);
         break;
     case ANTLRParser.CLOSURE:
         if (alts.Count == 1)
             c = new LL1StarBlockSingleAlt(this, ebnfRoot, alts);
         else
             c = GetComplexEBNFBlock(ebnfRoot, alts);
         break;
     case ANTLRParser.POSITIVE_CLOSURE:
         if (alts.Count == 1)
             c = new LL1PlusBlockSingleAlt(this, ebnfRoot, alts);
         else
             c = GetComplexEBNFBlock(ebnfRoot, alts);
         break;
     }
     return c;
 }