Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.h

    ra2dbad10 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
     
    5454
    5555        CompoundStmt( std::list<Label> labels );
    56         CompoundStmt( std::list<Statement *> stmts );
    5756        CompoundStmt( const CompoundStmt &other );
    5857        virtual ~CompoundStmt();
     
    6261        void push_front( Statement * stmt ) { kids.push_front( stmt ); }
    6362
    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;
    6867};
    6968
     
    7372        NullStmt( std::list<Label> labels );
    7473
    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;
    7978};
    8079
     
    9089        void set_expr( Expression *newValue ) { expr = newValue; }
    9190
    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;
    9695};
    9796
     
    9998  public:
    10099        bool voltile;
    101         Expression *instruction;
     100        ConstantExpr *instruction;
    102101        std::list<Expression *> output, input;
    103102        std::list<ConstantExpr *> clobber;
    104103        std::list<Label> gotolabels;
    105104
    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 );
    107106        AsmStmt( const AsmStmt &other );
    108107        virtual ~AsmStmt();
     
    110109        bool get_voltile() { return voltile; }
    111110        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; }
    117116        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; }
    119118        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; }
    121120        void set_gotolabels( const std::list<Label> &newValue ) { gotolabels = newValue; }
    122121
    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;
    127126};
    128127
     
    147146        void set_elsePart( Statement *newValue ) { elsePart = newValue; }
    148147
    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;
    153152};
    154153
     
    156155  public:
    157156        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 );
    161159        SwitchStmt( const SwitchStmt &other );
    162160        virtual ~SwitchStmt();
     
    167165        std::list<Statement *> & get_statements() { return statements; }
    168166
    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;
    175174};
    176175
     
    180179        std::list<Statement *> stmts;
    181180
    182         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);
    183182        CaseStmt( const CaseStmt &other );
    184183        virtual ~CaseStmt();
     
    195194        void set_statements( std::list<Statement *> &newValue ) { stmts = newValue; }
    196195
    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;
    202201  private:
    203202        bool _isDefault;
     
    222221        void set_isDoWhile( bool newValue ) { isDoWhile = newValue; }
    223222
    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;
    228227};
    229228
     
    248247        void set_body( Statement *newValue ) { body = newValue; }
    249248
    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;
    254253};
    255254
     
    277276        const char *get_typename() { return brType[ type ]; }
    278277
    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;
    283282  private:
    284283        static const char *brType[];
     
    296295        void set_expr( Expression *newValue ) { expr = newValue; }
    297296
    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;
    302301};
    303302
     
    320319        void set_target( Expression * newTarget ) { target = newTarget; }
    321320
    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;
    326325};
    327326
    328327class TryStmt : public Statement {
    329328  public:
    330         CompoundStmt * block;
     329        CompoundStmt *block;
    331330        std::list<CatchStmt *> handlers;
    332         FinallyStmt * finallyBlock;
     331        FinallyStmt *finallyBlock;
    333332
    334333        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
     
    343342        void set_finally( FinallyStmt *newValue ) { finallyBlock = newValue; }
    344343
    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;
    349348};
    350349
     
    371370        void set_body( Statement *newValue ) { body = newValue; }
    372371
    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;
    377376};
    378377
     
    388387        void set_block( CompoundStmt *newValue ) { block = newValue; }
    389388
    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;
    394393};
    395394
     
    425424        } orelse;
    426425
    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;
    431430
    432431};
     
    445444        void set_decl( Declaration *newValue ) { decl = newValue; }
    446445
    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;
    451450};
    452451
     
    467466        void set_callStmt( Statement * newValue ) { callStmt = newValue; }
    468467
    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
     475std::ostream & operator<<( std::ostream & out, const Statement * statement );
    474476
    475477// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.