Package org.antlr.v4.automata
Class LexerATNFactory
java.lang.Object
org.antlr.v4.automata.ParserATNFactory
org.antlr.v4.automata.LexerATNFactory
- All Implemented Interfaces:
ATNFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.antlr.v4.automata.ATNFactory
ATNFactory.Handle
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map
<LexerAction, Integer> Maps from aLexerAction
object to the action index.org.stringtemplate.v4.STGroup
Provides a map of names of predefined constants which are likely to appear as the argument for lexer commands.protected Map
<Integer, LexerAction> Maps from an action index to aLexerAction
object.Fields inherited from class org.antlr.v4.automata.ParserATNFactory
atn, currentOuterAlt, currentRule, g, preventEpsilonClosureBlocks, preventEpsilonOptionalBlocks
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuild what amounts to an epsilon transition with an action.protected ATNFactory.Handle
action
(GrammarAST node, LexerAction lexerAction) charSetLiteral
(GrammarAST charSetAST) [Aa\t ሴa-z\]\p{Letter}\-] char setsprotected boolean
checkRange
(GrammarAST leftNode, GrammarAST rightNode, int leftValue, int rightValue) protected void
checkSetCollision
(GrammarAST ast, IntervalSet set, int el) protected void
checkSetCollision
(GrammarAST ast, IntervalSet set, int a, int b) protected int
getLexerActionIndex
(LexerAction lexerAction) getSetFromCharSetLiteral
(GrammarAST charSetAST) lexerAltCommands
(ATNFactory.Handle alt, ATNFactory.Handle cmds) lexerCallCommand
(GrammarAST ID, GrammarAST arg) range
(GrammarAST a, GrammarAST b) Not valid for non-lexers.rule
(GrammarAST ruleAST, String name, ATNFactory.Handle blk) set
(GrammarAST associatedAST, List<GrammarAST> alts, boolean invert) From set build single edge grapho->o-set->o
.stringLiteral
(TerminalAST stringLiteralAST) For a lexer, a string is a sequence of char to match.tokenRef
(TerminalAST node) From labelA
build grapho-A->o
.Methods inherited from class org.antlr.v4.automata.ParserATNFactory
_createATN, _ruleRef, addEOFTransitionToStartRules, addFollowLink, addRuleFollowLinks, alt, block, blockHasWildcardAlt, elemList, epsilon, epsilon, epsilon, expectNonGreedy, getTokenType, label, listLabel, makeBlock, newState, newState, newState, optional, plus, ruleRef, sempred, setCurrentOuterAlt, setCurrentRuleName, star, wildcard
-
Field Details
-
codegenTemplates
public org.stringtemplate.v4.STGroup codegenTemplates -
COMMON_CONSTANTS
Provides a map of names of predefined constants which are likely to appear as the argument for lexer commands. These names would be resolved by the Java compiler for lexer commands that are translated to embedded actions, but are required during code generation for creatingLexerAction
instances that are usable by a lexer interpreter. -
indexToActionMap
Maps from an action index to aLexerAction
object. -
actionToIndexMap
Maps from aLexerAction
object to the action index.
-
-
Constructor Details
-
LexerATNFactory
-
-
Method Details
-
getCommonConstants
-
createATN
- Specified by:
createATN
in interfaceATNFactory
- Overrides:
createATN
in classParserATNFactory
-
rule
- Specified by:
rule
in interfaceATNFactory
- Overrides:
rule
in classParserATNFactory
-
action
Description copied from class:ParserATNFactory
Build what amounts to an epsilon transition with an action. The action goes into ATN though it is ignored during prediction ifactionIndex
<0
.- Specified by:
action
in interfaceATNFactory
- Overrides:
action
in classParserATNFactory
-
getLexerActionIndex
-
action
- Specified by:
action
in interfaceATNFactory
- Overrides:
action
in classParserATNFactory
-
action
-
lexerAltCommands
- Specified by:
lexerAltCommands
in interfaceATNFactory
- Overrides:
lexerAltCommands
in classParserATNFactory
-
lexerCallCommand
- Specified by:
lexerCallCommand
in interfaceATNFactory
- Overrides:
lexerCallCommand
in classParserATNFactory
-
lexerCommand
- Specified by:
lexerCommand
in interfaceATNFactory
- Overrides:
lexerCommand
in classParserATNFactory
-
range
Description copied from class:ParserATNFactory
Not valid for non-lexers.- Specified by:
range
in interfaceATNFactory
- Overrides:
range
in classParserATNFactory
-
set
Description copied from class:ParserATNFactory
From set build single edge grapho->o-set->o
. To conform to what an alt block looks like, must have extra state on left. This also handles~A
, converted to~{A}
set.- Specified by:
set
in interfaceATNFactory
- Overrides:
set
in classParserATNFactory
-
checkRange
protected boolean checkRange(GrammarAST leftNode, GrammarAST rightNode, int leftValue, int rightValue) -
stringLiteral
For a lexer, a string is a sequence of char to match. That is, "fog" is treated as 'f' 'o' 'g' not as a single transition in the DFA. Machine== o-'f'->o-'o'->o-'g'->o and has n+1 states for n characters.- Specified by:
stringLiteral
in interfaceATNFactory
- Overrides:
stringLiteral
in classParserATNFactory
-
charSetLiteral
[Aa\t ሴa-z\]\p{Letter}\-] char sets- Specified by:
charSetLiteral
in interfaceATNFactory
- Overrides:
charSetLiteral
in classParserATNFactory
-
getSetFromCharSetLiteral
-
checkSetCollision
-
checkSetCollision
-
tokenRef
Description copied from class:ParserATNFactory
From labelA
build grapho-A->o
.- Specified by:
tokenRef
in interfaceATNFactory
- Overrides:
tokenRef
in classParserATNFactory
-