Class LexerChannelAction
java.lang.Object
org.graalvm.shadowed.org.antlr.v4.runtime.atn.LexerChannelAction
- All Implemented Interfaces:
LexerAction
Implements the
channel lexer action by calling
Lexer.setChannel(int) with the assigned channel.- Since:
- 4.2
-
Constructor Summary
ConstructorsConstructorDescriptionLexerChannelAction(int channel) Constructs a newchannelaction with the specified channel value. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidExecute the lexer action in the context of the specifiedLexer.Gets the serialization type of the lexer action.intGets the channel to use for theTokencreated by the lexer.inthashCode()booleanGets whether the lexer action is position-dependent.toString()
-
Constructor Details
-
LexerChannelAction
public LexerChannelAction(int channel) Constructs a newchannelaction with the specified channel value.- Parameters:
channel- The channel value to pass toLexer.setChannel(int).
-
-
Method Details
-
getChannel
-
getActionType
Gets the serialization type of the lexer action.- Specified by:
getActionTypein interfaceLexerAction- Returns:
- This method returns
LexerActionType.CHANNEL.
-
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
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.setChannel(int)with the value provided bygetChannel().- Specified by:
executein interfaceLexerAction- Parameters:
lexer- The lexer instance.
-
hashCode
-
equals
-
toString
-