Top Fields Constructors Methods
org.antlr.v4.tool

public Class LexerGrammar

extends Grammar
Class Inheritance
Imports
org.antlr.runtime.RecognitionException, org.antlr.v4.Tool, org.antlr.v4.runtime.misc.MultiMap, org.antlr.v4.tool.ast.GrammarRootAST

Field Summary

Modifier and TypeField and Description
public static final String
public Grammar
implicitLexerOwner

The grammar from which this lexer grammar was derived (if implicit)

public MultiMap<String, Rule>
modes

DEFAULT_MODE rules are added first due to grammar syntax order

Inherited from org.antlr.v4.tool.Grammar:
actionOptionsastatnAUTO_GENERATED_TOKEN_NAME_PREFIXcaseInsensitiveOptionNamechannelNameToValueMapchannelValueToNameListdecisionDFAsdecisionLOOKdoNotCopyOptionsToLexerfileNameGRAMMAR_FROM_STRING_NAMEgrammarAndLabelRefTypeToScopeimplicitLexerimportedGrammarsindexToPredMapindexToRuleINVALID_RULE_NAMEINVALID_TOKEN_NAMElexerActionslexerBlockOptionslexerOptionslexerRuleOptionsmaxChannelTypemaxTokenTypenamenamedActionsoriginalGrammaroriginalTokenStreamparentparserBlockOptionsparserOptionsparseRuleOptionsruleNumberruleRefOptionsrulessemPredOptionssempredsstateToGrammarRegionMapstringLiteralRuleNumberstringLiteralToTypeMaptexttokenNameToTypeMaptokenOptionstokenStreamtooltypeToStringLiteralListtypeToTokenList

Constructor Summary

AccessConstructor and Description
public
public
LexerGrammar(String grammarText)

public
LexerGrammar(String grammarText, ANTLRToolListener listener)

public
LexerGrammar(String fileName, String grammarText, ANTLRToolListener listener)

Method Summary

Modifier and TypeMethod and Description
public boolean
defineRule(Rule
The rule to define in the grammar.
r
)

Overrides org.antlr.v4.tool.Grammar.defineRule.

Define the specified rule in the grammar.
public boolean
undefineRule(Rule r)

Overrides org.antlr.v4.tool.Grammar.undefineRule.

Undefine the specified rule from this Grammar instance.
Inherited from org.antlr.v4.tool.Grammar:
createGrammarParserInterpretercreateLexerInterpretercreateParserInterpreterdefAliasdefineActiondefineChannelNamedefineChannelNamedefineStringLiteraldefineStringLiteraldefineTokenAliasdefineTokenNamedefineTokenNamegetAllCharValuesgetAllImportedGrammarsgetATNgetChannelValuegetDefaultActionScopegetGrammarAncestorsgetGrammarTypeToFileNameSuffixgetImplicitLexergetImportedGrammargetImportedGrammarsgetIndexToPredicateMapgetLanguagegetMaxCharValuegetMaxTokenTypegetNewChannelNumbergetNewTokenTypegetOptionStringgetOutermostGrammargetPredicateDisplayStringgetRecognizerNamegetRulegetRulegetRulegetRuleNamesgetSemanticContextDisplayStringgetStateToGrammarRegiongetStateToGrammarRegionMapgetStringLiteralAliasesFromLexerRulesgetStringLiteralLexerRuleNamegetStringLiteralsgetTokenDisplayNamegetTokenDisplayNamesgetTokenLiteralNamesgetTokenNamegetTokenNamegetTokenNamesgetTokenStreamgetTokenSymbolicNamesgetTokenTypegetTokenTypesgetTypegetTypeStringgetVocabularyimportTokensFromTokensFileimportVocabinitTokenSymbolTablesisCombinedisLexerisParserisTokenNamejoinPredicateOperandsloadloadImportedGrammarsresolvesToAttributeDictresolvesToLabelresolvesToListLabelresolvesToTokenresolveToAttributeresolveToAttributesetChannelNameForValuesetLookaheadDFAsetNodeOptionssetTokenForType

Field Detail

DEFAULT_MODE_NAMEback to summary
public static final String DEFAULT_MODE_NAME
implicitLexerOwnerback to summary
public Grammar implicitLexerOwner

The grammar from which this lexer grammar was derived (if implicit)

modesback to summary
public MultiMap<String, Rule> modes

DEFAULT_MODE rules are added first due to grammar syntax order

Constructor Detail

LexerGrammarback to summary
public LexerGrammar(Tool tool, GrammarRootAST ast)
LexerGrammarback to summary
public LexerGrammar(String grammarText) throws RecognitionException
LexerGrammarback to summary
public LexerGrammar(String grammarText, ANTLRToolListener listener) throws RecognitionException
LexerGrammarback to summary
public LexerGrammar(String fileName, String grammarText, ANTLRToolListener listener) throws RecognitionException

Method Detail

defineRuleback to summary
public boolean defineRule(Rule r)

Overrides org.antlr.v4.tool.Grammar.defineRule.

Doc from org.antlr.v4.tool.Grammar.defineRule.

Define the specified rule in the grammar. This method assigns the rule's Rule#index according to the ruleNumber field, and adds the Rule instance to rules and indexToRule.

Parameters
r:Rule

The rule to define in the grammar.

Returns:boolean

true if the rule was added to the Grammar instance; otherwise, false if a rule with this name already existed in the grammar instance.

Annotations
@Override
undefineRuleback to summary
public boolean undefineRule(Rule r)

Overrides org.antlr.v4.tool.Grammar.undefineRule.

Doc from org.antlr.v4.tool.Grammar.undefineRule.

Undefine the specified rule from this Grammar instance. The instance r is removed from rules and indexToRule. This method updates the Rule#index field for all rules defined after r, and decrements 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 indexToRule.

Returns:boolean

true if the rule was removed from the Grammar instance; otherwise, false if the specified rule was not defined in the grammar.

Annotations
@Override