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)
|
MultiMap<String,Rule> |
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 grammarText) |
LexerGrammar(String grammarText,
ANTLRToolListener listener) |
LexerGrammar(String fileName,
String grammarText,
ANTLRToolListener listener) |
LexerGrammar(Tool tool,
GrammarRootAST ast) |
Modifier and Type | Method and Description |
---|---|
boolean |
defineRule(Rule r)
Define the specified rule in the grammar.
|
boolean |
undefineRule(Rule r)
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, 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, setTokenForType
public static final String DEFAULT_MODE_NAME
public Grammar implicitLexerOwner
public LexerGrammar(Tool tool, GrammarRootAST ast)
public LexerGrammar(String grammarText) throws org.antlr.runtime.RecognitionException
org.antlr.runtime.RecognitionException
public LexerGrammar(String grammarText, ANTLRToolListener listener) throws org.antlr.runtime.RecognitionException
org.antlr.runtime.RecognitionException
public LexerGrammar(String fileName, String grammarText, ANTLRToolListener listener) throws org.antlr.runtime.RecognitionException
org.antlr.runtime.RecognitionException
public boolean defineRule(Rule r)
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(Rule r)
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.indexToRule
.
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.Copyright © 1992–2020 ANTLR. All rights reserved.