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.
8 #include "atn/AbstractPredicateTransition.h"
9 #include "SemanticContext.h"
14 /// TODO: this is old comment:
15 /// A tree of semantic predicates from the grammar AST if label==SEMPRED.
16 /// In the ATN, labels will always be exactly one predicate, but the DFA
17 /// may have to combine a bunch of them as it collects predicates from
18 /// multiple ATN configurations into a single DFA state.
19 class ANTLR4CPP_PUBLIC PredicateTransition final : public AbstractPredicateTransition {
21 const size_t ruleIndex;
22 const size_t predIndex;
23 const bool isCtxDependent; // e.g., $i ref in pred
25 PredicateTransition(ATNState *target, size_t ruleIndex, size_t predIndex, bool isCtxDependent);
27 virtual SerializationType getSerializationType() const override;
29 virtual bool isEpsilon() const override;
30 virtual bool matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const override;
32 Ref<SemanticContext::Predicate> getPredicate() const;
34 virtual std::string toString() const override;