Changes in src/Parser/parser.yy [097e2b0:51b1202]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r097e2b0 r51b1202 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Oct 8 17:17:54201513 // Update Count : 1 47312 // Last Modified On : Tue Aug 11 16:01:49 2015 13 // Update Count : 1350 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 DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT// CFA83 %token CHOOSE FALLTHRU TRY CATCH FINALLY THROW // 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 // @=107 105 108 106 // Types declaration … … 122 120 } 123 121 124 %type<tok> identifier no_01_identifier no_attr_identifier zero_one122 %type<tok> zero_one identifier no_attr_identifier no_01_identifier 125 123 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name no_01_identifier_or_type_name 126 124 %type<constant> string_literal_list … … 319 317 ; 320 318 321 // no zero_one because ambiguity with 0.0 : double constant or field selection322 319 no_attr_identifier: 323 320 IDENTIFIER … … 367 364 | postfix_expression DECR 368 365 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), $1 ); } 366 // GCC has priority: cast_expression 369 367 | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99 370 368 { $$ = 0; } 371 | postfix_expression '{' argument_expression_list '}' // CFA372 {373 Token fn; fn.str = new std::string( "?{}" ); // location undefined374 $$ = new CompositeExprNode( new VarRefNode( fn ), (ExpressionNode *)( $1 )->set_link( $3 ) );375 }376 369 ; 377 370 … … 452 445 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); } 453 446 | ALIGNOF '(' type_name_no_function ')' // GCC, type alignment 454 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }447 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 )); } 455 448 | ANDAND no_attr_identifier // GCC, address of label 456 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }449 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true )); } 457 450 ; 458 451 … … 634 627 | exception_statement 635 628 | asm_statement 636 | '^' postfix_expression '{' argument_expression_list '}' ';' // CFA637 {638 Token fn; fn.str = new std::string( "^?{}" ); // location undefined639 $$ = new StatementNode( StatementNode::Exp, new CompositeExprNode( new VarRefNode( fn ),640 (ExpressionNode *)(new CompositeExprNode( new OperatorNode( OperatorNode::AddressOf ), $2 ))->set_link( $4 ) ), 0 );641 }642 629 ; 643 630 … … 818 805 | RETURN comma_expression_opt ';' 819 806 { $$ = new StatementNode( StatementNode::Return, $2, 0 ); } 820 | THROW assignment_expression _opt';'807 | THROW assignment_expression ';' 821 808 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 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 ); } 809 | THROW ';' 810 { $$ = new StatementNode( StatementNode::Throw ); } 830 811 ; 831 812 … … 850 831 | handler_clause CATCH '(' ELLIPSIS ')' compound_statement 851 832 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); } 852 | CATCHRESUME '(' ELLIPSIS ')' compound_statement853 { $$ = StatementNode::newCatchStmt( 0, $5, true ); }854 | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement855 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); }856 833 ; 857 834 … … 860 837 { $$ = StatementNode::newCatchStmt( $5, $8 ); } 861 838 | 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 pop864 { $$ = StatementNode::newCatchStmt( $5, $8 ); }865 | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop866 839 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); } 867 840 ; … … 1681 1654 | '=' initializer 1682 1655 { $$ = $2; } 1683 | ATassign initializer1684 { $$ = $2; }1685 1656 ; 1686 1657 … … 1691 1662 1692 1663 initializer_list: 1693 // empty 1694 { $$ = 0; } 1695 | initializer 1664 initializer 1696 1665 | designation initializer { $$ = $2->set_designators( $1 ); } 1697 1666 | initializer_list ',' initializer { $$ = (InitializerNode *)( $1->set_link( $3 ) ); } … … 1724 1693 1725 1694 designator: 1726 // lexer ambiguity: designator ".0" is floating-point constant or designator for name 01727 1695 // only ".0" and ".1" allowed => semantic check 1728 1696 FLOATINGconstant
Note:
See TracChangeset
for help on using the changeset viewer.