Changeset 2298f728 for src/Parser/parser.yy
- Timestamp:
- Sep 24, 2016, 12:08:02 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, 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:
- 9c23f31
- Parents:
- 1b772749
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r1b772749 r2298f728 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 16 18:12:21201613 // Update Count : 19 7812 // Last Modified On : Sat Sep 24 11:30:40 2016 13 // Update Count : 1991 14 14 // 15 15 … … 54 54 #include "TypeData.h" 55 55 #include "LinkageSpec.h" 56 using namespace std; 56 57 57 58 extern DeclarationNode * parseTree; … … 59 60 extern TypedefTable typedefTable; 60 61 61 st d::stack< LinkageSpec::Spec > linkageStack;62 63 void appendStr( st d::string *to, std::string *from ) {62 stack< LinkageSpec::Spec > linkageStack; 63 64 void appendStr( string *to, string *from ) { 64 65 // "abc" "def" "ghi" => "abcdefghi", remove new text from quotes and insert before last quote in old string. 65 66 to->insert( to->length() - 1, from->substr( 1, from->length() - 2 ) ); … … 389 390 { 390 391 Token fn; 391 fn.str = new st d::string( "?{}" );// location undefined392 fn.str = new string( "?{}" ); // location undefined 392 393 $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ); 393 394 } … … 666 667 { 667 668 Token fn; 668 fn.str = new st d::string( "^?{}" );// location undefined669 fn.str = new string( "^?{}" ); // location undefined 669 670 $$ = new StatementNode( build_expr( new ExpressionNode( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $2 )->set_last( $4 ) ) ) ) ); 670 671 } … … 1467 1468 aggregate_name: 1468 1469 aggregate_key '{' field_declaration_list '}' 1469 { $$ = DeclarationNode::newAggregate( $1, n ew std::string( "" ), nullptr, $3, true ); }1470 { $$ = DeclarationNode::newAggregate( $1, nullptr, nullptr, $3, true ); } 1470 1471 | aggregate_key no_attr_identifier_or_type_name 1471 1472 { 1472 1473 typedefTable.makeTypedef( *$2 ); 1473 $$ = DeclarationNode::newAggregate( $1, $2, 0, 0, false );1474 $$ = DeclarationNode::newAggregate( $1, $2, nullptr, nullptr, false ); 1474 1475 } 1475 1476 | aggregate_key no_attr_identifier_or_type_name … … 1478 1479 { $$ = DeclarationNode::newAggregate( $1, $2, nullptr, $5, true ); } 1479 1480 | aggregate_key '(' type_name_list ')' '{' field_declaration_list '}' // CFA 1480 { $$ = DeclarationNode::newAggregate( $1, n ew std::string( "" ), $3, $6, false ); }1481 { $$ = DeclarationNode::newAggregate( $1, nullptr, $3, $6, false ); } 1481 1482 | aggregate_key typegen_name // CFA, S/R conflict 1482 1483 { $$ = $2; } … … 1559 1560 enum_name: 1560 1561 enum_key '{' enumerator_list comma_opt '}' 1561 { $$ = DeclarationNode::newEnum( n ew std::string( "" ), $3 ); }1562 { $$ = DeclarationNode::newEnum( nullptr, $3 ); } 1562 1563 | enum_key no_attr_identifier_or_type_name 1563 1564 { … … 2520 2521 abstract_function: 2521 2522 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2522 { $$ = DeclarationNode::newFunction( n ew std::string( "" ), nullptr, $3, nullptr ); }2523 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 2523 2524 | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2524 2525 { $$ = $2->addParamList( $6 ); } … … 2589 2590 abstract_parameter_function: 2590 2591 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2591 { $$ = DeclarationNode::newFunction( n ew std::string( "" ), nullptr, $3, nullptr ); }2592 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 2592 2593 | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2593 2594 { $$ = $2->addParamList( $6 ); } … … 2793 2794 // empty (void) function return type. 2794 2795 '[' ']' type_specifier 2795 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2796 { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2796 2797 | '[' ']' multi_array_dimension type_specifier 2797 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2798 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2798 2799 | multi_array_dimension type_specifier 2799 2800 { $$ = $2->addNewArray( $1 ); } 2800 2801 | '[' ']' new_abstract_ptr 2801 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2802 { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2802 2803 | '[' ']' multi_array_dimension new_abstract_ptr 2803 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2804 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2804 2805 | multi_array_dimension new_abstract_ptr 2805 2806 { $$ = $2->addNewArray( $1 ); } … … 2813 2814 new_abstract_function: // CFA 2814 2815 '[' ']' '(' new_parameter_type_list_opt ')' 2815 { $$ = DeclarationNode::newFunction( new std::string( "" ), DeclarationNode::newTuple( nullptr ), $4, nullptr ); }2816 { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); } 2816 2817 | new_abstract_tuple '(' push new_parameter_type_list_opt pop ')' 2817 { $$ = DeclarationNode::newFunction( n ew std::string( "" ), $1, $4, nullptr ); }2818 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 2818 2819 | new_function_return '(' push new_parameter_type_list_opt pop ')' 2819 { $$ = DeclarationNode::newFunction( n ew std::string( "" ), $1, $4, nullptr ); }2820 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 2820 2821 ; 2821 2822 … … 2852 2853 2853 2854 void yyerror( const char * ) { 2854 std::cout << "Error ";2855 cout << "Error "; 2855 2856 if ( yyfilename ) { 2856 std::cout << "in file " << yyfilename << " ";2857 cout << "in file " << yyfilename << " "; 2857 2858 } // if 2858 std::cout << "at line " << yylineno << " reading token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << std::endl;2859 cout << "at line " << yylineno << " reading token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << endl; 2859 2860 } 2860 2861
Note: See TracChangeset
for help on using the changeset viewer.