X-Git-Url: https://gitweb.ps.run/toc/blobdiff_plain/9f94b672a5dc32da5ad01742bd4e976315a30d9c..c6ad2948bb98d42f8e0883ef82cd14cd2d5eda60:/antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionInfo.h
diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionInfo.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionInfo.h
new file mode 100644
index 0000000..cfbb2e9
--- /dev/null
+++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionInfo.h
@@ -0,0 +1,227 @@
+/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
+ * Use of this file is governed by the BSD 3-clause license that
+ * can be found in the LICENSE.txt file in the project root.
+ */
+
+#pragma once
+
+#include "atn/ContextSensitivityInfo.h"
+#include "atn/AmbiguityInfo.h"
+#include "atn/PredicateEvalInfo.h"
+#include "atn/ErrorInfo.h"
+
+namespace antlr4 {
+namespace atn {
+
+ class LookaheadEventInfo;
+
+ ///
+ /// This class contains profiling gathered for a particular decision.
+ ///
+ ///
+ /// Parsing performance in ANTLR 4 is heavily influenced by both static factors
+ /// (e.g. the form of the rules in the grammar) and dynamic factors (e.g. the
+ /// choice of input and the state of the DFA cache at the time profiling
+ /// operations are started). For best results, gather and use aggregate
+ /// statistics from a large sample of inputs representing the inputs expected in
+ /// production before using the results to make changes in the grammar.
+ ///
+ /// @since 4.3
+ ///
+ class ANTLR4CPP_PUBLIC DecisionInfo {
+ public:
+ ///
+ /// The decision number, which is an index into .
+ ///
+ const size_t decision;
+
+ ///
+ /// The total number of times was
+ /// invoked for this decision.
+ ///
+ long long invocations = 0;
+
+ ///
+ /// The total time spent in for
+ /// this decision, in nanoseconds.
+ ///
+ ///
+ /// The value of this field contains the sum of differential results obtained
+ /// by , and is not adjusted to compensate for JIT
+ /// and/or garbage collection overhead. For best accuracy, use a modern JVM
+ /// implementation that provides precise results from
+ /// , and perform profiling in a separate process
+ /// which is warmed up by parsing the input prior to profiling. If desired,
+ /// call to reset the DFA cache to its initial
+ /// state before starting the profiling measurement pass.
+ ///
+ long long timeInPrediction = 0;
+
+ ///
+ /// The sum of the lookahead required for SLL prediction for this decision.
+ /// Note that SLL prediction is used before LL prediction for performance
+ /// reasons even when or
+ /// is used.
+ ///
+ long long SLL_TotalLook = 0;
+
+ ///
+ /// Gets the minimum lookahead required for any single SLL prediction to
+ /// complete for this decision, by reaching a unique prediction, reaching an
+ /// SLL conflict state, or encountering a syntax error.
+ ///
+ long long SLL_MinLook = 0;
+
+ ///
+ /// Gets the maximum lookahead required for any single SLL prediction to
+ /// complete for this decision, by reaching a unique prediction, reaching an
+ /// SLL conflict state, or encountering a syntax error.
+ ///
+ long long SLL_MaxLook = 0;
+
+ /// Gets the associated with the event where the
+ /// value was set.
+ Ref SLL_MaxLookEvent;
+
+ ///
+ /// The sum of the lookahead required for LL prediction for this decision.
+ /// Note that LL prediction is only used when SLL prediction reaches a
+ /// conflict state.
+ ///
+ long long LL_TotalLook = 0;
+
+ ///
+ /// Gets the minimum lookahead required for any single LL prediction to
+ /// complete for this decision. An LL prediction completes when the algorithm
+ /// reaches a unique prediction, a conflict state (for
+ /// , an ambiguity state (for
+ /// , or a syntax error.
+ ///
+ long long LL_MinLook = 0;
+
+ ///
+ /// Gets the maximum lookahead required for any single LL prediction to
+ /// complete for this decision. An LL prediction completes when the algorithm
+ /// reaches a unique prediction, a conflict state (for
+ /// , an ambiguity state (for
+ /// , or a syntax error.
+ ///
+ long long LL_MaxLook = 0;
+
+ ///
+ /// Gets the associated with the event where the
+ /// value was set.
+ ///
+ Ref LL_MaxLookEvent;
+
+ ///
+ /// A collection of instances describing the
+ /// context sensitivities encountered during LL prediction for this decision.
+ ///
+ ///
+ std::vector contextSensitivities;
+
+ ///
+ /// A collection of instances describing the parse errors
+ /// identified during calls to for
+ /// this decision.
+ ///
+ ///
+ std::vector errors;
+
+ ///
+ /// A collection of instances describing the
+ /// ambiguities encountered during LL prediction for this decision.
+ ///
+ ///
+ std::vector ambiguities;
+
+ ///
+ /// A collection of instances describing the
+ /// results of evaluating individual predicates during prediction for this
+ /// decision.
+ ///
+ ///
+ std::vector predicateEvals;
+
+ ///
+ /// The total number of ATN transitions required during SLL prediction for
+ /// this decision. An ATN transition is determined by the number of times the
+ /// DFA does not contain an edge that is required for prediction, resulting
+ /// in on-the-fly computation of that edge.
+ ///
+ ///
+ /// If DFA caching of SLL transitions is employed by the implementation, ATN
+ /// computation may cache the computed edge for efficient lookup during
+ /// future parsing of this decision. Otherwise, the SLL parsing algorithm
+ /// will use ATN transitions exclusively.
+ ///
+ ///
+ ///
+ ///
+ long long SLL_ATNTransitions = 0;
+
+ ///
+ /// The total number of DFA transitions required during SLL prediction for
+ /// this decision.
+ ///
+ /// If the ATN simulator implementation does not use DFA caching for SLL
+ /// transitions, this value will be 0.
+ ///
+ ///
+ ///
+ long long SLL_DFATransitions = 0;
+
+ ///
+ /// Gets the total number of times SLL prediction completed in a conflict
+ /// state, resulting in fallback to LL prediction.
+ ///
+ /// Note that this value is not related to whether or not
+ /// may be used successfully with a particular
+ /// grammar. If the ambiguity resolution algorithm applied to the SLL
+ /// conflicts for this decision produce the same result as LL prediction for
+ /// this decision, would produce the same overall
+ /// parsing result as .
+ ///
+ long long LL_Fallback = 0;
+
+ ///
+ /// The total number of ATN transitions required during LL prediction for
+ /// this decision. An ATN transition is determined by the number of times the
+ /// DFA does not contain an edge that is required for prediction, resulting
+ /// in on-the-fly computation of that edge.
+ ///
+ ///
+ /// If DFA caching of LL transitions is employed by the implementation, ATN
+ /// computation may cache the computed edge for efficient lookup during
+ /// future parsing of this decision. Otherwise, the LL parsing algorithm will
+ /// use ATN transitions exclusively.
+ ///
+ ///
+ ///
+ ///
+ long long LL_ATNTransitions = 0;
+
+ ///
+ /// The total number of DFA transitions required during LL prediction for
+ /// this decision.
+ ///
+ /// If the ATN simulator implementation does not use DFA caching for LL
+ /// transitions, this value will be 0.
+ ///
+ ///
+ ///
+ long long LL_DFATransitions = 0;
+
+ ///
+ /// Constructs a new instance of the class to contain
+ /// statistics for a particular decision.
+ ///
+ /// The decision number
+ DecisionInfo(size_t decision);
+
+ std::string toString() const;
+ };
+
+} // namespace atn
+} // namespace antlr4