#include <vector>
#include <iostream>
#include <stdexcept>
+#include <cassert>
extern "C" {
#include <stdint.h>
}
const token* tok1;
const std::string msg2;
const token* tok2;
-
+
~semantic_error () throw () {}
semantic_error (const std::string& msg):
runtime_error (msg), tok1 (0), tok2 (0) {}
- semantic_error (const std::string& msg, const token* t1):
+ semantic_error (const std::string& msg, const token* t1):
runtime_error (msg), tok1 (t1), tok2 (0) {}
- semantic_error (const std::string& msg, const token* t1,
- const std::string& m2, const token* t2):
+ semantic_error (const std::string& msg, const token* t1,
+ const std::string& m2, const token* t2):
runtime_error (msg), tok1 (t1), msg2 (m2), tok2 (t2) {}
};
pe_unknown,
pe_long, // int64_t
pe_string, // std::string
- pe_stats
+ pe_stats
};
std::ostream& operator << (std::ostream& o, const exp_type& e);
hist_op const *& hist_out);
class vardecl;
-struct symbol:
- public expression,
+struct symbol:
+ public expression,
public indexable
{
std::string name;
std::string base_name;
std::vector<std::pair<component_type, std::string> > components;
void print (std::ostream& o) const;
- void visit (visitor* u);
+ void visit (visitor* u);
};
fmt_flag_special = 16
};
- enum conversion_type
+ enum conversion_type
{
conv_unspecified,
conv_signed_decimal,
conv_unsigned_decimal,
conv_unsigned_octal,
conv_unsigned_uppercase_hex,
- conv_unsigned_lowercase_hex,
+ conv_unsigned_lowercase_hex,
conv_string,
conv_literal
};
std::string literal_string;
bool is_empty() const
{
- return flags == 0
+ return flags == 0
&& width == 0
&& precision == 0
&& type == conv_unspecified
}
};
- print_format()
- : hist(NULL)
+ print_format()
+ : hist(NULL)
{}
std::string raw_components;
};
struct stat_op: public expression
-{
+{
stat_component_type ctype;
expression* stat;
void print (std::ostream& o) const;
expression* stat;
std::vector<int64_t> params;
void print (std::ostream& o) const;
- void visit (visitor* u);
+ void visit (visitor* u);
// overrides of type 'indexable'
const token *get_tok() const;
bool is_const_hist_op(const hist_op *& hist_out) const;
// ------------------------------------------------------------------------
-struct symboldecl // unique object per (possibly implicit)
+struct symboldecl // unique object per (possibly implicit)
// symbol declaration
{
const token* tok;
struct probe_point
{
struct component // XXX: sort of a restricted functioncall
- {
+ {
std::string functor;
literal* arg; // optional
component ();
const token* tok; // points to first component's functor
void print (std::ostream& o) const;
probe_point ();
- probe_point(std::vector<component*> const & comps,const token * t);
+ probe_point(std::vector<component*> const & comps,const token * t);
};
std::ostream& operator << (std::ostream& o, const probe_point& k);
struct probe_alias: public probe
{
probe_alias(std::vector<probe_point*> const & aliases);
- std::vector<probe_point*> alias_names;
+ std::vector<probe_point*> alias_names;
virtual void printsig (std::ostream &o) const;
};
static statement *deep_copy (statement *s);
static block *deep_copy (block *s);
-
+
virtual void visit_block (block *s);
virtual void visit_embeddedcode (embeddedcode *s);
virtual void visit_null_statement (null_statement *s);
{
symbol *array_src=NULL, *array_dst=NULL;
hist_op *hist_src=NULL, *hist_dst=NULL;
-
+
classify_indexable(src, array_src, hist_src);
-
+
*dst = NULL;
-
+
if (array_src)
{
require <symbol*> (v, &array_dst, array_src);