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 pushMode} lexer action by calling
16 /// <seealso cref="Lexer#pushMode"/> with the assigned mode.
18 /// @author Sam Harwell
21 class ANTLR4CPP_PUBLIC LexerPushModeAction final : public LexerAction {
24 /// Constructs a new {@code pushMode} action with the specified mode value. </summary>
25 /// <param name="mode"> The mode value to pass to <seealso cref="Lexer#pushMode"/>. </param>
26 LexerPushModeAction(int mode);
29 /// Get the lexer mode this action should transition the lexer to.
31 /// <returns> The lexer mode for this {@code pushMode} command. </returns>
35 /// {@inheritDoc} </summary>
36 /// <returns> This method returns <seealso cref="LexerActionType#PUSH_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#pushMode"/> 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;