]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ParseInfo.h
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / ParseInfo.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/DecisionInfo.h"
9
10 namespace antlr4 {
11 namespace atn {
12
13   class ProfilingATNSimulator;
14
15   /// This class provides access to specific and aggregate statistics gathered
16   /// during profiling of a parser.
17   class ANTLR4CPP_PUBLIC ParseInfo {
18   public:
19     ParseInfo(ProfilingATNSimulator *atnSimulator);
20     ParseInfo(ParseInfo const&) = default;
21     virtual ~ParseInfo();
22
23     ParseInfo& operator=(ParseInfo const&) = default;
24
25     /// <summary>
26     /// Gets an array of <seealso cref="DecisionInfo"/> instances containing the profiling
27     /// information gathered for each decision in the ATN.
28     /// </summary>
29     /// <returns> An array of <seealso cref="DecisionInfo"/> instances, indexed by decision
30     /// number. </returns>
31     virtual std::vector<DecisionInfo> getDecisionInfo();
32
33     /// <summary>
34     /// Gets the decision numbers for decisions that required one or more
35     /// full-context predictions during parsing. These are decisions for which
36     /// <seealso cref="DecisionInfo#LL_Fallback"/> is non-zero.
37     /// </summary>
38     /// <returns> A list of decision numbers which required one or more
39     /// full-context predictions during parsing. </returns>
40     virtual std::vector<size_t> getLLDecisions();
41
42     /// <summary>
43     /// Gets the total time spent during prediction across all decisions made
44     /// during parsing. This value is the sum of
45     /// <seealso cref="DecisionInfo#timeInPrediction"/> for all decisions.
46     /// </summary>
47     virtual long long getTotalTimeInPrediction();
48
49     /// <summary>
50     /// Gets the total number of SLL lookahead operations across all decisions
51     /// made during parsing. This value is the sum of
52     /// <seealso cref="DecisionInfo#SLL_TotalLook"/> for all decisions.
53     /// </summary>
54     virtual long long getTotalSLLLookaheadOps();
55
56     /// <summary>
57     /// Gets the total number of LL lookahead operations across all decisions
58     /// made during parsing. This value is the sum of
59     /// <seealso cref="DecisionInfo#LL_TotalLook"/> for all decisions.
60     /// </summary>
61     virtual long long getTotalLLLookaheadOps();
62
63     /// <summary>
64     /// Gets the total number of ATN lookahead operations for SLL prediction
65     /// across all decisions made during parsing.
66     /// </summary>
67     virtual long long getTotalSLLATNLookaheadOps();
68
69     /// <summary>
70     /// Gets the total number of ATN lookahead operations for LL prediction
71     /// across all decisions made during parsing.
72     /// </summary>
73     virtual long long getTotalLLATNLookaheadOps();
74
75     /// <summary>
76     /// Gets the total number of ATN lookahead operations for SLL and LL
77     /// prediction across all decisions made during parsing.
78     ///
79     /// <para>
80     /// This value is the sum of <seealso cref="#getTotalSLLATNLookaheadOps"/> and
81     /// <seealso cref="#getTotalLLATNLookaheadOps"/>.</para>
82     /// </summary>
83     virtual long long getTotalATNLookaheadOps();
84
85     /// <summary>
86     /// Gets the total number of DFA states stored in the DFA cache for all
87     /// decisions in the ATN.
88     /// </summary>
89     virtual size_t getDFASize();
90
91     /// <summary>
92     /// Gets the total number of DFA states stored in the DFA cache for a
93     /// particular decision.
94     /// </summary>
95     virtual size_t getDFASize(size_t decision);
96
97   protected:
98     const ProfilingATNSimulator *_atnSimulator; // non-owning, we are created by this simulator.
99   };
100
101 } // namespace atn
102 } // namespace antlr4