Changeset a08ba92 for translator/Parser
- Timestamp:
- May 19, 2015, 4:58:14 PM (11 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 843054c2
- Parents:
- 01aeade
- Location:
- translator/Parser
- Files:
-
- 5 edited
-
ExpressionNode.cc (modified) (10 diffs)
-
ParseNode.cc (modified) (3 diffs)
-
StatementNode.cc (modified) (1 diff)
-
TypedefTable.cc (modified) (1 diff)
-
lex.l (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
translator/Parser/ExpressionNode.cc
r01aeade ra08ba92 81 81 } 82 82 83 CommaExprNode *ExpressionNode::add_to_list( ExpressionNode *exp ) {83 CommaExprNode *ExpressionNode::add_to_list( ExpressionNode *exp ) { 84 84 return new CommaExprNode( this, exp ); 85 85 } … … 111 111 } 112 112 113 void ConstantNode::classify( std::string &str ) {114 switch ( type ) {113 void ConstantNode::classify( std::string &str ) { 114 switch ( type ) { 115 115 case Integer: 116 116 case Float: … … 130 130 std::transform( sfx.begin(), sfx.end(), sfx.begin(), tolower_hack ); 131 131 132 if ( sfx.find("ll") != string::npos ) {132 if ( sfx.find("ll") != string::npos ) { 133 133 longs = 2; 134 } else if ( sfx.find("l") != string::npos ) {134 } else if ( sfx.find("l") != string::npos ) { 135 135 longs = 1; 136 136 } // if … … 163 163 ConstantNode *ConstantNode::append( std::string *newValue ) { 164 164 if ( newValue ) { 165 if ( type == String ) {165 if ( type == String ) { 166 166 std::string temp = *newValue; 167 167 value.resize( value.size() - 1 ); … … 209 209 BasicType *bt; 210 210 211 switch ( get_type()) {211 switch ( get_type()) { 212 212 case Integer: 213 213 /* Cfr. standard 6.4.4.1 */ … … 354 354 return new UntypedExpr( function->build(), args, maybeBuild< Expression >( get_argName() )); 355 355 } else { 356 switch ( op->get_type()) {356 switch ( op->get_type()) { 357 357 case OperatorNode::Incr: 358 358 case OperatorNode::Decr: … … 563 563 } 564 564 565 void CompositeExprNode::set_function( ExpressionNode *f ) {565 void CompositeExprNode::set_function( ExpressionNode *f ) { 566 566 function = f; 567 567 } 568 568 569 void CompositeExprNode::set_args( ExpressionNode *args ) {569 void CompositeExprNode::set_args( ExpressionNode *args ) { 570 570 arguments = args; 571 571 } … … 579 579 } 580 580 581 void CompositeExprNode::add_arg( ExpressionNode *arg ) {581 void CompositeExprNode::add_arg( ExpressionNode *arg ) { 582 582 if ( arguments ) 583 583 arguments->set_link( arg ); … … 594 594 } 595 595 596 CommaExprNode *CommaExprNode::add_to_list( ExpressionNode *exp ) {596 CommaExprNode *CommaExprNode::add_to_list( ExpressionNode *exp ) { 597 597 add_arg( exp ); 598 598 … … 646 646 } 647 647 648 ForCtlExprNode::~ForCtlExprNode() {648 ForCtlExprNode::~ForCtlExprNode() { 649 649 delete init; 650 650 delete condition; -
translator/Parser/ParseNode.cc
r01aeade ra08ba92 10 10 // Created On : Sat May 16 13:26:29 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 13:27:51201513 // Update Count : 212 // Last Modified On : Tue May 19 16:48:30 2015 13 // Update Count : 3 14 14 // 15 15 … … 24 24 25 25 ParseNode *ParseNode::set_name( string _name ) { 26 name = _name;27 return this;26 name = _name; 27 return this; 28 28 } 29 29 30 30 ParseNode *ParseNode::set_name( string *_name ) { 31 name = *_name; // deep copy32 delete _name;31 name = *_name; // deep copy 32 delete _name; 33 33 34 return this;34 return this; 35 35 } 36 36 37 37 ParseNode::~ParseNode( void ) { 38 delete next;38 delete next; 39 39 }; 40 40 41 41 string ParseNode::get_name( void ) { 42 return name;42 return name; 43 43 } 44 44 45 45 ParseNode *ParseNode::get_link( void ) const { 46 return next;46 return next; 47 47 } 48 48 49 49 ParseNode *ParseNode::get_last(void) { 50 ParseNode *current = this;50 ParseNode *current = this; 51 51 52 while ( current->get_link() != 0 )52 while ( current->get_link() != 0 ) 53 53 current = current->get_link(); 54 54 55 return current;55 return current; 56 56 } 57 57 58 ParseNode *ParseNode::set_link(ParseNode *_next) {59 ParseNode *follow;58 ParseNode *ParseNode::set_link(ParseNode *_next) { 59 ParseNode *follow; 60 60 61 if ( _next == 0 ) return this;61 if ( _next == 0 ) return this; 62 62 63 for ( follow = this; follow->next != 0; follow = follow->next );64 follow->next = _next;63 for ( follow = this; follow->next != 0; follow = follow->next ); 64 follow->next = _next; 65 65 66 return this;66 return this; 67 67 } 68 68 69 69 const string ParseNode::get_name(void) const { 70 return name;70 return name; 71 71 } 72 72 … … 75 75 76 76 void ParseNode::printList( std::ostream &os, int indent ) const { 77 print( os, indent );77 print( os, indent ); 78 78 79 if ( next ) {79 if ( next ) { 80 80 next->printList( os, indent ); 81 }81 } 82 82 } 83 83 84 84 ParseNode &ParseNode::operator,( ParseNode &p ) { 85 set_link( &p );85 set_link( &p ); 86 86 87 return *this;87 return *this; 88 88 } 89 89 90 90 ParseNode *mkList( ParseNode &pn ) { 91 // it just relies on `operator,' to take care of the "arguments" and provides a nice interface to an awful-looking92 // address-of, rendering, for example (StatementNode *)(&(*$5 + *$7)) into (StatementNode *)mkList(($5, $7))93 // (although "nice" is probably not the word)94 return &pn;91 // it just relies on `operator,' to take care of the "arguments" and provides a nice interface to an awful-looking 92 // address-of, rendering, for example (StatementNode *)(&(*$5 + *$7)) into (StatementNode *)mkList(($5, $7)) 93 // (although "nice" is probably not the word) 94 return &pn; 95 95 } 96 96 -
translator/Parser/StatementNode.cc
r01aeade ra08ba92 171 171 void StatementNode::print( std::ostream &os, int indent ) const { 172 172 if ( labels != 0 ) 173 if ( ! labels->empty()) {173 if ( ! labels->empty()) { 174 174 std::list<std::string>::const_iterator i; 175 175 -
translator/Parser/TypedefTable.cc
r01aeade ra08ba92 123 123 for ( tableType::iterator i = table.begin(); i != table.end(); ) { 124 124 list<Entry> &declList = (*i ).second; 125 while ( ! declList.empty() && declList.front().scope == currentScope ) {125 while ( ! declList.empty() && declList.front().scope == currentScope ) { 126 126 declList.pop_front(); 127 127 } -
translator/Parser/lex.l
r01aeade ra08ba92 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Sat May 16 12:14:18201513 * Update Count : 33 012 * Last Modified On : Tue May 19 15:41:54 2015 13 * Update Count : 331 14 14 */ 15 15
Note:
See TracChangeset
for help on using the changeset viewer.