Ignore:
Timestamp:
Aug 19, 2016, 2:42:04 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
e85a8631
Parents:
03da511 (diff), ac71a86 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ctor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.cc

    r03da511 r04cdd9b  
    1010// Created On       : Sat May 16 13:26:29 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug  6 08:26:11 2016
    13 // Update Count     : 93
     12// Last Modified On : Wed Aug 17 23:14:16 2016
     13// Update Count     : 126
    1414//
    1515
     
    1717using namespace std;
    1818
    19 // Builder
    2019int 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 }
    6720
    6821// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.