Class LexerATNFactory
java.lang.Object
org.antlr.v4.automata.ParserATNFactory
org.antlr.v4.automata.LexerATNFactory
- All Implemented Interfaces:
ATNFactory
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface ATNFactory
ATNFactory.Handle -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<LexerAction, Integer> Maps from aLexerActionobject to the action index.org.stringtemplate.v4.STGroupProvides 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 aLexerActionobject.Fields inherited from class 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.Handleaction(GrammarAST node, LexerAction lexerAction) private voidapplyPrevState(GrammarAST charSetAST, IntervalSet set, LexerATNFactory.CharSetParseState state) applyPrevStateAndMoveToCodePoint(GrammarAST charSetAST, IntervalSet set, LexerATNFactory.CharSetParseState state, int codePoint) applyPrevStateAndMoveToProperty(GrammarAST charSetAST, IntervalSet set, LexerATNFactory.CharSetParseState state, IntervalSet property) charSetLiteral(GrammarAST charSetAST) [Aa\t ሴa-z\]\p{Letter}\-] char setsprivate voidcheckCharAndAddToSet(GrammarAST ast, IntervalSet set, int c) private voidcheckCommands(String command, org.antlr.runtime.Token commandToken) protected booleancheckRange(GrammarAST leftNode, GrammarAST rightNode, int leftValue, int rightValue) private voidcheckRangeAndAddToSet(GrammarAST mainAst, IntervalSet set, int a, int b) private CharactersDataCheckStatuscheckRangeAndAddToSet(GrammarAST rootAst, GrammarAST ast, IntervalSet set, int a, int b, boolean caseInsensitive, CharactersDataCheckStatus previousStatus) private LexerActioncreateLexerAction(GrammarAST ID, GrammarAST arg) private TransitioncreateTransition(ATNState target, int from, int to, org.antlr.runtime.tree.CommonTree tree) private IntegergetChannelConstantValue(String channelName, org.antlr.runtime.Token token) protected intgetLexerActionIndex(LexerAction lexerAction) private IntegergetModeConstantValue(String modeName, org.antlr.runtime.Token token) getSetFromCharSetLiteral(GrammarAST charSetAST) private IntegergetTokenConstantValue(String tokenName, org.antlr.runtime.Token token) lexerAltCommands(ATNFactory.Handle alt, ATNFactory.Handle cmds) lexerCallCommand(GrammarAST ID, GrammarAST arg) private ATNFactory.Handlerange(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 labelAbuild grapho-A->o.Methods inherited from class ParserATNFactory
_createATN, _ruleRef, addEOFTransitionToStartRules, addFollowLink, addRuleFollowLinks, alt, block, blockHasWildcardAlt, checkEpsilonClosure, createRuleStartAndStopATNStates, 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 creatingLexerActioninstances that are usable by a lexer interpreter. -
ruleCommands
-
indexToActionMap
Maps from an action index to aLexerActionobject. -
actionToIndexMap
Maps from aLexerActionobject to the action index.
-
-
Constructor Details
-
LexerATNFactory
-
LexerATNFactory
-
-
Method Details
-
getCommonConstants
-
createATN
- Specified by:
createATNin interfaceATNFactory- Overrides:
createATNin classParserATNFactory
-
rule
- Specified by:
rulein interfaceATNFactory- Overrides:
rulein classParserATNFactory
-
action
Description copied from class:ParserATNFactoryBuild what amounts to an epsilon transition with an action. The action goes into ATN though it is ignored during prediction ifactionIndex<0.- Specified by:
actionin interfaceATNFactory- Overrides:
actionin classParserATNFactory
-
getLexerActionIndex
-
action
- Specified by:
actionin interfaceATNFactory- Overrides:
actionin classParserATNFactory
-
action
-
lexerAltCommands
- Specified by:
lexerAltCommandsin interfaceATNFactory- Overrides:
lexerAltCommandsin classParserATNFactory
-
lexerCallCommand
- Specified by:
lexerCallCommandin interfaceATNFactory- Overrides:
lexerCallCommandin classParserATNFactory
-
lexerCommand
- Specified by:
lexerCommandin interfaceATNFactory- Overrides:
lexerCommandin classParserATNFactory
-
lexerCallCommandOrCommand
-
range
Description copied from class:ParserATNFactoryNot valid for non-lexers.- Specified by:
rangein interfaceATNFactory- Overrides:
rangein classParserATNFactory
-
set
Description copied from class:ParserATNFactoryFrom 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:
setin interfaceATNFactory- Overrides:
setin 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. if "caseInsensitive" option is enabled, "fog" will be treated as o-('f'|'F') -> o-('o'|'O') -> o-('g'|'G')- Specified by:
stringLiteralin interfaceATNFactory- Overrides:
stringLiteralin classParserATNFactory
-
charSetLiteral
[Aa\t ሴa-z\]\p{Letter}\-] char sets- Specified by:
charSetLiteralin interfaceATNFactory- Overrides:
charSetLiteralin classParserATNFactory
-
getSetFromCharSetLiteral
-
applyPrevStateAndMoveToCodePoint
private LexerATNFactory.CharSetParseState applyPrevStateAndMoveToCodePoint(GrammarAST charSetAST, IntervalSet set, LexerATNFactory.CharSetParseState state, int codePoint) -
applyPrevStateAndMoveToProperty
private LexerATNFactory.CharSetParseState applyPrevStateAndMoveToProperty(GrammarAST charSetAST, IntervalSet set, LexerATNFactory.CharSetParseState state, IntervalSet property) -
applyPrevState
private void applyPrevState(GrammarAST charSetAST, IntervalSet set, LexerATNFactory.CharSetParseState state) -
checkCharAndAddToSet
-
checkRangeAndAddToSet
-
checkRangeAndAddToSet
private CharactersDataCheckStatus checkRangeAndAddToSet(GrammarAST rootAst, GrammarAST ast, IntervalSet set, int a, int b, boolean caseInsensitive, CharactersDataCheckStatus previousStatus) -
createTransition
private Transition createTransition(ATNState target, int from, int to, org.antlr.runtime.tree.CommonTree tree) -
tokenRef
Description copied from class:ParserATNFactoryFrom labelAbuild grapho-A->o.- Specified by:
tokenRefin interfaceATNFactory- Overrides:
tokenRefin classParserATNFactory
-
createLexerAction
-
checkCommands
-
getModeConstantValue
-
getTokenConstantValue
-
getChannelConstantValue
-