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/DecisionEventInfo.h"
14 /// This class represents profiling event information for semantic predicate
15 /// evaluations which occur during prediction.
17 /// <seealso cref= ParserATNSimulator#evalSemanticContext
19 /// @since 4.3 </seealso>
20 class ANTLR4CPP_PUBLIC PredicateEvalInfo : public DecisionEventInfo {
22 /// The semantic context which was evaluated.
23 const Ref<SemanticContext> semctx;
26 /// The alternative number for the decision which is guarded by the semantic
27 /// context <seealso cref="#semctx"/>. Note that other ATN
28 /// configurations may predict the same alternative which are guarded by
29 /// other semantic contexts and/or <seealso cref="SemanticContext#NONE"/>.
31 const size_t predictedAlt;
33 /// The result of evaluating the semantic context <seealso cref="#semctx"/>.
34 const bool evalResult;
37 /// Constructs a new instance of the <seealso cref="PredicateEvalInfo"/> class with the
38 /// specified detailed predicate evaluation information.
40 /// <param name="decision"> The decision number </param>
41 /// <param name="input"> The input token stream </param>
42 /// <param name="startIndex"> The start index for the current prediction </param>
43 /// <param name="stopIndex"> The index at which the predicate evaluation was
44 /// triggered. Note that the input stream may be reset to other positions for
45 /// the actual evaluation of individual predicates. </param>
46 /// <param name="semctx"> The semantic context which was evaluated </param>
47 /// <param name="evalResult"> The results of evaluating the semantic context </param>
48 /// <param name="predictedAlt"> The alternative number for the decision which is
49 /// guarded by the semantic context {@code semctx}. See <seealso cref="#predictedAlt"/>
50 /// for more information. </param>
51 /// <param name="fullCtx"> {@code true} if the semantic context was
52 /// evaluated during LL prediction; otherwise, {@code false} if the semantic
53 /// context was evaluated during SLL prediction
55 /// <seealso cref= ParserATNSimulator#evalSemanticContext(SemanticContext, ParserRuleContext, int, boolean) </seealso>
56 /// <seealso cref= SemanticContext#eval(Recognizer, RuleContext) </seealso>
57 PredicateEvalInfo(size_t decision, TokenStream *input, size_t startIndex, size_t stopIndex,
58 Ref<SemanticContext> const& semctx, bool evalResult, size_t predictedAlt, bool fullCtx);