Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r8e9cbb2 r7305915  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul  4 15:35:09 2016
    13 // Update Count     : 260
     12// Last Modified On : Mon Jun 27 23:28:10 2016
     13// Update Count     : 242
    1414//
    1515
     
    2828//#include "SynTree/Declaration.h"
    2929#include "Common/UniqueName.h"
    30 #include "SynTree/Label.h"
    3130
    3231class ExpressionNode;
     
    4342        ParseNode();
    4443        ParseNode( const std::string * );
    45         ParseNode( const std::string & );                                       // for copy constructing subclasses
     44        ParseNode( const std::string & );  // for copy constructing subclasses
    4645        virtual ~ParseNode();
    4746
    48         ParseNode *get_link() const { return next; }
     47        ParseNode *get_link() const;
    4948        ParseNode *get_last();
    5049        ParseNode *set_link( ParseNode * );
     
    6261  protected:
    6362        std::string name;
     63        ParseNode *next;
    6464        static int indent_by;
    65         ParseNode *next;
    6665};
    6766
     
    126125        enum Type { Integer, Float, Character, String };
    127126
    128         ConstantNode( ConstantExpr * );
    129         ConstantNode( const ConstantNode &other ) : expr( other.expr->clone() ) {};
    130         ~ConstantNode() { delete expr; }
     127        ConstantNode( Type, std::string * );
     128        ConstantNode( const ConstantNode &other ) : type( other.type ), btype( other.btype), value( *new std::string( other.value ) ) {};
     129        ~ConstantNode() { delete &value; }
    131130
    132131        virtual ConstantNode *clone() const { return new ConstantNode( *this ); }
     132        Type get_type( void ) const { return type; }
    133133        virtual void print( std::ostream &, int indent = 0) const;
    134134        virtual void printOneLine( std::ostream &, int indent = 0) const;
    135135
     136        const std::string &get_value() const { return value; }
    136137        ConstantNode *appendstr( const std::string *newValue );
    137138
    138139        Expression *build() const;
    139140  private:
    140         ConstantExpr *expr;
    141 };
    142 
    143 ConstantNode *makeConstant( ConstantNode::Type, std::string * );
    144 ConstantNode *makeConstantStr( ConstantNode::Type type, std::string *str );
     141        Type type;
     142        BasicType::Kind btype;
     143        std::string &value;
     144};
    145145
    146146class VarRefNode : public ExpressionNode {
     
    284284        virtual void printOneLine( std::ostream &, int indent = 0) const;
    285285
    286         const std::list< Label > &get_labels() const { return labels; };
     286        const std::list< std::string > &get_labels() const { return labels; };
    287287        void append_label( std::string *label ) { labels.push_back( *label ); delete label; }
    288288  private:
    289         std::list< Label > labels;
     289        std::list< std::string > labels;
    290290};
    291291
     
    481481        void setCatchRest( bool newVal ) { isCatchRest = newVal; }
    482482
     483        bool get_extension() const { return extension; }
     484        StatementNode *set_extension( bool exten ) { extension = exten; return this; }
     485
    483486        std::string get_target() const;
    484487
     
    499502        DeclarationNode *decl;
    500503        bool isCatchRest;
     504        bool extension = false;
    501505}; // StatementNode
    502506
     
    528532        ExpressionNode *output, *input;
    529533        ConstantNode *clobber;
    530         std::list< Label > gotolabels;
     534        std::list<std::string> gotolabels;
    531535};
    532536
Note: See TracChangeset for help on using the changeset viewer.