Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r1db21619 r7f5566b  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 14 14:58:25 2015
    13 // Update Count     : 91
     12// Last Modified On : Thu Jul 30 15:11:39 2015
     13// Update Count     : 141
    1414//
    1515
     
    6767        ExpressionNode( const std::string * );
    6868        ExpressionNode( const ExpressionNode &other );
    69         virtual ~ExpressionNode() {} // cannot delete asArgName because it might be referenced elsewhere
     69        virtual ~ExpressionNode() { delete argName; } // cannot delete argName because it might be referenced elsewhere
    7070
    7171        virtual ExpressionNode *clone() const = 0;
     
    7474
    7575        ExpressionNode *get_argName() const { return argName; }
    76         ExpressionNode *set_asArgName( const std::string *aName );
    77         ExpressionNode *set_asArgName( ExpressionNode *aDesignator );
     76        ExpressionNode *set_argName( const std::string *aName );
     77        ExpressionNode *set_argName( ExpressionNode *aDesignator );
    7878
    7979        virtual void print( std::ostream &, int indent = 0) const = 0;
     
    105105
    106106        ConstantNode( Type, std::string * );
     107        ~ConstantNode() { delete &value; }
    107108
    108109        virtual ConstantNode *clone() const { return new ConstantNode( *this ); }
     
    183184};
    184185
    185 
    186186class CompositeExprNode : public ExpressionNode {
    187187  public:
     
    211211};
    212212
     213class 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
     239class 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
    213253class CommaExprNode : public CompositeExprNode {
    214254  public:
     
    279319        static const char *typeClassName[];
    280320
    281         static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param,
    282                                                                                  StatementNode *body, bool newStyle = false );
     321        static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle = false );
    283322        static DeclarationNode *newQualifier( Qualifier );
    284323        static DeclarationNode *newStorageClass( StorageClass );
     
    371410
    372411        StatementNode();
    373         StatementNode( const std::string * );
    374         StatementNode( Type, ExpressionNode *e = 0, StatementNode *s = 0 );
    375         StatementNode( Type, std::string *target );
     412        StatementNode( const std::string *name );
     413        StatementNode( Type t, ExpressionNode *control = 0, StatementNode *block = 0 );
     414        StatementNode( Type t, std::string *target );
    376415        StatementNode( DeclarationNode *decl );
    377 
    378416
    379417        ~StatementNode();
     
    402440
    403441        void print( std::ostream &, int indent = 0) const;
    404 
    405442        virtual StatementNode *clone() const;
    406 
    407443        virtual Statement *build() const;
    408444  private:
     
    414450        std::string *target;                            // target label for jump statements
    415451        DeclarationNode *decl;
    416 
    417452        bool isCatchRest;
    418453}; // StatementNode
     
    428463
    429464        void print( std::ostream &, int indent = 0 ) const;
    430 
    431465        virtual Statement *build() const;
    432466  private:
     
    434468};
    435469
     470class 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;
     476        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
    436485class NullStmtNode : public CompoundStmtNode {
    437486  public:
    438487        Statement *build() const;
    439         void print( std::ostream &, int indent = 0) const;
     488        void print( std::ostream &, int indent = 0 ) const;
    440489};
    441490
     
    463512        InitializerNode *kids;
    464513};
    465 
    466 
    467514
    468515template< typename SynTreeType, typename NodeType >
Note: See TracChangeset for help on using the changeset viewer.