]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerPopModeAction.cpp
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / LexerPopModeAction.cpp
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.
4  */
5
6 #include "misc/MurmurHash.h"
7 #include "Lexer.h"
8
9 #include "atn/LexerPopModeAction.h"
10
11 using namespace antlr4;
12 using namespace antlr4::atn;
13 using namespace antlr4::misc;
14
15 const Ref<LexerPopModeAction> LexerPopModeAction::getInstance() {
16   static Ref<LexerPopModeAction> instance(new LexerPopModeAction());
17   return instance;
18 }
19
20 LexerPopModeAction::LexerPopModeAction() {
21 }
22
23 LexerActionType LexerPopModeAction::getActionType() const {
24   return LexerActionType::POP_MODE;
25 }
26
27 bool LexerPopModeAction::isPositionDependent() const {
28   return false;
29 }
30
31 void LexerPopModeAction::execute(Lexer *lexer) {
32   lexer->popMode();
33 }
34
35 size_t LexerPopModeAction::hashCode() const {
36   size_t hash = MurmurHash::initialize();
37   hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
38   return MurmurHash::finish(hash, 1);
39 }
40
41 bool LexerPopModeAction::operator == (const LexerAction &obj) const {
42   return &obj == this;
43 }
44
45 std::string LexerPopModeAction::toString() const {
46   return "popMode";
47 }