source:
src/Parser/ParseNode.cc@
e82aa9df
| Last change on this file since e82aa9df was e82aa9df, checked in by , 10 years ago | |
|---|---|
|
|
| File size: 1.3 KB | |
| Rev | Line | |
|---|---|---|
| [b87a5ed] | 1 | // |
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | |
| 3 | // | |
| 4 | // The contents of this file are covered under the licence agreement in the | |
| 5 | // file "LICENCE" distributed with Cforall. | |
| 6 | // | |
| 7 | // ParseNode.cc -- | |
| 8 | // | |
| 9 | // Author : Rodolfo G. Esteves | |
| 10 | // Created On : Sat May 16 13:26:29 2015 | |
| [ca35c51] | 11 | // Last Modified By : Peter A. Buhr |
| [e82aa9df] | 12 | // Last Modified On : Mon Aug 15 14:49:06 2016 |
| 13 | // Update Count : 99 | |
| [b87a5ed] | 14 | // |
| 15 | ||
| [51b73452] | 16 | #include "ParseNode.h" |
| 17 | using namespace std; | |
| 18 | ||
| 19 | // Builder | |
| 20 | int ParseNode::indent_by = 4; | |
| 21 | ||
| [e869d663] | 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 ) { } | |
| [51b73452] | 25 | |
| [59db689] | 26 | ParseNode::~ParseNode() { |
| [e869d663] | 27 | delete next; |
| [51b73452] | 28 | }; |
| 29 | ||
| [59db689] | 30 | ParseNode *ParseNode::get_last() { |
| [a08ba92] | 31 | ParseNode *current = this; |
| [51b73452] | 32 | |
| [1d4580a] | 33 | while ( current->get_next() != 0 ) |
| 34 | current = current->get_next(); | |
| [a08ba92] | 35 | return current; |
| [51b73452] | 36 | } |
| 37 | ||
| [1d4580a] | 38 | ParseNode *ParseNode::set_last( ParseNode *next_ ) { |
| [4e06c1e] | 39 | if ( next_ != 0 ) get_last()->next = next_; |
| [a08ba92] | 40 | return this; |
| [51b73452] | 41 | } |
| 42 | ||
| [a61fea9a] | 43 | void ParseNode::print( std::ostream &os, int indent ) const {} |
| [51b73452] | 44 | |
| 45 | ||
| [3848e0e] | 46 | void ParseNode::printList( std::ostream &os, int indent ) const { |
| [a08ba92] | 47 | print( os, indent ); |
| [51b73452] | 48 | |
| [a08ba92] | 49 | if ( next ) { |
| [a61fea9a] | 50 | next->printList( os, indent ); |
| [59db689] | 51 | } // if |
| [51b73452] | 52 | } |
| 53 | ||
| 54 | // Local Variables: // | |
| [b87a5ed] | 55 | // tab-width: 4 // |
| 56 | // mode: c++ // | |
| 57 | // compile-command: "make install" // | |
| [51b73452] | 58 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.