Changes in src/Parser/ParseNode.h [7305915:8e9cbb2]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r7305915 r8e9cbb2 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Ju n 27 23:28:10201613 // Update Count : 2 4212 // Last Modified On : Mon Jul 4 15:35:09 2016 13 // Update Count : 260 14 14 // 15 15 … … 28 28 //#include "SynTree/Declaration.h" 29 29 #include "Common/UniqueName.h" 30 #include "SynTree/Label.h" 30 31 31 32 class ExpressionNode; … … 42 43 ParseNode(); 43 44 ParseNode( const std::string * ); 44 ParseNode( const std::string & ); 45 ParseNode( const std::string & ); // for copy constructing subclasses 45 46 virtual ~ParseNode(); 46 47 47 ParseNode *get_link() const ;48 ParseNode *get_link() const { return next; } 48 49 ParseNode *get_last(); 49 50 ParseNode *set_link( ParseNode * ); … … 61 62 protected: 62 63 std::string name; 64 static int indent_by; 63 65 ParseNode *next; 64 static int indent_by;65 66 }; 66 67 … … 125 126 enum Type { Integer, Float, Character, String }; 126 127 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; }128 ConstantNode( ConstantExpr * ); 129 ConstantNode( const ConstantNode &other ) : expr( other.expr->clone() ) {}; 130 ~ConstantNode() { delete expr; } 130 131 131 132 virtual ConstantNode *clone() const { return new ConstantNode( *this ); } 132 Type get_type( void ) const { return type; }133 133 virtual void print( std::ostream &, int indent = 0) const; 134 134 virtual void printOneLine( std::ostream &, int indent = 0) const; 135 135 136 const std::string &get_value() const { return value; }137 136 ConstantNode *appendstr( const std::string *newValue ); 138 137 139 138 Expression *build() const; 140 139 private: 141 Type type; 142 BasicType::Kind btype; 143 std::string &value; 144 }; 140 ConstantExpr *expr; 141 }; 142 143 ConstantNode *makeConstant( ConstantNode::Type, std::string * ); 144 ConstantNode *makeConstantStr( ConstantNode::Type type, std::string *str ); 145 145 146 146 class VarRefNode : public ExpressionNode { … … 284 284 virtual void printOneLine( std::ostream &, int indent = 0) const; 285 285 286 const std::list< std::string> &get_labels() const { return labels; };286 const std::list< Label > &get_labels() const { return labels; }; 287 287 void append_label( std::string *label ) { labels.push_back( *label ); delete label; } 288 288 private: 289 std::list< std::string> labels;289 std::list< Label > labels; 290 290 }; 291 291 … … 481 481 void setCatchRest( bool newVal ) { isCatchRest = newVal; } 482 482 483 bool get_extension() const { return extension; }484 StatementNode *set_extension( bool exten ) { extension = exten; return this; }485 486 483 std::string get_target() const; 487 484 … … 502 499 DeclarationNode *decl; 503 500 bool isCatchRest; 504 bool extension = false;505 501 }; // StatementNode 506 502 … … 532 528 ExpressionNode *output, *input; 533 529 ConstantNode *clobber; 534 std::list< std::string> gotolabels;530 std::list< Label > gotolabels; 535 531 }; 536 532
Note: See TracChangeset
for help on using the changeset viewer.