Package org.antlr.v4.runtime.atn
Class LexerPopModeAction
- java.lang.Object
-
- org.antlr.v4.runtime.atn.LexerPopModeAction
-
- All Implemented Interfaces:
LexerAction
public final class LexerPopModeAction extends Object implements LexerAction
Implements thepopModelexer action by callingLexer.popMode().The
popModecommand does not have any parameters, so this action is implemented as a singleton instance exposed byINSTANCE.- Since:
- 4.2
- Author:
- Sam Harwell
-
-
Field Summary
Fields Modifier and Type Field Description static LexerPopModeActionINSTANCEProvides a singleton instance of this parameterless lexer action.
-
Method Summary
All 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.inthashCode()booleanisPositionDependent()Gets whether the lexer action is position-dependent.StringtoString()
-
-
-
Field Detail
-
INSTANCE
public static final LexerPopModeAction INSTANCE
Provides a singleton instance of this parameterless lexer action.
-
-
Method Detail
-
getActionType
public LexerActionType getActionType()
Gets the serialization type of the lexer action.- Specified by:
getActionTypein interfaceLexerAction- Returns:
- This method returns
LexerActionType.POP_MODE.
-
isPositionDependent
public 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 interfaceLexerAction- Returns:
- This method returns
false.
-
execute
public 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.popMode().- Specified by:
executein interfaceLexerAction- Parameters:
lexer- The lexer instance.
-
-