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.
6 #include "misc/IntervalSet.h"
8 #include "atn/RangeTransition.h"
10 using namespace antlr4;
11 using namespace antlr4::atn;
13 RangeTransition::RangeTransition(ATNState *target, size_t from, size_t to) : Transition(target), from(from), to(to) {
16 Transition::SerializationType RangeTransition::getSerializationType() const {
20 misc::IntervalSet RangeTransition::label() const {
21 return misc::IntervalSet::of((int)from, (int)to);
24 bool RangeTransition::matches(size_t symbol, size_t /*minVocabSymbol*/, size_t /*maxVocabSymbol*/) const {
25 return symbol >= from && symbol <= to;
28 std::string RangeTransition::toString() const {
29 return "RANGE " + Transition::toString() + " { from: " + std::to_string(from) + ", to: " + std::to_string(to) + " }";