Changeset 84b08d4 for src/Parser/parser.yy
- Timestamp:
- Nov 18, 2015, 12:50:56 PM (10 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, with_gc
- Children:
- 9ed3237
- Parents:
- 0800284 (diff), 50eac1b (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r0800284 r84b08d4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 28 18:18:32201513 // Update Count : 14 0212 // Last Modified On : Thu Oct 8 17:17:54 2015 13 // Update Count : 1473 14 14 // 15 15 … … 104 104 %token ANDassign ERassign ORassign // &= ^= |= 105 105 106 %token ATassign // @= 107 106 108 // Types declaration 107 109 %union … … 120 122 } 121 123 122 %type<tok> identifier no_01_identifier no_attr_identifier no_attr_identifier_01zero_one124 %type<tok> identifier no_01_identifier no_attr_identifier zero_one 123 125 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name no_01_identifier_or_type_name 124 126 %type<constant> string_literal_list … … 143 145 // statements 144 146 %type<sn> labeled_statement compound_statement expression_statement selection_statement 145 %type<sn> iteration_statement jump_statement exception_statement asm_statement ctor_dtor147 %type<sn> iteration_statement jump_statement exception_statement asm_statement 146 148 %type<sn> fall_through_opt fall_through 147 149 %type<sn> statement statement_list … … 317 319 ; 318 320 321 // no zero_one because ambiguity with 0.0 : double constant or field selection 319 322 no_attr_identifier: 320 323 IDENTIFIER 321 ;322 323 no_attr_identifier_01:324 IDENTIFIER325 | zero_one326 324 ; 327 325 … … 369 367 | postfix_expression DECR 370 368 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), $1 ); } 371 // GCC has priority: cast_expression372 369 | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99 373 370 { $$ = 0; } 371 | postfix_expression '{' argument_expression_list '}' // CFA 372 { 373 Token fn; fn.str = new std::string( "?{}" ); // location undefined 374 $$ = new CompositeExprNode( new VarRefNode( fn ), (ExpressionNode *)( $1 )->set_link( $3 ) ); 375 } 374 376 ; 375 377 … … 632 634 | exception_statement 633 635 | asm_statement 634 | ctor_dtor 636 | '^' postfix_expression '{' argument_expression_list '}' ';' // CFA 637 { 638 Token fn; fn.str = new std::string( "^?{}" ); // location undefined 639 $$ = new StatementNode( StatementNode::Exp, new CompositeExprNode( new VarRefNode( fn ), 640 (ExpressionNode *)(new CompositeExprNode( new OperatorNode( OperatorNode::AddressOf ), $2 ))->set_link( $4 ) ), 0 ); 641 } 635 642 ; 636 643 … … 945 952 ; 946 953 947 ctor_dtor: // CFA, constructor/destructor948 no_attr_identifier_01 '{' argument_expression_list '}' ';'949 {950 Token fn; fn.str = new std::string( "?{}" ); fn.loc = $1.loc;951 $$ = new StatementNode( StatementNode::Exp, new CompositeExprNode( new VarRefNode( fn ),952 (ExpressionNode *)((new CompositeExprNode( new OperatorNode( OperatorNode::AddressOf ), new VarRefNode( $1 ) ))->set_link( $3 )) ), 0 );953 }954 | '^' no_attr_identifier_01 '{' '}' ';'955 {956 Token fn; fn.str = new std::string( "^?{}" ); fn.loc = $2.loc;957 $$ = new StatementNode( StatementNode::Exp, new CompositeExprNode( new VarRefNode( fn ),958 new CompositeExprNode( new OperatorNode( OperatorNode::AddressOf ), new VarRefNode( $2 ) ) ), 0 );959 }960 ;961 962 954 //******************************* DECLARATIONS ********************************* 963 955 … … 1689 1681 | '=' initializer 1690 1682 { $$ = $2; } 1683 | ATassign initializer 1684 { $$ = $2; } 1691 1685 ; 1692 1686 … … 1697 1691 1698 1692 initializer_list: 1699 initializer 1693 // empty 1694 { $$ = 0; } 1695 | initializer 1700 1696 | designation initializer { $$ = $2->set_designators( $1 ); } 1701 1697 | initializer_list ',' initializer { $$ = (InitializerNode *)( $1->set_link( $3 ) ); }
Note:
See TracChangeset
for help on using the changeset viewer.