Search in sources :

Example 1 with OptionalBlock

use of org.antlr.v4.codegen.model.OptionalBlock in project antlr4 by antlr.

the class ParserFactory method getComplexEBNFBlock.

@Override
public Choice getComplexEBNFBlock(GrammarAST ebnfRoot, List<CodeBlockForAlt> alts) {
    int ebnf = 0;
    if (ebnfRoot != null)
        ebnf = ebnfRoot.getType();
    Choice c = null;
    switch(ebnf) {
        case ANTLRParser.OPTIONAL:
            c = new OptionalBlock(this, ebnfRoot, alts);
            break;
        case ANTLRParser.CLOSURE:
            c = new StarBlock(this, ebnfRoot, alts);
            break;
        case ANTLRParser.POSITIVE_CLOSURE:
            c = new PlusBlock(this, ebnfRoot, alts);
            break;
    }
    return c;
}
Also used : Choice(org.antlr.v4.codegen.model.Choice) StarBlock(org.antlr.v4.codegen.model.StarBlock) LL1OptionalBlock(org.antlr.v4.codegen.model.LL1OptionalBlock) OptionalBlock(org.antlr.v4.codegen.model.OptionalBlock) PlusBlock(org.antlr.v4.codegen.model.PlusBlock)

Aggregations

Choice (org.antlr.v4.codegen.model.Choice)1 LL1OptionalBlock (org.antlr.v4.codegen.model.LL1OptionalBlock)1 OptionalBlock (org.antlr.v4.codegen.model.OptionalBlock)1 PlusBlock (org.antlr.v4.codegen.model.PlusBlock)1 StarBlock (org.antlr.v4.codegen.model.StarBlock)1