Changeset cd7ef0b for src/Parser/parser.yy
- Timestamp:
- Aug 10, 2017, 3:39:11 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 38d70ab
- Parents:
- 275f4b4 (diff), e1780a2 (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) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r275f4b4 rcd7ef0b 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jul 25 10:07:00 201713 // Update Count : 24 6412 // Last Modified On : Wed Aug 4 13:33:00 2017 13 // Update Count : 2475 14 14 // 15 15 … … 142 142 // converted into the tuple index (.)(1). e.g., 3.x 143 143 %token<tok> REALDECIMALconstant REALFRACTIONconstant FLOATINGconstant 144 %token<tok> ZERO ONE // CFA145 144 146 145 // multi-character operators … … 159 158 %token ATassign // @= 160 159 161 %type<tok> identifier no_attr_identifier zero_one160 %type<tok> identifier no_attr_identifier 162 161 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name attr_name 163 162 %type<constant> string_literal … … 183 182 %type<en> asm_clobbers_list_opt 184 183 %type<flag> asm_volatile_opt 184 %type<en> handler_predicate_opt 185 185 186 186 // statements … … 360 360 ; 361 361 362 zero_one: // CFA363 ZERO364 | ONE365 ;366 367 362 string_literal: 368 363 string_literal_list { $$ = build_constantStr( *$1 ); } … … 384 379 IDENTIFIER // typedef name cannot be used as a variable name 385 380 { $$ = new ExpressionNode( build_varref( $1 ) ); } 386 | zero_one387 { $$ = new ExpressionNode( build_constantZeroOne( *$1 ) ); }388 381 | tuple 389 382 | '(' comma_expression ')' … … 485 478 $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); 486 479 } 487 | zero_one fraction_constants488 {489 $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantZeroOne( *$1 ), $2 ) );490 }491 480 ; 492 481 … … 539 528 | ALIGNOF unary_expression // GCC, variable alignment 540 529 { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); } 541 | ALIGNOF '(' type_no_function ')' // GCC, type alignment530 | ALIGNOF '(' type_no_function ')' // GCC, type alignment 542 531 { $$ = new ExpressionNode( build_alignOftype( $3 ) ); } 543 532 | OFFSETOF '(' type_no_function ',' no_attr_identifier ')' … … 980 969 981 970 handler_clause: 982 // TEMPORARY, TEST EXCEPTIONS 983 handler_key '(' push push INTEGERconstant pop ')' compound_statement pop 984 { $$ = new StatementNode( build_catch( $1, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); } 985 | handler_clause handler_key '(' push push INTEGERconstant pop ')' compound_statement pop 986 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); } 987 988 | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop 989 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); } 971 handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop 972 { $$ = new StatementNode( build_catch( $1, $5, $7, $9 ) ); } 990 973 | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop 991 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); }974 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, $8, $10 ) ) ); } 992 975 ; 993 976 994 977 handler_predicate_opt: 995 978 //empty 979 { $$ = nullptr; } 996 980 | ';' conditional_expression 981 { $$ = $2; } 997 982 ; 998 983 … … 1686 1671 | aggregate_key attribute_list_opt typegen_name // CFA 1687 1672 { $$ = $3->addQualifiers( $2 ); } 1688 1689 // Temp, testing TreeStruct1690 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name1691 {1692 typedefTable.makeTypedef( *$4 ); // create typedef1693 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $1694 forall = false; // reset1695 }1696 '{' field_declaration_list '}'1697 {1698 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,1699 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );1700 }1701 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname1702 {1703 typedefTable.makeTypedef( *$4 ); // create typedef1704 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $1705 forall = false; // reset1706 }1707 '{' field_declaration_list '}'1708 {1709 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,1710 $4, $5, nullptr, $8, true )->addQualifiers( $3 );1711 }1712 1673 ; 1713 1674 … … 1969 1930 | '=' initializer 1970 1931 { $$ = $2; } 1932 | '=' VOID 1933 { $$ = nullptr; } 1971 1934 | ATassign initializer 1972 1935 { $$ = $2->set_maybeConstructed( false ); }
Note:
See TracChangeset
for help on using the changeset viewer.