use of org.antlr.v4.codegen.model.Wildcard in project antlr4 by antlr.
the class ParserATNFactory method wildcard.
/**
* Build an atom with all possible values in its label.
*/
@Override
public Handle wildcard(GrammarAST node) {
ATNState left = newState(node);
ATNState right = newState(node);
left.addTransition(new WildcardTransition(right));
node.atnState = left;
return new Handle(left, right);
}
use of org.antlr.v4.codegen.model.Wildcard in project antlr4 by antlr.
the class ParserFactory method wildcard.
@Override
public List<SrcOp> wildcard(GrammarAST ast, GrammarAST labelAST) {
Wildcard wild = new Wildcard(this, ast);
// TODO: dup with tokenRef
if (labelAST != null) {
String label = labelAST.getText();
Decl d = getTokenLabelDecl(label);
wild.labels.add(d);
getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d);
if (labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN) {
TokenListDecl l = getTokenListLabelDecl(label);
getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), l);
}
}
if (controller.needsImplicitLabel(ast, wild))
defineImplicitLabel(ast, wild);
AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(wild, labelAST);
return list(wild, listLabelOp);
}
Aggregations