DynAST.h File Reference
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include "util.h"
#include "boost/enable_shared_from_this.hpp"
Go to the source code of this file.
Define Documentation
| #define DEF_AST_INTERNAL_TYPE |
( |
name, |
|
|
type |
|
) |
|
| #define DEF_AST_LEAF_TYPE |
( |
name, |
|
|
type |
|
) |
|
Value:class name : public AST { \
public: \
typedef boost::shared_ptr<name> Ptr; \
static Ptr create(type t) { return Ptr(new name(t)); } \
virtual ~name() {}; \
virtual const std::string format() const { \
std::stringstream ret; \
ret << "<" << t_ << ">"; \
return ret.str(); \
} \
virtual AST::Ptr accept(ASTVisitor *v) { return v->visit(this); } \
virtual ID getID() const { return V_##name; } \
static Ptr convert(AST::Ptr a) { \
return ((a->getID() == V_##name) ? boost::static_pointer_cast<name>(a) : Ptr()); \
} \
const type &val() const { return t_; } \
private: \
name(type t) : t_(t) {}; \
virtual bool isStrictEqual(const AST &rhs) const { \
const name &other(dynamic_cast<const name&>(rhs)); \
return t_ == other.t_; \
} \
const type t_; \
}; \
Definition at line 87 of file DynAST.h.