]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/Transition.cpp
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / Transition.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 "Exceptions.h"
7 #include "support/Arrays.h"
8
9 #include "atn/Transition.h"
10
11 using namespace antlr4;
12 using namespace antlr4::atn;
13
14 using namespace antlrcpp;
15
16 const std::vector<std::string> Transition::serializationNames = {
17   "INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"
18 };
19
20 Transition::Transition(ATNState *target) {
21   if (target == nullptr) {
22     throw NullPointerException("target cannot be null.");
23   }
24
25   this->target = target;
26 }
27
28 Transition::~Transition() {
29 }
30
31 bool Transition::isEpsilon() const {
32   return false;
33 }
34
35 misc::IntervalSet Transition::label() const {
36   return misc::IntervalSet::EMPTY_SET;
37 }
38
39 std::string Transition::toString() const {
40   std::stringstream ss;
41   ss << "(Transition " << std::hex << this << ", target: " << std::hex << target << ')';
42
43   return ss.str();
44 }