public class LexerGrammar extends Grammar
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_MODE_NAME
|
Grammar |
implicitLexerOwner
The grammar from which this lexer grammar was derived (if implicit)
|
<any> |
modes
DEFAULT_MODE rules are added first due to grammar syntax order
|
actionOptions, ast, atn, AUTO_GENERATED_TOKEN_NAME_PREFIX, channelNameToValueMap, channelValueToNameList, decisionDFAs, decisionLOOK, doNotCopyOptionsToLexer, fileName, GRAMMAR_FROM_STRING_NAME, grammarAndLabelRefTypeToScope, implicitLexer, importedGrammars, indexToPredMap, indexToRule, INVALID_RULE_NAME, INVALID_TOKEN_NAME, lexerActions, LexerBlockOptions, lexerOptions, name, namedActions, originalGrammar, originalTokenStream, parent, ParserBlockOptions, parserOptions, ruleOptions, ruleRefOptions, rules, semPredOptions, sempreds, stateToGrammarRegionMap, stringLiteralToTypeMap, text, tokenNameToTypeMap, tokenOptions, tokenStream, tool, typeToStringLiteralList, typeToTokenList| Constructor and Description |
|---|
LexerGrammar(String
|
LexerGrammar(String
|
LexerGrammar(String
|
LexerGrammar(Tool
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
defineRule(Rule
Define the specified rule in the grammar.
|
boolean |
undefineRule(Rule
Undefine the specified rule from this
Grammar instance.
|
createGrammarParserInterpreter, createLexerInterpreter, createParserInterpreter, defAlias, defineAction, defineChannelName, defineChannelName, defineStringLiteral, defineStringLiteral, defineTokenAlias, defineTokenName, defineTokenName, getAllCharValues, getAllImportedGrammars, getATN, getChannelValue, getDefaultActionScope, getGrammarAncestors, getGrammarTypeToFileNameSuffix, getImplicitLexer, getImportedGrammar, getImportedGrammars, getIndexToPredicateMap, getMaxCharValue, getMaxTokenType, getNewChannelNumber, getNewTokenType, getOptionString, getOutermostGrammar, getPredicateDisplayString, getRecognizerName, getRule, getRule, getRule, getRuleNames, getSemanticContextDisplayString, getStateToGrammarRegion, getStateToGrammarRegionMap, getStringLiteralAliasesFromLexerRules, getStringLiteralLexerRuleName, getStringLiterals, getTokenDisplayName, getTokenDisplayNames, getTokenLiteralNames, getTokenName, getTokenNames, getTokenStream, getTokenSymbolicNames, getTokenType, getTokenTypes, getType, getTypeString, getVocabulary, importTokensFromTokensFile, importVocab, initTokenSymbolTables, isCombined, isLexer, isParser, isTokenName, joinPredicateOperands, load, loadImportedGrammars, resolvesToAttributeDict, resolvesToLabel, resolvesToListLabel, resolvesToToken, resolveToAttribute, resolveToAttribute, setChannelNameForValue, setLookaheadDFA, setNodeOptions, setTokenForTypepublic static final StringDEFAULT_MODE_NAME
public GrammarimplicitLexerOwner
public <any> modes
public LexerGrammar(Tooltool, GrammarRootAST ast)
public LexerGrammar(StringgrammarText) throws RecognitionException
RecognitionException
public LexerGrammar(StringgrammarText, ANTLRToolListener listener) throws RecognitionException
RecognitionException
public LexerGrammar(StringfileName, String grammarText, ANTLRToolListener listener) throws RecognitionException
RecognitionException
public boolean defineRule(Ruler)
Grammar
Rule.index according to the
Grammar.ruleNumber field, and adds the
Rule instance to
Grammar.rules and
Grammar.indexToRule .
defineRule in class
Grammar
r - The rule to define in the grammar.
true if the rule was added to the
Grammar instance; otherwise,
false if a rule with this name already existed in the grammar instance.
public boolean undefineRule(Ruler)
Grammar
Grammar instance. The instance
r is removed from
Grammar.rules and
Grammar.indexToRule . This method updates the
Rule.index field for all rules defined after
r, and decrements
Grammar.ruleNumber in preparation for adding new rules.
This method does nothing if the current Grammar does not contain the instance r at index r.index in Grammar.
undefineRule in class
Grammar
true if the rule was removed from the
Grammar instance; otherwise,
false if the specified rule was not defined in the grammar.