Changes in src/Parser/parser.yy [374cb117:d824715]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r374cb117 rd824715 380 380 381 381 %type<decl> enumerator_list enum_type enum_type_nobody 382 %type< in> enumerator_value_opt382 %type<en> enumerator_value_opt 383 383 384 384 %type<decl> external_definition external_definition_list external_definition_list_opt … … 2303 2303 ; 2304 2304 2305 enum_type: // static DeclarationNode * newEnum( const std::string * name, DeclarationNode * constants, bool body, bool typed );// enum2305 enum_type: // enum 2306 2306 ENUM attribute_list_opt '{' enumerator_list comma_opt '}' 2307 2307 { $$ = DeclarationNode::newEnum( nullptr, $4, true )->addQualifiers( $2 ); } … … 2315 2315 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}' 2316 2316 { 2317 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) 2318 { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2319 2320 $$ = DeclarationNode::newEnum( nullptr, $7, true ) ->addQualifiers( $5 ) -> addEnumBase( $3 ); 2321 } 2322 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt identifier attribute_list_opt // Question: why attributes/qualifier after identifier 2317 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2318 SemanticError( yylloc, "Typed enumeration is currently unimplemented." ); $$ = nullptr; 2319 } 2320 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt identifier attribute_list_opt 2323 2321 { 2324 2322 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } … … 2327 2325 '{' enumerator_list comma_opt '}' 2328 2326 { 2329 $$ = DeclarationNode::newEnum( $6, $10, true ) -> addQualifiers( $5 ) -> addQualifiers( $7 ) -> addEnumBase( $3 );2327 SemanticError( yylloc, "Typed enumeration is currently unimplemented." ); $$ = nullptr; 2330 2328 } 2331 2329 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}' … … 2333 2331 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2334 2332 typedefTable.makeTypedef( *$6->name ); 2335 $$ = DeclarationNode::newEnum( $6->name, $9, true ) -> addQualifiers( $5 ) -> addQualifiers( $7 ) -> addEnumBase( $3 );2333 SemanticError( yylloc, "Typed enumeration is currently unimplemented." ); $$ = nullptr; 2336 2334 } 2337 2335 | enum_type_nobody … … 2347 2345 enumerator_list: 2348 2346 identifier_or_type_name enumerator_value_opt 2349 { $$ = DeclarationNode::newEnum ValueGeneric( $1, $2 ); }2347 { $$ = DeclarationNode::newEnumConstant( $1, $2 ); } 2350 2348 | INLINE type_name 2351 { $$ = DeclarationNode::newEnum ValueGeneric( new string("inline"), nullptr ); }2349 { $$ = DeclarationNode::newEnumConstant( new string("inline"), nullptr ); } 2352 2350 | enumerator_list ',' identifier_or_type_name enumerator_value_opt 2353 { $$ = $1->appendList( DeclarationNode::newEnum ValueGeneric( $3, $4 ) ); }2351 { $$ = $1->appendList( DeclarationNode::newEnumConstant( $3, $4 ) ); } 2354 2352 | enumerator_list ',' INLINE type_name enumerator_value_opt 2355 { $$ = $1->appendList( DeclarationNode::newEnum ValueGeneric( new string("inline"), nullptr ) ); }2353 { $$ = $1->appendList( DeclarationNode::newEnumConstant( new string("inline"), nullptr ) ); } 2356 2354 ; 2357 2355 … … 2362 2360 // { $$ = $2; } 2363 2361 | simple_assignment_operator initializer 2364 { $$ = $ 1 == OperKinds::Assign ? $2 : $2->set_maybeConstructed( false ); }2362 { $$ = $2->get_expression(); } // FIX ME: enum only deals with constant_expression 2365 2363 ; 2366 2364
Note:
See TracChangeset
for help on using the changeset viewer.