Class LexerChannelAction

    • Constructor Detail

      • LexerChannelAction

        public LexerChannelAction​(int channel)
        Constructs a new channel action with the specified channel value.
        Parameters:
        channel - The channel value to pass to Lexer.setChannel(int).
    • Method Detail

      • getChannel

        public int getChannel()
        Gets the channel to use for the Token created by the lexer.
        Returns:
        The channel to use for the Token created by the lexer.
      • isPositionDependent

        public boolean isPositionDependent()
        Gets whether the lexer action is position-dependent. Position-dependent actions may have different semantics depending on the 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.

        Specified by:
        isPositionDependent in interface LexerAction
        Returns:
        This method returns false.
      • execute

        public void execute​(Lexer lexer)
        Execute the lexer action in the context of the specified 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.setChannel(int) with the value provided by getChannel().

        Specified by:
        execute in interface LexerAction
        Parameters:
        lexer - The lexer instance.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object