Search in sources :

Example 6 with TokenRef

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

the class ParserATNFactory method tokenRef.

/** From label {@code A} build graph {@code o-A->o}. */
@Override
public Handle tokenRef(TerminalAST node) {
    ATNState left = newState(node);
    ATNState right = newState(node);
    int ttype = g.getTokenType(node.getText());
    left.addTransition(new AtomTransition(right, ttype));
    node.atnState = left;
    return new Handle(left, right);
}
Also used : AtomTransition(org.antlr.v4.runtime.atn.AtomTransition) ATNState(org.antlr.v4.runtime.atn.ATNState)

Aggregations

AddToLabelList (org.antlr.v4.codegen.model.AddToLabelList)2 Decl (org.antlr.v4.codegen.model.decl.Decl)2 RuleContextDecl (org.antlr.v4.codegen.model.decl.RuleContextDecl)2 TokenDecl (org.antlr.v4.codegen.model.decl.TokenDecl)2 TokenListDecl (org.antlr.v4.codegen.model.decl.TokenListDecl)2 ATNState (org.antlr.v4.runtime.atn.ATNState)2 AtomTransition (org.antlr.v4.runtime.atn.AtomTransition)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 LeftRecursiveRuleFunction (org.antlr.v4.codegen.model.LeftRecursiveRuleFunction)1 MatchToken (org.antlr.v4.codegen.model.MatchToken)1 RuleFunction (org.antlr.v4.codegen.model.RuleFunction)1 Wildcard (org.antlr.v4.codegen.model.Wildcard)1 ArgRef (org.antlr.v4.codegen.model.chunk.ArgRef)1 LabelRef (org.antlr.v4.codegen.model.chunk.LabelRef)1 ListLabelRef (org.antlr.v4.codegen.model.chunk.ListLabelRef)1 LocalRef (org.antlr.v4.codegen.model.chunk.LocalRef)1 QRetValueRef (org.antlr.v4.codegen.model.chunk.QRetValueRef)1 RetValueRef (org.antlr.v4.codegen.model.chunk.RetValueRef)1