public final class LexerModeAction extends Object implements LexerAction
mode
lexer action by calling Lexer.mode(int)
with
the assigned mode.Constructor and Description |
---|
LexerModeAction(int mode)
Constructs a new
mode action with the specified mode value. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
void |
execute(Lexer lexer)
Execute the lexer action in the context of the specified
Lexer . |
LexerActionType |
getActionType()
Gets the serialization type of the lexer action.
|
int |
getMode()
Get the lexer mode this action should transition the lexer to.
|
int |
hashCode() |
boolean |
isPositionDependent()
Gets whether the lexer action is position-dependent.
|
String |
toString() |
public LexerModeAction(int mode)
mode
action with the specified mode value.mode
- The mode value to pass to Lexer.mode(int)
.public int getMode()
mode
command.public LexerActionType getActionType()
getActionType
in interface LexerAction
LexerActionType.MODE
.public boolean isPositionDependent()
CharStream
index at the time the action is executed.
Many lexer commands, including type
, skip
, and
more
, do not check the input index during their execution.
Actions like this are position-independent, and may be stored more
efficiently as part of the LexerATNConfig.lexerActionExecutor
.
isPositionDependent
in interface LexerAction
false
.public void execute(Lexer lexer)
Lexer
.
For position-dependent actions, the input stream must already be positioned correctly prior to calling this method.
This action is implemented by calling Lexer.mode(int)
with the
value provided by getMode()
.
execute
in interface LexerAction
lexer
- The lexer instance.Copyright © 1992-2015 ANTLR. All Rights Reserved.