Changes in src/Parser/parser.yy [02e5ab6:51b1202]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r02e5ab6 r51b1202 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 : 1 40212 // 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 … … 120 120 } 121 121 122 %type<tok> identifier no_01_identifier no_attr_identifier no_attr_identifier_01 zero_one122 %type<tok> zero_one identifier no_attr_identifier no_01_identifier 123 123 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name no_01_identifier_or_type_name 124 124 %type<constant> string_literal_list … … 143 143 // statements 144 144 %type<sn> labeled_statement compound_statement expression_statement selection_statement 145 %type<sn> iteration_statement jump_statement exception_statement asm_statement ctor_dtor145 %type<sn> iteration_statement jump_statement exception_statement asm_statement 146 146 %type<sn> fall_through_opt fall_through 147 147 %type<sn> statement statement_list … … 319 319 no_attr_identifier: 320 320 IDENTIFIER 321 ;322 323 no_attr_identifier_01:324 IDENTIFIER325 | zero_one326 321 ; 327 322 … … 450 445 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); } 451 446 | ALIGNOF '(' type_name_no_function ')' // GCC, type alignment 452 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }447 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 )); } 453 448 | ANDAND no_attr_identifier // GCC, address of label 454 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }449 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true )); } 455 450 ; 456 451 … … 632 627 | exception_statement 633 628 | asm_statement 634 | ctor_dtor635 629 ; 636 630 … … 811 805 | RETURN comma_expression_opt ';' 812 806 { $$ = new StatementNode( StatementNode::Return, $2, 0 ); } 813 | THROW assignment_expression _opt';'807 | THROW assignment_expression ';' 814 808 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 815 // | THROW ';' 816 // { $$ = new StatementNode( StatementNode::Throw ); } 817 | THROWRESUME assignment_expression_opt ';' 818 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 819 | THROWRESUME assignment_expression_opt AT assignment_expression ';' 820 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 821 // | THROWRESUME ';' 822 // { $$ = new StatementNode( StatementNode::Throw ); } 809 | THROW ';' 810 { $$ = new StatementNode( StatementNode::Throw ); } 823 811 ; 824 812 … … 843 831 | handler_clause CATCH '(' ELLIPSIS ')' compound_statement 844 832 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); } 845 | CATCHRESUME '(' ELLIPSIS ')' compound_statement846 { $$ = StatementNode::newCatchStmt( 0, $5, true ); }847 | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement848 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); }849 833 ; 850 834 … … 853 837 { $$ = StatementNode::newCatchStmt( $5, $8 ); } 854 838 | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop 855 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); }856 | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop857 { $$ = StatementNode::newCatchStmt( $5, $8 ); }858 | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop859 839 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); } 860 840 ; … … 943 923 | label_list ',' no_attr_identifier 944 924 { $$ = $1; $1->append_label( $3 ); } 945 ;946 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 925 ; 961 926 … … 1728 1693 1729 1694 designator: 1730 // lexer ambiguity: designator ".0" is floating-point constant or designator for name 01731 1695 // only ".0" and ".1" allowed => semantic check 1732 1696 FLOATINGconstant
Note:
See TracChangeset
for help on using the changeset viewer.