Changeset 73f04fd for src/Parser
- Timestamp:
- Jan 26, 2021, 11:55:56 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 352cbc2
- Parents:
- 667b3c7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r667b3c7 r73f04fd 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 25 21:41:56202113 // Update Count : 467 012 // Last Modified On : Tue Jan 26 11:18:19 2021 13 // Update Count : 4674 14 14 // 15 15 … … 2014 2014 ; 2015 2015 2016 fred:2017 // empty2018 { yyy = false; }2019 ;2020 2021 2016 aggregate_type: // struct, union 2022 2017 aggregate_key attribute_list_opt … … 2024 2019 '{' field_declaration_list_opt '}' type_parameters_opt 2025 2020 { $$ = DeclarationNode::newAggregate( $1, nullptr, $7, $5, true )->addQualifiers( $2 ); } 2026 | aggregate_key attribute_list_opt identifier fred2021 | aggregate_key attribute_list_opt identifier 2027 2022 { 2028 2023 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef … … 2030 2025 } 2031 2026 '{' field_declaration_list_opt '}' type_parameters_opt 2032 { $$ = DeclarationNode::newAggregate( $1, $3, $ 9, $7, true )->addQualifiers( $2 ); }2033 | aggregate_key attribute_list_opt type_name fred2027 { $$ = DeclarationNode::newAggregate( $1, $3, $8, $6, true )->addQualifiers( $2 ); } 2028 | aggregate_key attribute_list_opt type_name 2034 2029 { 2035 2030 // for type_name can be a qualified type name S.T, in which case only the last name in the chain needs a typedef (other names in the chain should already have one) … … 2038 2033 } 2039 2034 '{' field_declaration_list_opt '}' type_parameters_opt 2040 { $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $ 9, $7, true )->addQualifiers( $2 ); }2035 { $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $8, $6, true )->addQualifiers( $2 ); } 2041 2036 | aggregate_type_nobody 2042 2037 ; … … 2050 2045 2051 2046 aggregate_type_nobody: // struct, union - {...} 2052 aggregate_key attribute_list_opt identifier fred2047 aggregate_key attribute_list_opt identifier 2053 2048 { 2054 2049 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); … … 2056 2051 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); 2057 2052 } 2058 | aggregate_key attribute_list_opt type_name fred2053 | aggregate_key attribute_list_opt type_name 2059 2054 { 2060 2055 forall = false; // reset … … 2194 2189 ; 2195 2190 2196 // Cannot use attribute_list_opt because of ambiguity with enum_specifier_nobody, which already parses attributes. 2191 // Cannot use attribute_list_opt because of ambiguity with enum_specifier_nobody, which already parses attribute. 2192 // Hence, only a single attribute is allowed after the "ENUM". 2197 2193 enum_type: // enum 2198 2194 ENUM attribute_opt '{' enumerator_list comma_opt '}' … … 2202 2198 '{' enumerator_list comma_opt '}' 2203 2199 { $$ = DeclarationNode::newEnum( $3, $6, true )->addQualifiers( $2 ); } 2204 | ENUM attribute_opt typedef 2200 | ENUM attribute_opt typedef // enum cannot be generic 2205 2201 '{' enumerator_list comma_opt '}' 2206 2202 { $$ = DeclarationNode::newEnum( $3->name, $5, true )->addQualifiers( $2 ); } … … 2223 2219 $$ = DeclarationNode::newEnum( $3, 0, false )->addQualifiers( $2 ); 2224 2220 } 2225 | ENUM attribute_opt type_name 2221 | ENUM attribute_opt type_name // enum cannot be generic 2226 2222 { 2227 2223 typedefTable.makeTypedef( *$3->type->symbolic.name );
Note: See TracChangeset
for help on using the changeset viewer.