Changes in src/Parser/ParseNode.cc [99cad3aa:7bf7fb9]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.cc
r99cad3aa r7bf7fb9 10 10 // Created On : Sat May 16 13:26:29 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 23:14:16201613 // Update Count : 12612 // Last Modified On : Sat Aug 6 08:26:11 2016 13 // Update Count : 93 14 14 // 15 15 … … 17 17 using namespace std; 18 18 19 // Builder 19 20 int ParseNode::indent_by = 4; 21 22 ParseNode::ParseNode() : next( 0 ) {}; 23 ParseNode::ParseNode( const string *name ) : name( *name ), next( 0 ) { delete name; } 24 ParseNode::ParseNode( const string &name ) : name( name ), next( 0 ) { } 25 26 ParseNode::~ParseNode() { 27 delete next; 28 }; 29 30 ParseNode *ParseNode::get_last() { 31 ParseNode *current = this; 32 33 while ( current->get_link() != 0 ) 34 current = current->get_link(); 35 36 return current; 37 } 38 39 ParseNode *ParseNode::set_link( ParseNode *next_ ) { 40 if ( next_ != 0 ) get_last()->next = next_; 41 return this; 42 } 43 44 void ParseNode::print( std::ostream &os, int indent ) const {} 45 46 47 void ParseNode::printList( std::ostream &os, int indent ) const { 48 print( os, indent ); 49 50 if ( next ) { 51 next->printList( os, indent ); 52 } // if 53 } 54 55 ParseNode &ParseNode::operator,( ParseNode &p ) { 56 set_link( &p ); 57 58 return *this; 59 } 60 61 ParseNode *mkList( ParseNode &pn ) { 62 // it just relies on `operator,' to take care of the "arguments" and provides a nice interface to an awful-looking 63 // address-of, rendering, for example (StatementNode *)(&(*$5 + *$7)) into (StatementNode *)mkList(($5, $7)) 64 // (although "nice" is probably not the word) 65 return &pn; 66 } 20 67 21 68 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.