Changeset 02e5ab6 for src/Parser/parser.yy
- Timestamp:
- Sep 28, 2015, 6:25:43 PM (9 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:
- 097e2b0, 1cbca6e
- Parents:
- 20e409e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r20e409e r02e5ab6 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 11 16:01:49201513 // Update Count : 1 35012 // Last Modified On : Mon Sep 28 18:18:32 2015 13 // Update Count : 1402 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 … … 120 120 } 121 121 122 %type<tok> zero_one identifier no_attr_identifier no_01_identifier122 %type<tok> identifier no_01_identifier no_attr_identifier no_attr_identifier_01 zero_one 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 145 %type<sn> iteration_statement jump_statement exception_statement asm_statement ctor_dtor 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 IDENTIFIER 325 | zero_one 321 326 ; 322 327 … … 445 450 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); } 446 451 | ALIGNOF '(' type_name_no_function ')' // GCC, type alignment 447 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }452 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); } 448 453 | ANDAND no_attr_identifier // GCC, address of label 449 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }454 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); } 450 455 ; 451 456 … … 627 632 | exception_statement 628 633 | asm_statement 634 | ctor_dtor 629 635 ; 630 636 … … 805 811 | RETURN comma_expression_opt ';' 806 812 { $$ = new StatementNode( StatementNode::Return, $2, 0 ); } 807 | THROW assignment_expression ';'813 | THROW assignment_expression_opt ';' 808 814 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 809 | THROW ';' 810 { $$ = new StatementNode( StatementNode::Throw ); } 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 ); } 811 823 ; 812 824 … … 831 843 | handler_clause CATCH '(' ELLIPSIS ')' compound_statement 832 844 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); } 845 | CATCHRESUME '(' ELLIPSIS ')' compound_statement 846 { $$ = StatementNode::newCatchStmt( 0, $5, true ); } 847 | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement 848 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); } 833 849 ; 834 850 … … 837 853 { $$ = StatementNode::newCatchStmt( $5, $8 ); } 838 854 | 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 pop 857 { $$ = StatementNode::newCatchStmt( $5, $8 ); } 858 | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop 839 859 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); } 840 860 ; … … 923 943 | label_list ',' no_attr_identifier 924 944 { $$ = $1; $1->append_label( $3 ); } 945 ; 946 947 ctor_dtor: // CFA, constructor/destructor 948 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 } 925 960 ; 926 961 … … 1693 1728 1694 1729 designator: 1730 // lexer ambiguity: designator ".0" is floating-point constant or designator for name 0 1695 1731 // only ".0" and ".1" allowed => semantic check 1696 1732 FLOATINGconstant
Note: See TracChangeset
for help on using the changeset viewer.