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 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 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.Handleaction(GrammarAST node, LexerAction lexerAction) charSetLiteral(GrammarAST charSetAST) [Aa\t ሴa-z\]\p{Letter}\-] char setsprotected booleancheckRange(GrammarAST leftNode, GrammarAST rightNode, int leftValue, int rightValue) protected voidcheckSetCollision(GrammarAST ast, IntervalSet set, int el) protected voidcheckSetCollision(GrammarAST ast, IntervalSet set, int a, int b) protected intgetLexerActionIndex(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 labelAbuild 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 creatingLexerActioninstances that are usable by a lexer interpreter. -
indexToActionMap
Maps from an action index to aLexerActionobject. -
actionToIndexMap
Maps from aLexerActionobject to the action index.
-
-
Constructor Details
-
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
-
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.- Specified by:
stringLiteralin interfaceATNFactory- Overrides:
stringLiteralin classParserATNFactory
-
charSetLiteral
[Aa\t ሴa-z\]\p{Letter}\-] char sets- Specified by:
charSetLiteralin interfaceATNFactory- Overrides:
charSetLiteralin classParserATNFactory
-
getSetFromCharSetLiteral
-
checkSetCollision
-
checkSetCollision
-
tokenRef
Description copied from class:ParserATNFactoryFrom labelAbuild grapho-A->o.- Specified by:
tokenRefin interfaceATNFactory- Overrides:
tokenRefin classParserATNFactory
-