Changeset ff29f08 for src/SynTree


Ignore:
Timestamp:
May 18, 2018, 2:09:21 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
2472a19
Parents:
f6f0cca3 (diff), c7d8100c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/master' into with_gc

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.h

    rf6f0cca3 rff29f08  
    3939        virtual Statement * mutate( ExprStmt * exprStmt ) = 0;
    4040        virtual Statement * mutate( AsmStmt * asmStmt ) = 0;
     41        virtual Statement * mutate( DirectiveStmt * dirStmt ) = 0;
    4142        virtual Statement * mutate( IfStmt * ifStmt ) = 0;
    4243        virtual Statement * mutate( WhileStmt * whileStmt ) = 0;
  • src/SynTree/Statement.cc

    rf6f0cca3 rff29f08  
    8181
    8282
     83DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {}
     84
     85void DirectiveStmt::print( std::ostream &os, Indenter ) const {
     86        os << "GCC Directive:" << directive << endl;
     87}
     88
     89
    8390const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    8491
     
    370377void WaitForStmt::print( std::ostream &os, Indenter indent ) const {
    371378        os << "Waitfor Statement" << endl;
    372         os << indent << "... with block:" << endl << indent+1;
    373         // block->print( os, indent + 4 );
     379        indent += 1;
     380        for( auto & clause : clauses ) {
     381                os << indent << "target function :";
     382                if(clause.target.function) { clause.target.function->print(os, indent + 1); }
     383                os << endl << indent << "with arguments :" << endl;
     384                for( auto & thing : clause.target.arguments) {
     385                        if(thing) { thing->print(os, indent + 1); }
     386                }
     387                os << indent << " with statment :" << endl;
     388                if(clause.statement) { clause.statement->print(os, indent + 1); }
     389
     390                os << indent << " with condition :" << endl;
     391                if(clause.condition) { clause.condition->print(os, indent + 1); }
     392        }
     393
     394        os << indent << " timeout of :" << endl;
     395        if(timeout.time) { timeout.time->print(os, indent + 1); }
     396
     397        os << indent << " with statment :" << endl;
     398        if(timeout.statement) { timeout.statement->print(os, indent + 1); }
     399
     400        os << indent << " with condition :" << endl;
     401        if(timeout.condition) { timeout.condition->print(os, indent + 1); }
     402
     403
     404        os << indent << " else :" << endl;
     405        if(orelse.statement) { orelse.statement->print(os, indent + 1); }
     406
     407        os << indent << " with condition :" << endl;
     408        if(orelse.condition) { orelse.condition->print(os, indent + 1); }
    374409}
    375410
  • src/SynTree/Statement.h

    rf6f0cca3 rff29f08  
    122122};
    123123
     124class DirectiveStmt : public Statement {
     125        public:
     126        std::string directive;
     127
     128        DirectiveStmt( const std::string & );
     129        virtual ~DirectiveStmt(){}
     130
     131        virtual DirectiveStmt * clone() const { return new DirectiveStmt( *this ); }
     132        virtual void accept( Visitor & v ) { v.visit( this ); }
     133        virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     134        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     135};
     136
    124137class IfStmt : public Statement {
    125138  public:
  • src/SynTree/SynTree.h

    rf6f0cca3 rff29f08  
    4444class ExprStmt;
    4545class AsmStmt;
     46class DirectiveStmt;
    4647class IfStmt;
    4748class WhileStmt;
  • src/SynTree/Visitor.h

    rf6f0cca3 rff29f08  
    4141        virtual void visit( ExprStmt * exprStmt ) = 0;
    4242        virtual void visit( AsmStmt * asmStmt ) = 0;
     43        virtual void visit( DirectiveStmt * directiveStmt ) = 0;
    4344        virtual void visit( IfStmt * ifStmt ) = 0;
    4445        virtual void visit( WhileStmt * whileStmt ) = 0;
Note: See TracChangeset for help on using the changeset viewer.