]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionEventInfo.h
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / DecisionEventInfo.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 "antlr4-common.h"
9
10 namespace antlr4 {
11 namespace atn {
12
13   /// <summary>
14   /// This is the base class for gathering detailed information about prediction
15   /// events which occur during parsing.
16   ///
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.
25   ///
26   /// @since 4.3
27   /// </summary>
28   class ANTLR4CPP_PUBLIC DecisionEventInfo {
29   public:
30     /// <summary>
31     /// The invoked decision number which this event is related to.
32     /// </summary>
33     /// <seealso cref= ATN#decisionToState </seealso>
34     const size_t decision;
35
36     /// <summary>
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.
40     /// </summary>
41     const ATNConfigSet *configs;
42
43     /// <summary>
44     /// The input token stream which is being parsed.
45     /// </summary>
46     const TokenStream *input;
47
48     /// <summary>
49     /// The token index in the input stream at which the current prediction was
50     /// originally invoked.
51     /// </summary>
52     const size_t startIndex;
53
54     /// <summary>
55     /// The token index in the input stream at which the current event occurred.
56     /// </summary>
57     const size_t stopIndex;
58
59     /// <summary>
60     /// {@code true} if the current event occurred during LL prediction;
61     /// otherwise, {@code false} if the input occurred during SLL prediction.
62     /// </summary>
63     const bool fullCtx;
64
65     DecisionEventInfo(size_t decision, ATNConfigSet *configs, TokenStream *input, size_t startIndex,
66                       size_t stopIndex, bool fullCtx);
67   };
68
69 } // namespace atn
70 } // namespace antlr4