]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredicateTransition.h
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / PredicateTransition.h
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 #pragma once
7
8 #include "atn/AbstractPredicateTransition.h"
9 #include "SemanticContext.h"
10
11 namespace antlr4 {
12 namespace atn {
13
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 {
20   public:
21     const size_t ruleIndex;
22     const size_t predIndex;
23     const bool isCtxDependent; // e.g., $i ref in pred
24
25     PredicateTransition(ATNState *target, size_t ruleIndex, size_t predIndex, bool isCtxDependent);
26
27     virtual SerializationType getSerializationType() const override;
28
29     virtual bool isEpsilon() const override;
30     virtual bool matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const override;
31
32     Ref<SemanticContext::Predicate> getPredicate() const;
33
34     virtual std::string toString() const override;
35
36   };
37
38 } // namespace atn
39 } // namespace antlr4