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 "atn/PredicateTransition.h"
8 using namespace antlr4::atn;
10 PredicateTransition::PredicateTransition(ATNState *target, size_t ruleIndex, size_t predIndex, bool isCtxDependent) : AbstractPredicateTransition(target), ruleIndex(ruleIndex), predIndex(predIndex), isCtxDependent(isCtxDependent) {
13 Transition::SerializationType PredicateTransition::getSerializationType() const {
17 bool PredicateTransition::isEpsilon() const {
21 bool PredicateTransition::matches(size_t /*symbol*/, size_t /*minVocabSymbol*/, size_t /*maxVocabSymbol*/) const {
25 Ref<SemanticContext::Predicate> PredicateTransition::getPredicate() const {
26 return std::make_shared<SemanticContext::Predicate>(ruleIndex, predIndex, isCtxDependent);
29 std::string PredicateTransition::toString() const {
30 return "PREDICATE " + Transition::toString() + " { ruleIndex: " + std::to_string(ruleIndex) +
31 ", predIndex: " + std::to_string(predIndex) + ", isCtxDependent: " + std::to_string(isCtxDependent) + " }";
33 // Generate and add a predicate context here?