Changeset d2ded3e7 for src/Parser/parser.yy
- Timestamp:
- Oct 28, 2015, 3:47:29 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, string, with_gc
- Children:
- 37a3b8f9, 4673385, e56cfdb0
- Parents:
- 698664b3 (diff), 097e2b0 (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
-
src/Parser/parser.yy (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r698664b3 rd2ded3e7 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Aug 11 16:01:49201513 // Update Count : 1 35012 // Last Modified On : Thu Oct 8 17:17:54 2015 13 // Update Count : 1473 14 14 // 15 15 … … 81 81 %token ATTRIBUTE EXTENSION // GCC 82 82 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN 83 %token CHOOSE FALLTHRU TRY CATCH FINALLY THROW// CFA83 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT // CFA 84 84 %token ASM // C99, extension ISO/IEC 9899:1999 Section J.5.10(1) 85 85 %token ALIGNAS ALIGNOF ATOMIC GENERIC NORETURN STATICASSERT THREADLOCAL // C11 … … 103 103 %token LSassign RSassign // <<= >>= 104 104 %token ANDassign ERassign ORassign // &= ^= |= 105 106 %token ATassign // @= 105 107 106 108 // Types declaration … … 120 122 } 121 123 122 %type<tok> zero_one identifier no_attr_identifier no_01_identifier124 %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 … … 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 … … 364 367 | postfix_expression DECR 365 368 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), $1 ); } 366 // GCC has priority: cast_expression367 369 | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99 368 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 } 369 376 ; 370 377 … … 445 452 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); } 446 453 | ALIGNOF '(' type_name_no_function ')' // GCC, type alignment 447 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }454 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); } 448 455 | ANDAND no_attr_identifier // GCC, address of label 449 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }456 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); } 450 457 ; 451 458 … … 627 634 | exception_statement 628 635 | asm_statement 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 } 629 642 ; 630 643 … … 805 818 | RETURN comma_expression_opt ';' 806 819 { $$ = new StatementNode( StatementNode::Return, $2, 0 ); } 807 | THROW assignment_expression ';'820 | THROW assignment_expression_opt ';' 808 821 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 809 | THROW ';' 810 { $$ = new StatementNode( StatementNode::Throw ); } 822 // | THROW ';' 823 // { $$ = new StatementNode( StatementNode::Throw ); } 824 | THROWRESUME assignment_expression_opt ';' 825 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 826 | THROWRESUME assignment_expression_opt AT assignment_expression ';' 827 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 828 // | THROWRESUME ';' 829 // { $$ = new StatementNode( StatementNode::Throw ); } 811 830 ; 812 831 … … 831 850 | handler_clause CATCH '(' ELLIPSIS ')' compound_statement 832 851 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); } 852 | CATCHRESUME '(' ELLIPSIS ')' compound_statement 853 { $$ = StatementNode::newCatchStmt( 0, $5, true ); } 854 | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement 855 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); } 833 856 ; 834 857 … … 837 860 { $$ = StatementNode::newCatchStmt( $5, $8 ); } 838 861 | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop 862 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); } 863 | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop 864 { $$ = StatementNode::newCatchStmt( $5, $8 ); } 865 | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop 839 866 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); } 840 867 ; … … 1654 1681 | '=' initializer 1655 1682 { $$ = $2; } 1683 | ATassign initializer 1684 { $$ = $2; } 1656 1685 ; 1657 1686 … … 1662 1691 1663 1692 initializer_list: 1664 initializer 1693 // empty 1694 { $$ = 0; } 1695 | initializer 1665 1696 | designation initializer { $$ = $2->set_designators( $1 ); } 1666 1697 | initializer_list ',' initializer { $$ = (InitializerNode *)( $1->set_link( $3 ) ); } … … 1693 1724 1694 1725 designator: 1726 // lexer ambiguity: designator ".0" is floating-point constant or designator for name 0 1695 1727 // only ".0" and ".1" allowed => semantic check 1696 1728 FLOATINGconstant
Note:
See TracChangeset
for help on using the changeset viewer.