1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2 * Use of this file is governed by the BSD 3-clause license that
3 * can be found in the LICENSE.txt file in the project root.
8 #include "atn/LexerAction.h"
9 #include "atn/LexerActionType.h"
17 /// Implements the {@code channel} lexer action by calling
18 /// <seealso cref="Lexer#setChannel"/> with the assigned channel.
20 /// @author Sam Harwell
23 class ANTLR4CPP_PUBLIC LexerChannelAction final : public LexerAction {
26 /// Constructs a new {@code channel} action with the specified channel value. </summary>
27 /// <param name="channel"> The channel value to pass to <seealso cref="Lexer#setChannel"/>. </param>
28 LexerChannelAction(int channel);
31 /// Gets the channel to use for the <seealso cref="Token"/> created by the lexer.
33 /// <returns> The channel to use for the <seealso cref="Token"/> created by the lexer. </returns>
34 int getChannel() const;
37 /// {@inheritDoc} </summary>
38 /// <returns> This method returns <seealso cref="LexerActionType#CHANNEL"/>. </returns>
39 virtual LexerActionType getActionType() const override;
42 /// {@inheritDoc} </summary>
43 /// <returns> This method returns {@code false}. </returns>
44 virtual bool isPositionDependent() const override;
49 /// <para>This action is implemented by calling <seealso cref="Lexer#setChannel"/> with the
50 /// value provided by <seealso cref="#getChannel"/>.</para>
52 virtual void execute(Lexer *lexer) override;
54 virtual size_t hashCode() const override;
55 virtual bool operator == (const LexerAction &obj) const override;
56 virtual std::string toString() const override;