]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/NotSetTransition.cpp
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / NotSetTransition.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/NotSetTransition.h"
7 #include "atn/ATNState.h"
8 #include "misc/IntervalSet.h"
9
10 using namespace antlr4;
11 using namespace antlr4::atn;
12
13 NotSetTransition::NotSetTransition(ATNState *target, const misc::IntervalSet &set) : SetTransition(target, set) {
14 }
15
16 Transition::SerializationType NotSetTransition::getSerializationType() const {
17   return NOT_SET;
18 }
19
20 bool NotSetTransition::matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const {
21   return symbol >= minVocabSymbol && symbol <= maxVocabSymbol
22     && !SetTransition::matches(symbol, minVocabSymbol, maxVocabSymbol);
23 }
24
25 std::string NotSetTransition::toString() const {
26   return "NOT_SET " + Transition::toString() + " { " + SetTransition::toString() + " }";
27 }