Changeset d1f5054 for src/Parser/parser.yy
- Timestamp:
- Aug 14, 2024, 11:55:20 AM (17 months ago)
- Branches:
- master
- Children:
- 960665c
- Parents:
- 26d40a1 (diff), 2870cb6 (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) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r26d40a1 rd1f5054 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 26 14:09:30202413 // Update Count : 67 3312 // Last Modified On : Tue Aug 13 11:25:16 2024 13 // Update Count : 6740 14 14 // 15 15 … … 952 952 } 953 953 | COUNTOF unary_expression 954 { $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuild( $2 ) ) ); }954 { $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuild( $2 ) ) ); } 955 955 | COUNTOF '(' type_no_function ')' 956 956 { $$ = new ExpressionNode( new ast::CountExpr( yylloc, maybeMoveBuildType( $3 ) ) ); } … … 1626 1626 enum_key: 1627 1627 type_name 1628 { typedefTable.makeTypedef( *$1->symbolic.name, "enum_type_nobody 1" ); 1629 $$ = DeclarationNode::newEnum( $1->symbolic.name, nullptr, false, false ); } 1628 { 1629 typedefTable.makeTypedef( *$1->symbolic.name, "enum_type_nobody 1" ); 1630 $$ = DeclarationNode::newEnum( $1->symbolic.name, nullptr, false, false ); 1631 } 1630 1632 | ENUM identifier 1631 { typedefTable.makeTypedef( *$2, "enum_type_nobody 2" ); 1632 $$ = DeclarationNode::newEnum( $2, nullptr, false, false ); } 1633 { 1634 typedefTable.makeTypedef( *$2, "enum_type_nobody 2" ); 1635 $$ = DeclarationNode::newEnum( $2, nullptr, false, false ); 1636 } 1633 1637 | ENUM type_name 1634 { typedefTable.makeTypedef( *$2->symbolic.name, "enum_type_nobody 3" ); 1635 $$ = DeclarationNode::newEnum( $2->symbolic.name, nullptr, false, false ); } 1638 { 1639 typedefTable.makeTypedef( *$2->symbolic.name, "enum_type_nobody 3" ); 1640 $$ = DeclarationNode::newEnum( $2->symbolic.name, nullptr, false, false ); 1641 } 1636 1642 ; 1637 1643 … … 1849 1855 1850 1856 handler_clause: 1851 handler_key '(' push exception_declaration pophandler_predicate_opt ')' compound_statement1852 { $$ = new ClauseNode( build_catch( yylloc, $1, $ 4, $6, $8) ); }1853 | handler_clause handler_key '(' push exception_declaration pophandler_predicate_opt ')' compound_statement1854 { $$ = $1->set_last( new ClauseNode( build_catch( yylloc, $2, $ 5, $7, $9) ) ); }1857 handler_key '(' exception_declaration handler_predicate_opt ')' compound_statement 1858 { $$ = new ClauseNode( build_catch( yylloc, $1, $3, $4, $6 ) ); } 1859 | handler_clause handler_key '(' exception_declaration handler_predicate_opt ')' compound_statement 1860 { $$ = $1->set_last( new ClauseNode( build_catch( yylloc, $2, $4, $5, $7 ) ) ); } 1855 1861 ; 1856 1862 … … 2850 2856 2851 2857 enumerator_list: 2852 visible_hide_opt identifier_or_type_name enumerator_value_opt 2858 // empty 2859 { SemanticError( yylloc, "enumeration must have a minimum of one enumerator, empty enumerator list is meaningless." ); $$ = nullptr; } 2860 | visible_hide_opt identifier_or_type_name enumerator_value_opt 2853 2861 { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); } 2854 2862 | INLINE type_name … … 3155 3163 '|' identifier_or_type_name '(' type_list ')' 3156 3164 { $$ = DeclarationNode::newTraitUse( $2, $4 ); } 3157 | '|' '{' push trait_declaration_list pop'}'3158 { $$ = $ 4; }3165 | '|' '{' trait_declaration_list '}' 3166 { $$ = $3; } 3159 3167 // | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' '(' type_list ')' 3160 3168 // { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; } … … 3208 3216 | forall TRAIT identifier_or_type_name '{' '}' // alternate 3209 3217 { $$ = DeclarationNode::newTrait( $3, $1, nullptr ); } 3210 | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop'}'3218 | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' trait_declaration_list '}' 3211 3219 { 3212 3220 SemanticWarning( yylloc, Warning::DeprecTraitSyntax ); 3213 $$ = DeclarationNode::newTrait( $2, $4, $ 8);3214 } 3215 | forall TRAIT identifier_or_type_name '{' push trait_declaration_list pop'}' // alternate3216 { $$ = DeclarationNode::newTrait( $3, $1, $ 6); }3221 $$ = DeclarationNode::newTrait( $2, $4, $7 ); 3222 } 3223 | forall TRAIT identifier_or_type_name '{' trait_declaration_list '}' // alternate 3224 { $$ = DeclarationNode::newTrait( $3, $1, $5 ); } 3217 3225 ; 3218 3226 3219 3227 trait_declaration_list: // CFA 3220 3228 trait_declaration 3221 | trait_declaration_list pop pushtrait_declaration3222 { $$ = $1->set_last( $ 4); }3229 | trait_declaration_list trait_declaration 3230 { $$ = $1->set_last( $2 ); } 3223 3231 ; 3224 3232 … … 3231 3239 cfa_variable_specifier 3232 3240 | cfa_function_specifier 3233 | cfa_trait_declaring_list pop ',' pushidentifier_or_type_name3234 { $$ = $1->set_last( $1->cloneType( $ 5) ); }3241 | cfa_trait_declaring_list ',' identifier_or_type_name 3242 { $$ = $1->set_last( $1->cloneType( $3 ) ); } 3235 3243 ; 3236 3244 3237 3245 trait_declaring_list: // CFA 3238 type_specifier declarator 3246 // Cannot declare an aggregate or enumeration in a trait. 3247 type_specifier_nobody declarator 3239 3248 { $$ = $2->addType( $1 ); } 3240 | trait_declaring_list pop ',' push declarator 3241 { $$ = $1->set_last( $1->cloneBaseType( $5 ) ); } 3249 | trait_declaring_list ',' declarator 3250 { $$ = $1->set_last( $1->cloneBaseType( $3 ) ); } 3251 | error 3252 { SemanticError( yylloc, "Possible cause is declaring an aggregate or enumeration type in a trait." ); $$ = nullptr; } 3242 3253 ; 3243 3254
Note:
See TracChangeset
for help on using the changeset viewer.