13#include "sparta/statistics/Expression.hpp"
15#include "sparta/statistics/ExpressionGrammar.hpp"
21 namespace statistics {
22 namespace expression {
52 std::vector<const TreeNode*>& already_used,
54 grammar_(n, already_used, report_si)
58 using boost::spirit::ascii::space;
60 std::string::const_iterator iter = input.begin();
61 std::string::const_iterator end = input.
end();
62 bool r = qi::phrase_parse(iter, end, grammar_, space, parse_temp_);
64 if (!r || iter != end){
65 throw SpartaException(
"Parsing expression \"") << input <<
"\" failed to parse remainder"
66 <<
" \"" << std::string(iter, end) <<
"\". Note that this does not indicate which "
67 "part of the expression was wrong, but how much the recursive parser could "
71 return std::move(parse_temp_);
This exists mainly to remove circular dependencies on StatVariable and SimVariable: Expression -> Sta...
Set of macros for Sparta assertions. Caught by the framework.
Exception class for all of Sparta.
Contains a StatisticInstance which refers to a StatisticDef or Counter and some local state to comput...
Basic Node framework in sparta device tree composite pattern.
Used to construct and throw a standard C++ exception. Inherits from std::exception.
Node in a composite tree representing a sparta Tree item.
Class for parsing statistical expressions based on a specific TreeNode context.
ExpressionParser(TreeNode *n, std::vector< const TreeNode * > &already_used, const StatisticPairs &report_si)
Construct a parser in the context of a specific TreeNode.
Expression container/builder. Contains a single ExpressionNode representing the root of an expression...
void end()
Notify every item in this expression to end the current computation window.
std::vector< stat_pair_t > StatisticPairs
Type for storing a list of stat_pair_t.
Macros for handling exponential backoff.