]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ActionTransition.cpp
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / ActionTransition.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 "atn/ActionTransition.h"
7
8 using namespace antlr4::atn;
9
10 ActionTransition::ActionTransition(ATNState *target, size_t ruleIndex)
11   : Transition(target), ruleIndex(ruleIndex), actionIndex(INVALID_INDEX), isCtxDependent(false) {
12 }
13
14 ActionTransition::ActionTransition(ATNState *target, size_t ruleIndex, size_t actionIndex, bool isCtxDependent)
15   : Transition(target), ruleIndex(ruleIndex), actionIndex(actionIndex), isCtxDependent(isCtxDependent) {
16 }
17
18 Transition::SerializationType ActionTransition::getSerializationType() const {
19   return ACTION;
20 }
21
22 bool ActionTransition::isEpsilon() const {
23   return true; // we are to be ignored by analysis 'cept for predicates
24 }
25
26 bool ActionTransition::matches(size_t /*symbol*/, size_t /*minVocabSymbol*/, size_t /*maxVocabSymbol*/) const {
27   return false;
28 }
29
30 std::string ActionTransition::toString() const {
31   return " ACTION " + Transition::toString() + " { ruleIndex: " + std::to_string(ruleIndex) + ", actionIndex: " +
32   std::to_string(actionIndex) + ", isCtxDependent: " + std::to_string(isCtxDependent) + " }";
33 }