Changeset 4a3386b4 for src/Parser/parser.yy
- Timestamp:
- Jan 19, 2017, 2:56:51 PM (9 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:
- 8f49a54
- Parents:
- 765aa76 (diff), c2416d5 (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
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r765aa76 r4a3386b4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 14 21:28:22 201613 // Update Count : 2 09012 // Last Modified On : Wed Jan 18 15:51:25 2017 13 // Update Count : 2135 14 14 // 15 15 … … 32 32 // 33 33 // 1. designation with and without '=' (use ':' instead) 34 // 2. attributes not allowed in parenthesis of declarator35 34 // 36 35 // All of the syntactic extensions for GCC C are marked with the comment "GCC". The second extensions are for Cforall … … 136 135 137 136 %type<tok> identifier no_01_identifier no_attr_identifier zero_one 138 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name no_01_identifier_or_type_name 137 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name no_01_identifier_or_type_name attr_name 139 138 %type<constant> string_literal 140 139 %type<str> string_literal_list … … 253 252 %type<decl> variable_abstract_ptr variable_array variable_declarator variable_function variable_ptr 254 253 255 %type<decl> attribute_list_opt attribute_list attribute 254 %type<decl> attribute_list_opt attribute_list attribute_name_list attribute attribute_name 256 255 257 256 // initializers … … 709 708 710 709 labeled_statement: 711 // labels cannot be identifiers 0 or 1 712 IDENTIFIER':' attribute_list_opt statement713 { 714 $$ = $4->add_label( $1 );710 // labels cannot be identifiers 0 or 1 or ATTR_IDENTIFIER 711 identifier_or_type_name ':' attribute_list_opt statement 712 { 713 $$ = $4->add_label( $1, $3 ); 715 714 } 716 715 ; … … 877 876 878 877 jump_statement: 879 GOTO IDENTIFIER';'878 GOTO identifier_or_type_name ';' 880 879 { $$ = new StatementNode( build_branch( $2, BranchStmt::Goto ) ); } 881 880 | GOTO '*' comma_expression ';' // GCC, computed goto … … 886 885 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 887 886 { $$ = new StatementNode( build_branch( BranchStmt::Continue ) ); } 888 | CONTINUE IDENTIFIER ';'// CFA, multi-level continue887 | CONTINUE identifier_or_type_name ';' // CFA, multi-level continue 889 888 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and 890 889 // the target of the transfer appears only at the start of an iteration statement. … … 893 892 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 894 893 { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); } 895 | BREAK IDENTIFIER ';'// CFA, multi-level exit894 | BREAK identifier_or_type_name ';' // CFA, multi-level exit 896 895 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and 897 896 // the target of the transfer appears only at the start of an iteration statement. … … 1326 1325 type_qualifier_name 1327 1326 | attribute 1328 //{ $$ = DeclarationNode::newQualifier( DeclarationNode::Attribute ); }1329 1327 ; 1330 1328 … … 2177 2175 2178 2176 attribute: // GCC 2179 ATTRIBUTE '(' '(' attribute_parameter_list ')' ')' 2180 // { $$ = DeclarationNode::newQualifier( DeclarationNode::Attribute ); } 2177 ATTRIBUTE '(' '(' attribute_name_list ')' ')' 2178 { $$ = $4; } 2179 ; 2180 2181 attribute_name_list: // GCC 2182 attribute_name 2183 | attribute_name_list ',' attribute_name 2184 { $$ = $1->addQualifiers( $3 ); } 2185 ; 2186 2187 attribute_name: // GCC 2188 // empty 2181 2189 { $$ = nullptr; } 2182 ; 2183 2184 attribute_parameter_list: // GCC 2185 attrib 2186 | attribute_parameter_list ',' attrib 2187 ; 2188 2189 attrib: // GCC 2190 // empty 2191 | any_word 2192 | any_word '(' comma_expression_opt ')' { delete $3; } // FIX ME: unimplemented 2193 ; 2194 2195 any_word: // GCC 2196 identifier_or_type_name { delete $1; } // FIX ME: unimplemented 2197 | storage_class { delete $1; } // FIX ME: unimplemented 2198 | basic_type_name { delete $1; } // FIX ME: unimplemented 2199 | type_qualifier { delete $1; } // FIX ME: unimplemented 2190 | attr_name 2191 { $$ = DeclarationNode::newAttribute( $1 ); } 2192 | attr_name '(' argument_expression_list ')' 2193 { $$ = DeclarationNode::newAttribute( $1, $3 ); } 2194 ; 2195 2196 attr_name: // GCC 2197 IDENTIFIER 2198 | TYPEDEFname 2199 | TYPEGENname 2200 | CONST 2201 { $$ = Token{ new string( "__const__" ) }; } 2200 2202 ; 2201 2203
Note:
See TracChangeset
for help on using the changeset viewer.