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"
15 /// Implements the {@code mode} lexer action by calling <seealso cref="Lexer#mode"/> with
16 /// the assigned mode.
18 /// @author Sam Harwell
21 class ANTLR4CPP_PUBLIC LexerModeAction final : public LexerAction {
24 /// Constructs a new {@code mode} action with the specified mode value. </summary>
25 /// <param name="mode"> The mode value to pass to <seealso cref="Lexer#mode"/>. </param>
26 LexerModeAction(int mode);
29 /// Get the lexer mode this action should transition the lexer to.
31 /// <returns> The lexer mode for this {@code mode} command. </returns>
35 /// {@inheritDoc} </summary>
36 /// <returns> This method returns <seealso cref="LexerActionType#MODE"/>. </returns>
37 virtual LexerActionType getActionType() const override;
40 /// {@inheritDoc} </summary>
41 /// <returns> This method returns {@code false}. </returns>
42 virtual bool isPositionDependent() const override;
47 /// <para>This action is implemented by calling <seealso cref="Lexer#mode"/> with the
48 /// value provided by <seealso cref="#getMode"/>.</para>
50 virtual void execute(Lexer *lexer) override;
52 virtual size_t hashCode() const override;
53 virtual bool operator == (const LexerAction &obj) const override;
54 virtual std::string toString() const override;