Changes in src/Parser/parser.yy [4941716:daa4cc1]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r4941716 rdaa4cc1 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 13 11:25:16202413 // Update Count : 67 4012 // Last Modified On : Fri Jul 26 14:09:30 2024 13 // Update Count : 6733 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 { 1629 typedefTable.makeTypedef( *$1->symbolic.name, "enum_type_nobody 1" ); 1630 $$ = DeclarationNode::newEnum( $1->symbolic.name, nullptr, false, false ); 1631 } 1628 { typedefTable.makeTypedef( *$1->symbolic.name, "enum_type_nobody 1" ); 1629 $$ = DeclarationNode::newEnum( $1->symbolic.name, nullptr, false, false ); } 1632 1630 | ENUM identifier 1633 { 1634 typedefTable.makeTypedef( *$2, "enum_type_nobody 2" ); 1635 $$ = DeclarationNode::newEnum( $2, nullptr, false, false ); 1636 } 1631 { typedefTable.makeTypedef( *$2, "enum_type_nobody 2" ); 1632 $$ = DeclarationNode::newEnum( $2, nullptr, false, false ); } 1637 1633 | ENUM type_name 1638 { 1639 typedefTable.makeTypedef( *$2->symbolic.name, "enum_type_nobody 3" ); 1640 $$ = DeclarationNode::newEnum( $2->symbolic.name, nullptr, false, false ); 1641 } 1634 { typedefTable.makeTypedef( *$2->symbolic.name, "enum_type_nobody 3" ); 1635 $$ = DeclarationNode::newEnum( $2->symbolic.name, nullptr, false, false ); } 1642 1636 ; 1643 1637 … … 1855 1849 1856 1850 handler_clause: 1857 handler_key '(' exception_declarationhandler_predicate_opt ')' compound_statement1858 { $$ = new ClauseNode( build_catch( yylloc, $1, $ 3, $4, $6) ); }1859 | handler_clause handler_key '(' exception_declarationhandler_predicate_opt ')' compound_statement1860 { $$ = $1->set_last( new ClauseNode( build_catch( yylloc, $2, $ 4, $5, $7) ) ); }1851 handler_key '(' push exception_declaration pop handler_predicate_opt ')' compound_statement 1852 { $$ = new ClauseNode( build_catch( yylloc, $1, $4, $6, $8 ) ); } 1853 | handler_clause handler_key '(' push exception_declaration pop handler_predicate_opt ')' compound_statement 1854 { $$ = $1->set_last( new ClauseNode( build_catch( yylloc, $2, $5, $7, $9 ) ) ); } 1861 1855 ; 1862 1856 … … 2856 2850 2857 2851 enumerator_list: 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 2852 visible_hide_opt identifier_or_type_name enumerator_value_opt 2861 2853 { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); } 2862 2854 | INLINE type_name … … 3163 3155 '|' identifier_or_type_name '(' type_list ')' 3164 3156 { $$ = DeclarationNode::newTraitUse( $2, $4 ); } 3165 | '|' '{' trait_declaration_list'}'3166 { $$ = $ 3; }3157 | '|' '{' push trait_declaration_list pop '}' 3158 { $$ = $4; } 3167 3159 // | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' '(' type_list ')' 3168 3160 // { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; } … … 3216 3208 | forall TRAIT identifier_or_type_name '{' '}' // alternate 3217 3209 { $$ = DeclarationNode::newTrait( $3, $1, nullptr ); } 3218 | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' trait_declaration_list'}'3210 | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop '}' 3219 3211 { 3220 3212 SemanticWarning( yylloc, Warning::DeprecTraitSyntax ); 3221 $$ = DeclarationNode::newTrait( $2, $4, $ 7);3222 } 3223 | forall TRAIT identifier_or_type_name '{' trait_declaration_list'}' // alternate3224 { $$ = DeclarationNode::newTrait( $3, $1, $ 5); }3213 $$ = DeclarationNode::newTrait( $2, $4, $8 ); 3214 } 3215 | forall TRAIT identifier_or_type_name '{' push trait_declaration_list pop '}' // alternate 3216 { $$ = DeclarationNode::newTrait( $3, $1, $6 ); } 3225 3217 ; 3226 3218 3227 3219 trait_declaration_list: // CFA 3228 3220 trait_declaration 3229 | trait_declaration_list trait_declaration3230 { $$ = $1->set_last( $ 2); }3221 | trait_declaration_list pop push trait_declaration 3222 { $$ = $1->set_last( $4 ); } 3231 3223 ; 3232 3224 … … 3239 3231 cfa_variable_specifier 3240 3232 | cfa_function_specifier 3241 | cfa_trait_declaring_list ','identifier_or_type_name3242 { $$ = $1->set_last( $1->cloneType( $ 3) ); }3233 | cfa_trait_declaring_list pop ',' push identifier_or_type_name 3234 { $$ = $1->set_last( $1->cloneType( $5 ) ); } 3243 3235 ; 3244 3236 3245 3237 trait_declaring_list: // CFA 3246 // Cannot declare an aggregate or enumeration in a trait. 3247 type_specifier_nobody declarator 3238 type_specifier declarator 3248 3239 { $$ = $2->addType( $1 ); } 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; } 3240 | trait_declaring_list pop ',' push declarator 3241 { $$ = $1->set_last( $1->cloneBaseType( $5 ) ); } 3253 3242 ; 3254 3243
Note: See TracChangeset
for help on using the changeset viewer.