Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.h

    re149f77 r70d826cd  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep  3 20:46:46 2017
    13 // Update Count     : 77
     12// Last Modified On : Thu Aug 17 15:37:53 2017
     13// Update Count     : 72
    1414//
    1515
     
    4444
    4545        virtual Statement *clone() const = 0;
    46         virtual void accept( Visitor &v ) override = 0;
     46        virtual void accept( Visitor &v ) = 0;
    4747        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;
    4949};
    5050
     
    6161        void push_front( Statement * stmt ) { kids.push_front( stmt ); }
    6262
    63         virtual CompoundStmt *clone() const override { return new CompoundStmt( *this ); }
    64         virtual void accept( Visitor &v ) override { v.visit( this ); }
    65         virtual CompoundStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    66         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;
    6767};
    6868
     
    7272        NullStmt( std::list<Label> labels );
    7373
    74         virtual NullStmt *clone() const override { return new NullStmt( *this ); }
    75         virtual void accept( Visitor &v ) override { v.visit( this ); }
    76         virtual NullStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    77         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;
    7878};
    7979
     
    8989        void set_expr( Expression *newValue ) { expr = newValue; }
    9090
    91         virtual ExprStmt *clone() const override { return new ExprStmt( *this ); }
    92         virtual void accept( Visitor &v ) override { v.visit( this ); }
    93         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    94         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;
    9595};
    9696
     
    9898  public:
    9999        bool voltile;
    100         Expression *instruction;
     100        ConstantExpr *instruction;
    101101        std::list<Expression *> output, input;
    102102        std::list<ConstantExpr *> clobber;
    103103        std::list<Label> gotolabels;
    104104
    105         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 );
    106106        AsmStmt( const AsmStmt &other );
    107107        virtual ~AsmStmt();
     
    109109        bool get_voltile() { return voltile; }
    110110        void set_voltile( bool newValue ) { voltile = newValue; }
    111         Expression * get_instruction() { return instruction; }
    112         void set_instruction( Expression * 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; }
     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; }
    116116        void set_input( const std::list<Expression *> &newValue ) { input = newValue; }
    117         std::list<ConstantExpr *> & get_clobber() { return clobber; }
     117        std::list<ConstantExpr *> &get_clobber() { return clobber; }
    118118        void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; }
    119         std::list<Label> & get_gotolabels() { return gotolabels; }
     119        std::list<Label> &get_gotolabels() { return gotolabels; }
    120120        void set_gotolabels( const std::list<Label> &newValue ) { gotolabels = newValue; }
    121121
    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;
     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;
    126126};
    127127
     
    146146        void set_elsePart( Statement *newValue ) { elsePart = newValue; }
    147147
    148         virtual IfStmt *clone() const override { return new IfStmt( *this ); }
    149         virtual void accept( Visitor &v ) override { v.visit( this ); }
    150         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    151         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;
    152152};
    153153
     
    155155  public:
    156156        Expression * condition;
    157         std::list<Statement *> statements;
    158 
    159         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 );
    160159        SwitchStmt( const SwitchStmt &other );
    161160        virtual ~SwitchStmt();
     
    166165        std::list<Statement *> & get_statements() { return statements; }
    167166
    168         virtual void accept( Visitor &v ) override { v.visit( this ); }
    169         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    170 
    171         virtual SwitchStmt *clone() const override { return new SwitchStmt( *this ); }
    172         virtual void print( std::ostream &os, int indent = 0 ) const override;
    173 
     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;
    174174};
    175175
     
    179179        std::list<Statement *> stmts;
    180180
    181         CaseStmt( std::list<Label> labels, Expression *conditions, const std::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);
    182182        CaseStmt( const CaseStmt &other );
    183183        virtual ~CaseStmt();
     
    194194        void set_statements( std::list<Statement *> &newValue ) { stmts = newValue; }
    195195
    196         virtual void accept( Visitor &v ) override { v.visit( this ); }
    197         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    198 
    199         virtual CaseStmt *clone() const override { return new CaseStmt( *this ); }
    200         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;
    201201  private:
    202202        bool _isDefault;
     
    221221        void set_isDoWhile( bool newValue ) { isDoWhile = newValue; }
    222222
    223         virtual WhileStmt *clone() const override { return new WhileStmt( *this ); }
    224         virtual void accept( Visitor &v ) override { v.visit( this ); }
    225         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    226         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;
    227227};
    228228
     
    247247        void set_body( Statement *newValue ) { body = newValue; }
    248248
    249         virtual ForStmt *clone() const override { return new ForStmt( *this ); }
    250         virtual void accept( Visitor &v ) override { v.visit( this ); }
    251         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    252         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;
    253253};
    254254
     
    276276        const char *get_typename() { return brType[ type ]; }
    277277
    278         virtual BranchStmt *clone() const override { return new BranchStmt( *this ); }
    279         virtual void accept( Visitor &v ) override { v.visit( this ); }
    280         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    281         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;
    282282  private:
    283283        static const char *brType[];
     
    295295        void set_expr( Expression *newValue ) { expr = newValue; }
    296296
    297         virtual ReturnStmt *clone() const override { return new ReturnStmt( *this ); }
    298         virtual void accept( Visitor &v ) override { v.visit( this ); }
    299         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    300         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;
    301301};
    302302
     
    319319        void set_target( Expression * newTarget ) { target = newTarget; }
    320320
    321         virtual ThrowStmt *clone() const override { return new ThrowStmt( *this ); }
    322         virtual void accept( Visitor &v ) override { v.visit( this ); }
    323         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    324         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;
    325325};
    326326
    327327class TryStmt : public Statement {
    328328  public:
    329         CompoundStmt * block;
     329        CompoundStmt *block;
    330330        std::list<CatchStmt *> handlers;
    331         FinallyStmt * finallyBlock;
     331        FinallyStmt *finallyBlock;
    332332
    333333        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
     
    342342        void set_finally( FinallyStmt *newValue ) { finallyBlock = newValue; }
    343343
    344         virtual TryStmt *clone() const override { return new TryStmt( *this ); }
    345         virtual void accept( Visitor &v ) override { v.visit( this ); }
    346         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    347         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;
    348348};
    349349
     
    370370        void set_body( Statement *newValue ) { body = newValue; }
    371371
    372         virtual CatchStmt *clone() const override { return new CatchStmt( *this ); }
    373         virtual void accept( Visitor &v ) override { v.visit( this ); }
    374         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    375         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;
    376376};
    377377
     
    387387        void set_block( CompoundStmt *newValue ) { block = newValue; }
    388388
    389         virtual FinallyStmt *clone() const override { return new FinallyStmt( *this ); }
    390         virtual void accept( Visitor &v ) override { v.visit( this ); }
    391         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    392         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;
    393393};
    394394
     
    424424        } orelse;
    425425
    426         virtual WaitForStmt *clone() const override { return new WaitForStmt( *this ); }
    427         virtual void accept( Visitor &v ) override { v.visit( this ); }
    428         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    429         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;
    430430
    431431};
     
    444444        void set_decl( Declaration *newValue ) { decl = newValue; }
    445445
    446         virtual DeclStmt *clone() const override { return new DeclStmt( *this ); }
    447         virtual void accept( Visitor &v ) override { v.visit( this ); }
    448         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    449         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;
    450450};
    451451
     
    466466        void set_callStmt( Statement * newValue ) { callStmt = newValue; }
    467467
    468         virtual ImplicitCtorDtorStmt *clone() const override { return new ImplicitCtorDtorStmt( *this ); }
    469         virtual void accept( Visitor &v ) override { v.visit( this ); }
    470         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    471         virtual void print( std::ostream &os, int indent = 0 ) const override;
    472 };
     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
     475std::ostream & operator<<( std::ostream & out, const Statement * statement );
    473476
    474477// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.