source: src/Parser/ParseNode.cc@ 7527e63

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 7527e63 was 7880579, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

more refactoring of parser code

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[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
[7880579]12// Last Modified On : Tue Aug 16 08:42:29 2016
13// Update Count : 107
[b87a5ed]14//
15
[51b73452]16#include "ParseNode.h"
17using namespace std;
18
19int ParseNode::indent_by = 4;
20
[7880579]21ParseNode::ParseNode() : next( nullptr ) {};
22ParseNode::ParseNode( const string *name ) : name( *name ), next( nullptr ) { delete name; }
23ParseNode::ParseNode( const string &name ) : name( name ), next( nullptr ) { }
[51b73452]24
[59db689]25ParseNode::~ParseNode() {
[e869d663]26 delete next;
[51b73452]27};
28
[59db689]29ParseNode *ParseNode::get_last() {
[a08ba92]30 ParseNode *current = this;
[51b73452]31
[1d4580a]32 while ( current->get_next() != 0 )
33 current = current->get_next();
[a08ba92]34 return current;
[51b73452]35}
36
[1d4580a]37ParseNode *ParseNode::set_last( ParseNode *next_ ) {
[4e06c1e]38 if ( next_ != 0 ) get_last()->next = next_;
[a08ba92]39 return this;
[51b73452]40}
41
[3848e0e]42void ParseNode::printList( std::ostream &os, int indent ) const {
[a08ba92]43 print( os, indent );
[51b73452]44
[a08ba92]45 if ( next ) {
[a61fea9a]46 next->printList( os, indent );
[59db689]47 } // if
[51b73452]48}
49
50// Local Variables: //
[b87a5ed]51// tab-width: 4 //
52// mode: c++ //
53// compile-command: "make install" //
[51b73452]54// End: //
Note: See TracBrowser for help on using the repository browser.