Changes in src/SynTree/Statement.h [a2dbad10:70d826cd]
- File:
-
- 1 edited
-
src/SynTree/Statement.h (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.h
ra2dbad10 r70d826cd 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Sep 3 20:46:46201713 // Update Count : 7 712 // Last Modified On : Thu Aug 17 15:37:53 2017 13 // Update Count : 72 14 14 // 15 15 … … 44 44 45 45 virtual Statement *clone() const = 0; 46 virtual void accept( Visitor &v ) override= 0;46 virtual void accept( Visitor &v ) = 0; 47 47 virtual Statement *acceptMutator( Mutator &m ) = 0; 48 virtual void print( std::ostream &os, int indent = 0 ) const override;48 virtual void print( std::ostream &os, int indent = 0 ) const; 49 49 }; 50 50 … … 54 54 55 55 CompoundStmt( std::list<Label> labels ); 56 CompoundStmt( std::list<Statement *> stmts );57 56 CompoundStmt( const CompoundStmt &other ); 58 57 virtual ~CompoundStmt(); … … 62 61 void push_front( Statement * stmt ) { kids.push_front( stmt ); } 63 62 64 virtual CompoundStmt *clone() const override{ return new CompoundStmt( *this ); }65 virtual void accept( Visitor &v ) override{ v.visit( this ); }66 virtual CompoundStmt *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }67 virtual void print( std::ostream &os, int indent = 0 ) const override;63 virtual CompoundStmt *clone() const { return new CompoundStmt( *this ); } 64 virtual void accept( Visitor &v ) { v.visit( this ); } 65 virtual CompoundStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); } 66 virtual void print( std::ostream &os, int indent = 0 ) const; 68 67 }; 69 68 … … 73 72 NullStmt( std::list<Label> labels ); 74 73 75 virtual NullStmt *clone() const override{ return new NullStmt( *this ); }76 virtual void accept( Visitor &v ) override{ v.visit( this ); }77 virtual NullStmt *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }78 virtual void print( std::ostream &os, int indent = 0 ) const override;74 virtual NullStmt *clone() const { return new NullStmt( *this ); } 75 virtual void accept( Visitor &v ) { v.visit( this ); } 76 virtual NullStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); } 77 virtual void print( std::ostream &os, int indent = 0 ) const; 79 78 }; 80 79 … … 90 89 void set_expr( Expression *newValue ) { expr = newValue; } 91 90 92 virtual ExprStmt *clone() const override{ return new ExprStmt( *this ); }93 virtual void accept( Visitor &v ) override{ v.visit( this ); }94 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }95 virtual void print( std::ostream &os, int indent = 0 ) const override;91 virtual ExprStmt *clone() const { return new ExprStmt( *this ); } 92 virtual void accept( Visitor &v ) { v.visit( this ); } 93 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 94 virtual void print( std::ostream &os, int indent = 0 ) const; 96 95 }; 97 96 … … 99 98 public: 100 99 bool voltile; 101 Expression*instruction;100 ConstantExpr *instruction; 102 101 std::list<Expression *> output, input; 103 102 std::list<ConstantExpr *> clobber; 104 103 std::list<Label> gotolabels; 105 104 106 AsmStmt( std::list<Label> labels, bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );105 AsmStmt( std::list<Label> labels, bool voltile, ConstantExpr *instruction, std::list<Expression *> input, std::list<Expression *> output, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ); 107 106 AsmStmt( const AsmStmt &other ); 108 107 virtual ~AsmStmt(); … … 110 109 bool get_voltile() { return voltile; } 111 110 void set_voltile( bool newValue ) { voltile = newValue; } 112 Expression *get_instruction() { return instruction; }113 void set_instruction( Expression *newValue ) { instruction = newValue; }114 std::list<Expression *> & get_output() { return output; }115 void set_output( const std::list<Expression *> & newValue ) { output = newValue; }116 std::list<Expression *> & get_input() { return input; }111 ConstantExpr *get_instruction() { return instruction; } 112 void set_instruction( ConstantExpr *newValue ) { instruction = newValue; } 113 std::list<Expression *> &get_output() { return output; } 114 void set_output( const std::list<Expression *> &newValue ) { output = newValue; } 115 std::list<Expression *> &get_input() { return input; } 117 116 void set_input( const std::list<Expression *> &newValue ) { input = newValue; } 118 std::list<ConstantExpr *> & get_clobber() { return clobber; }117 std::list<ConstantExpr *> &get_clobber() { return clobber; } 119 118 void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; } 120 std::list<Label> & get_gotolabels() { return gotolabels; }119 std::list<Label> &get_gotolabels() { return gotolabels; } 121 120 void set_gotolabels( const std::list<Label> &newValue ) { gotolabels = newValue; } 122 121 123 virtual AsmStmt * clone() const { return new AsmStmt( *this ); }124 virtual void accept( Visitor & v ) { v.visit( this ); }125 virtual Statement * acceptMutator( Mutator &m ) { return m.mutate( this ); }126 virtual void print( std::ostream & os, int indent = 0 ) const;122 virtual AsmStmt *clone() const { return new AsmStmt( *this ); } 123 virtual void accept( Visitor &v ) { v.visit( this ); } 124 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 125 virtual void print( std::ostream &os, int indent = 0 ) const; 127 126 }; 128 127 … … 147 146 void set_elsePart( Statement *newValue ) { elsePart = newValue; } 148 147 149 virtual IfStmt *clone() const override{ return new IfStmt( *this ); }150 virtual void accept( Visitor &v ) override{ v.visit( this ); }151 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }152 virtual void print( std::ostream &os, int indent = 0 ) const override;148 virtual IfStmt *clone() const { return new IfStmt( *this ); } 149 virtual void accept( Visitor &v ) { v.visit( this ); } 150 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 151 virtual void print( std::ostream &os, int indent = 0 ) const; 153 152 }; 154 153 … … 156 155 public: 157 156 Expression * condition; 158 std::list<Statement *> statements; 159 160 SwitchStmt( std::list<Label> labels, Expression *condition, const std::list<Statement *> &statements ); 157 158 SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements ); 161 159 SwitchStmt( const SwitchStmt &other ); 162 160 virtual ~SwitchStmt(); … … 167 165 std::list<Statement *> & get_statements() { return statements; } 168 166 169 virtual void accept( Visitor &v ) override { v.visit( this ); } 170 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 171 172 virtual SwitchStmt *clone() const override { return new SwitchStmt( *this ); } 173 virtual void print( std::ostream &os, int indent = 0 ) const override; 174 167 virtual void accept( Visitor &v ) { v.visit( this ); } 168 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 169 170 virtual SwitchStmt *clone() const { return new SwitchStmt( *this ); } 171 virtual void print( std::ostream &os, int indent = 0 ) const; 172 private: 173 std::list<Statement *> statements; 175 174 }; 176 175 … … 180 179 std::list<Statement *> stmts; 181 180 182 CaseStmt( std::list<Label> labels, Expression *conditions, conststd::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);181 CaseStmt( std::list<Label> labels, Expression *conditions, std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError); 183 182 CaseStmt( const CaseStmt &other ); 184 183 virtual ~CaseStmt(); … … 195 194 void set_statements( std::list<Statement *> &newValue ) { stmts = newValue; } 196 195 197 virtual void accept( Visitor &v ) override{ v.visit( this ); }198 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }199 200 virtual CaseStmt *clone() const override{ return new CaseStmt( *this ); }201 virtual void print( std::ostream &os, int indent = 0 ) const override;196 virtual void accept( Visitor &v ) { v.visit( this ); } 197 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 198 199 virtual CaseStmt *clone() const { return new CaseStmt( *this ); } 200 virtual void print( std::ostream &os, int indent = 0 ) const; 202 201 private: 203 202 bool _isDefault; … … 222 221 void set_isDoWhile( bool newValue ) { isDoWhile = newValue; } 223 222 224 virtual WhileStmt *clone() const override{ return new WhileStmt( *this ); }225 virtual void accept( Visitor &v ) override{ v.visit( this ); }226 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }227 virtual void print( std::ostream &os, int indent = 0 ) const override;223 virtual WhileStmt *clone() const { return new WhileStmt( *this ); } 224 virtual void accept( Visitor &v ) { v.visit( this ); } 225 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 226 virtual void print( std::ostream &os, int indent = 0 ) const; 228 227 }; 229 228 … … 248 247 void set_body( Statement *newValue ) { body = newValue; } 249 248 250 virtual ForStmt *clone() const override{ return new ForStmt( *this ); }251 virtual void accept( Visitor &v ) override{ v.visit( this ); }252 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }253 virtual void print( std::ostream &os, int indent = 0 ) const override;249 virtual ForStmt *clone() const { return new ForStmt( *this ); } 250 virtual void accept( Visitor &v ) { v.visit( this ); } 251 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 252 virtual void print( std::ostream &os, int indent = 0 ) const; 254 253 }; 255 254 … … 277 276 const char *get_typename() { return brType[ type ]; } 278 277 279 virtual BranchStmt *clone() const override{ return new BranchStmt( *this ); }280 virtual void accept( Visitor &v ) override{ v.visit( this ); }281 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }282 virtual void print( std::ostream &os, int indent = 0 ) const override;278 virtual BranchStmt *clone() const { return new BranchStmt( *this ); } 279 virtual void accept( Visitor &v ) { v.visit( this ); } 280 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 281 virtual void print( std::ostream &os, int indent = 0 ) const; 283 282 private: 284 283 static const char *brType[]; … … 296 295 void set_expr( Expression *newValue ) { expr = newValue; } 297 296 298 virtual ReturnStmt *clone() const override{ return new ReturnStmt( *this ); }299 virtual void accept( Visitor &v ) override{ v.visit( this ); }300 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }301 virtual void print( std::ostream &os, int indent = 0 ) const override;297 virtual ReturnStmt *clone() const { return new ReturnStmt( *this ); } 298 virtual void accept( Visitor &v ) { v.visit( this ); } 299 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 300 virtual void print( std::ostream &os, int indent = 0 ) const; 302 301 }; 303 302 … … 320 319 void set_target( Expression * newTarget ) { target = newTarget; } 321 320 322 virtual ThrowStmt *clone() const override{ return new ThrowStmt( *this ); }323 virtual void accept( Visitor &v ) override{ v.visit( this ); }324 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }325 virtual void print( std::ostream &os, int indent = 0 ) const override;321 virtual ThrowStmt *clone() const { return new ThrowStmt( *this ); } 322 virtual void accept( Visitor &v ) { v.visit( this ); } 323 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 324 virtual void print( std::ostream &os, int indent = 0 ) const; 326 325 }; 327 326 328 327 class TryStmt : public Statement { 329 328 public: 330 CompoundStmt * block;329 CompoundStmt *block; 331 330 std::list<CatchStmt *> handlers; 332 FinallyStmt * finallyBlock;331 FinallyStmt *finallyBlock; 333 332 334 333 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 ); … … 343 342 void set_finally( FinallyStmt *newValue ) { finallyBlock = newValue; } 344 343 345 virtual TryStmt *clone() const override{ return new TryStmt( *this ); }346 virtual void accept( Visitor &v ) override{ v.visit( this ); }347 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }348 virtual void print( std::ostream &os, int indent = 0 ) const override;344 virtual TryStmt *clone() const { return new TryStmt( *this ); } 345 virtual void accept( Visitor &v ) { v.visit( this ); } 346 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 347 virtual void print( std::ostream &os, int indent = 0 ) const; 349 348 }; 350 349 … … 371 370 void set_body( Statement *newValue ) { body = newValue; } 372 371 373 virtual CatchStmt *clone() const override{ return new CatchStmt( *this ); }374 virtual void accept( Visitor &v ) override{ v.visit( this ); }375 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }376 virtual void print( std::ostream &os, int indent = 0 ) const override;372 virtual CatchStmt *clone() const { return new CatchStmt( *this ); } 373 virtual void accept( Visitor &v ) { v.visit( this ); } 374 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 375 virtual void print( std::ostream &os, int indent = 0 ) const; 377 376 }; 378 377 … … 388 387 void set_block( CompoundStmt *newValue ) { block = newValue; } 389 388 390 virtual FinallyStmt *clone() const override{ return new FinallyStmt( *this ); }391 virtual void accept( Visitor &v ) override{ v.visit( this ); }392 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }393 virtual void print( std::ostream &os, int indent = 0 ) const override;389 virtual FinallyStmt *clone() const { return new FinallyStmt( *this ); } 390 virtual void accept( Visitor &v ) { v.visit( this ); } 391 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 392 virtual void print( std::ostream &os, int indent = 0 ) const; 394 393 }; 395 394 … … 425 424 } orelse; 426 425 427 virtual WaitForStmt *clone() const override{ return new WaitForStmt( *this ); }428 virtual void accept( Visitor &v ) override{ v.visit( this ); }429 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }430 virtual void print( std::ostream &os, int indent = 0 ) const override;426 virtual WaitForStmt *clone() const { return new WaitForStmt( *this ); } 427 virtual void accept( Visitor &v ) { v.visit( this ); } 428 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 429 virtual void print( std::ostream &os, int indent = 0 ) const; 431 430 432 431 }; … … 445 444 void set_decl( Declaration *newValue ) { decl = newValue; } 446 445 447 virtual DeclStmt *clone() const override{ return new DeclStmt( *this ); }448 virtual void accept( Visitor &v ) override{ v.visit( this ); }449 virtual Statement *acceptMutator( Mutator &m ) override{ return m.mutate( this ); }450 virtual void print( std::ostream &os, int indent = 0 ) const override;446 virtual DeclStmt *clone() const { return new DeclStmt( *this ); } 447 virtual void accept( Visitor &v ) { v.visit( this ); } 448 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 449 virtual void print( std::ostream &os, int indent = 0 ) const; 451 450 }; 452 451 … … 467 466 void set_callStmt( Statement * newValue ) { callStmt = newValue; } 468 467 469 virtual ImplicitCtorDtorStmt *clone() const override { return new ImplicitCtorDtorStmt( *this ); } 470 virtual void accept( Visitor &v ) override { v.visit( this ); } 471 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 472 virtual void print( std::ostream &os, int indent = 0 ) const override; 473 }; 468 virtual ImplicitCtorDtorStmt *clone() const { return new ImplicitCtorDtorStmt( *this ); } 469 virtual void accept( Visitor &v ) { v.visit( this ); } 470 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 471 virtual void print( std::ostream &os, int indent = 0 ) const; 472 }; 473 474 475 std::ostream & operator<<( std::ostream & out, const Statement * statement ); 474 476 475 477 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.