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 "antlr4-common.h"
14 /// This is the base class for gathering detailed information about prediction
15 /// events which occur during parsing.
17 /// Note that we could record the parser call stack at the time this event
18 /// occurred but in the presence of left recursive rules, the stack is kind of
19 /// meaningless. It's better to look at the individual configurations for their
20 /// individual stacks. Of course that is a <seealso cref="PredictionContext"/> object
21 /// not a parse tree node and so it does not have information about the extent
22 /// (start...stop) of the various subtrees. Examining the stack tops of all
23 /// configurations provide the return states for the rule invocations.
24 /// From there you can get the enclosing rule.
28 class ANTLR4CPP_PUBLIC DecisionEventInfo {
31 /// The invoked decision number which this event is related to.
33 /// <seealso cref= ATN#decisionToState </seealso>
34 const size_t decision;
37 /// The configuration set containing additional information relevant to the
38 /// prediction state when the current event occurred, or {@code null} if no
39 /// additional information is relevant or available.
41 const ATNConfigSet *configs;
44 /// The input token stream which is being parsed.
46 const TokenStream *input;
49 /// The token index in the input stream at which the current prediction was
50 /// originally invoked.
52 const size_t startIndex;
55 /// The token index in the input stream at which the current event occurred.
57 const size_t stopIndex;
60 /// {@code true} if the current event occurred during LL prediction;
61 /// otherwise, {@code false} if the input occurred during SLL prediction.
65 DecisionEventInfo(size_t decision, ATNConfigSet *configs, TokenStream *input, size_t startIndex,
66 size_t stopIndex, bool fullCtx);