X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramsyntax.h;h=03b5aa8863d1e70af4e9be52383431ed9b331a96;hb=2b073e0a3808f8ece4b93669395e4b812214cf5d;hp=c645a60a442ec91a616060f11c55327e9a34d4f6;hpb=a29cc14162e911b36d18d1d1896216697c7dc0c1;p=libs%2Fgl.git diff --git a/source/programsyntax.h b/source/programsyntax.h index c645a60a..03b5aa88 100644 --- a/source/programsyntax.h +++ b/source/programsyntax.h @@ -33,6 +33,10 @@ public: NodePtr(T *n = 0): node(n) { } NodePtr(const NodePtr &p): node(clone(p.node)) { } NodePtr &operator=(const NodePtr &p) { delete node; node = clone(p.node); return *this; } +#if __cplusplus>=201103L + NodePtr(NodePtr &&p): node(p.node) { p.node = 0; } + NodePtr &operator=(NodePtr &&p) { delete node; node = p.node; p.node = 0; return *this; } +#endif ~NodePtr() { delete node; } private: @@ -122,14 +126,22 @@ struct BinaryExpression: Expression std::string oper; NodePtr right; std::string after; - bool assignment; - - BinaryExpression(); virtual BinaryExpression *clone() const { return new BinaryExpression(*this); } virtual void visit(NodeVisitor &); }; +struct Assignment: BinaryExpression +{ + bool self_referencing; + VariableDeclaration *target_declaration; + + Assignment(); + + virtual Assignment *clone() const { return new Assignment(*this); } + virtual void visit(NodeVisitor &); +}; + struct FunctionCall: Expression { std::string name; @@ -200,6 +212,8 @@ struct InterfaceBlock: Node std::string interface; std::string name; Block members; + std::string instance_name; + bool array; InterfaceBlock(); @@ -223,7 +237,7 @@ struct FunctionDeclaration: Node struct Conditional: Node { - Expression *condition; + NodePtr condition; Block body; Block else_body; @@ -269,6 +283,7 @@ struct NodeVisitor virtual void visit(MemberAccess &) { } virtual void visit(UnaryExpression &) { } virtual void visit(BinaryExpression &) { } + virtual void visit(Assignment &); virtual void visit(FunctionCall &) { } virtual void visit(ExpressionStatement &) { } virtual void visit(Layout &) { }