Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r7f5566b r1db21619  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 30 15:11:39 2015
    13 // Update Count     : 141
     12// Last Modified On : Tue Jul 14 14:58:25 2015
     13// Update Count     : 91
    1414//
    1515
     
    6767        ExpressionNode( const std::string * );
    6868        ExpressionNode( const ExpressionNode &other );
    69         virtual ~ExpressionNode() { delete argName; } // cannot delete argName because it might be referenced elsewhere
     69        virtual ~ExpressionNode() {} // cannot delete asArgName because it might be referenced elsewhere
    7070
    7171        virtual ExpressionNode *clone() const = 0;
     
    7474
    7575        ExpressionNode *get_argName() const { return argName; }
    76         ExpressionNode *set_argName( const std::string *aName );
    77         ExpressionNode *set_argName( ExpressionNode *aDesignator );
     76        ExpressionNode *set_asArgName( const std::string *aName );
     77        ExpressionNode *set_asArgName( ExpressionNode *aDesignator );
    7878
    7979        virtual void print( std::ostream &, int indent = 0) const = 0;
     
    105105
    106106        ConstantNode( Type, std::string * );
    107         ~ConstantNode() { delete &value; }
    108107
    109108        virtual ConstantNode *clone() const { return new ConstantNode( *this ); }
     
    184183};
    185184
     185
    186186class CompositeExprNode : public ExpressionNode {
    187187  public:
     
    211211};
    212212
    213 class AsmExprNode : public ExpressionNode {
    214   public:
    215         AsmExprNode();
    216         AsmExprNode( ExpressionNode *inout, ConstantNode *constraint, ExpressionNode *operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
    217         virtual ~AsmExprNode() { delete inout; delete constraint; delete operand; }
    218 
    219         virtual AsmExprNode *clone() const { return new AsmExprNode( *this ); }
    220         virtual Expression *build() const;
    221 
    222         virtual void print( std::ostream &, int indent = 0) const;
    223         virtual void printOneLine( std::ostream &, int indent = 0) const;
    224 
    225         ExpressionNode *get_inout() const { return inout; };
    226         void set_inout( ExpressionNode *newValue ) { inout = newValue; }
    227 
    228         ConstantNode *get_constraint() const { return constraint; };
    229         void set_constraint( ConstantNode *newValue ) { constraint = newValue; }
    230 
    231         ExpressionNode *get_operand() const { return operand; };
    232         void set_operand( ExpressionNode *newValue ) { operand = newValue; }
    233   private:
    234         ExpressionNode *inout;
    235         ConstantNode *constraint;
    236         ExpressionNode *operand;
    237 };
    238 
    239 class LabelNode : public ExpressionNode {
    240   public:
    241         virtual Expression *build() const { return NULL; }
    242         virtual LabelNode *clone() const { return new LabelNode( *this ); }
    243 
    244         virtual void print( std::ostream &, int indent = 0) const;
    245         virtual void printOneLine( std::ostream &, int indent = 0) const;
    246 
    247         const std::list< std::string > &get_labels() const { return labels; };
    248         void append_label( std::string *label ) { labels.push_back( *label ); delete label; }
    249   private:
    250         std::list< std::string > labels;
    251 };
    252 
    253213class CommaExprNode : public CompositeExprNode {
    254214  public:
     
    319279        static const char *typeClassName[];
    320280
    321         static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle = false );
     281        static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param,
     282                                                                                 StatementNode *body, bool newStyle = false );
    322283        static DeclarationNode *newQualifier( Qualifier );
    323284        static DeclarationNode *newStorageClass( StorageClass );
     
    410371
    411372        StatementNode();
    412         StatementNode( const std::string *name );
    413         StatementNode( Type t, ExpressionNode *control = 0, StatementNode *block = 0 );
    414         StatementNode( Type t, std::string *target );
     373        StatementNode( const std::string * );
     374        StatementNode( Type, ExpressionNode *e = 0, StatementNode *s = 0 );
     375        StatementNode( Type, std::string *target );
    415376        StatementNode( DeclarationNode *decl );
     377
    416378
    417379        ~StatementNode();
     
    440402
    441403        void print( std::ostream &, int indent = 0) const;
     404
    442405        virtual StatementNode *clone() const;
     406
    443407        virtual Statement *build() const;
    444408  private:
     
    450414        std::string *target;                            // target label for jump statements
    451415        DeclarationNode *decl;
     416
    452417        bool isCatchRest;
    453418}; // StatementNode
     
    463428
    464429        void print( std::ostream &, int indent = 0 ) const;
     430
    465431        virtual Statement *build() const;
    466432  private:
     
    468434};
    469435
    470 class AsmStmtNode : public StatementNode {
    471   public:
    472         AsmStmtNode( Type, bool voltile, ConstantNode *instruction, ExpressionNode *output = 0, ExpressionNode *input = 0, ConstantNode *clobber = 0, LabelNode *gotolabels = 0 );
    473         ~AsmStmtNode();
    474 
    475         void print( std::ostream &, int indent = 0 ) const;
     436class NullStmtNode : public CompoundStmtNode {
     437  public:
    476438        Statement *build() const;
    477   private:
    478         bool voltile;
    479         ConstantNode *instruction;
    480         ExpressionNode *output, *input;
    481         ConstantNode *clobber;
    482         std::list<std::string> gotolabels;
    483 };
    484 
    485 class NullStmtNode : public CompoundStmtNode {
    486   public:
    487         Statement *build() const;
    488         void print( std::ostream &, int indent = 0 ) const;
     439        void print( std::ostream &, int indent = 0) const;
    489440};
    490441
     
    512463        InitializerNode *kids;
    513464};
     465
     466
    514467
    515468template< typename SynTreeType, typename NodeType >
Note: See TracChangeset for help on using the changeset viewer.