Package org.antlr.v4.runtime.atn
Class LexerPushModeAction
- java.lang.Object
- 
- org.antlr.v4.runtime.atn.LexerPushModeAction
 
- 
- All Implemented Interfaces:
- LexerAction
 
 public final class LexerPushModeAction extends Object implements LexerAction Implements thepushModelexer action by callingLexer.pushMode(int)with the assigned mode.- Since:
- 4.2
- Author:
- Sam Harwell
 
- 
- 
Constructor SummaryConstructors Constructor Description LexerPushModeAction(int mode)Constructs a newpushModeaction with the specified mode value.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)voidexecute(Lexer lexer)Execute the lexer action in the context of the specifiedLexer.LexerActionTypegetActionType()Gets the serialization type of the lexer action.intgetMode()Get the lexer mode this action should transition the lexer to.inthashCode()booleanisPositionDependent()Gets whether the lexer action is position-dependent.StringtoString()
 
- 
- 
- 
Constructor Detail- 
LexerPushModeActionpublic LexerPushModeAction(int mode) Constructs a newpushModeaction with the specified mode value.- Parameters:
- mode- The mode value to pass to- Lexer.pushMode(int).
 
 
- 
 - 
Method Detail- 
getModepublic int getMode() Get the lexer mode this action should transition the lexer to.- Returns:
- The lexer mode for this pushModecommand.
 
 - 
getActionTypepublic LexerActionType getActionType() Gets the serialization type of the lexer action.- Specified by:
- getActionTypein interface- LexerAction
- Returns:
- This method returns LexerActionType.PUSH_MODE.
 
 - 
isPositionDependentpublic boolean isPositionDependent() Gets whether the lexer action is position-dependent. Position-dependent actions may have different semantics depending on theCharStreamindex at the time the action is executed.Many lexer commands, including type,skip, andmore, do not check the input index during their execution. Actions like this are position-independent, and may be stored more efficiently as part of theLexerATNConfig.lexerActionExecutor.- Specified by:
- isPositionDependentin interface- LexerAction
- Returns:
- This method returns false.
 
 - 
executepublic void execute(Lexer lexer) Execute the lexer action in the context of the specifiedLexer.For position-dependent actions, the input stream must already be positioned correctly prior to calling this method. This action is implemented by calling Lexer.pushMode(int)with the value provided bygetMode().- Specified by:
- executein interface- LexerAction
- Parameters:
- lexer- The lexer instance.
 
 
- 
 
-