Changeset 206ecae for src/Parser


Ignore:
Timestamp:
Aug 12, 2024, 10:34:48 AM (2 days ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
8492b85
Parents:
43d9679
Message:

remove spurious push/pop from grammar contexts where type declarations are not allowed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r43d9679 r206ecae  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 10 09:47:05 2024
    13 // Update Count     : 6734
     12// Last Modified On : Mon Aug 12 10:21:46 2024
     13// Update Count     : 6737
    1414//
    1515
     
    18491849
    18501850handler_clause:
    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 ) ) ); }
     1851        handler_key '(' exception_declaration handler_predicate_opt ')' compound_statement
     1852                { $$ = new ClauseNode( build_catch( yylloc, $1, $3, $4, $6 ) ); }
     1853        | handler_clause handler_key '(' exception_declaration handler_predicate_opt ')' compound_statement
     1854                { $$ = $1->set_last( new ClauseNode( build_catch( yylloc, $2, $4, $5, $7 ) ) ); }
    18551855        ;
    18561856
     
    31573157        '|' identifier_or_type_name '(' type_list ')'
    31583158                { $$ = DeclarationNode::newTraitUse( $2, $4 ); }
    3159         | '|' '{' push trait_declaration_list pop '}'
    3160                 { $$ = $4; }
     3159        | '|' '{' trait_declaration_list '}'
     3160                { $$ = $3; }
    31613161        // | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' '(' type_list ')'
    31623162        //      { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; }
     
    32103210        | forall TRAIT identifier_or_type_name '{' '}'          // alternate
    32113211                { $$ = DeclarationNode::newTrait( $3, $1, nullptr ); }
    3212         | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop '}'
     3212        | TRAIT identifier_or_type_name '(' type_parameter_list ')' '{' trait_declaration_list '}'
    32133213                {
    32143214                        SemanticWarning( yylloc, Warning::DeprecTraitSyntax );
    3215                         $$ = DeclarationNode::newTrait( $2, $4, $8 );
    3216                 }
    3217         | forall TRAIT identifier_or_type_name '{' push trait_declaration_list pop '}' // alternate
    3218                 { $$ = DeclarationNode::newTrait( $3, $1, $6 ); }
     3215                        $$ = DeclarationNode::newTrait( $2, $4, $7 );
     3216                }
     3217        | forall TRAIT identifier_or_type_name '{' trait_declaration_list '}' // alternate
     3218                { $$ = DeclarationNode::newTrait( $3, $1, $5 ); }
    32193219        ;
    32203220
    32213221trait_declaration_list:                                                                 // CFA
    32223222        trait_declaration
    3223         | trait_declaration_list pop push trait_declaration
    3224                 { $$ = $1->set_last( $4 ); }
     3223        | trait_declaration_list trait_declaration
     3224                { $$ = $1->set_last( $2 ); }
    32253225        ;
    32263226
     
    32333233        cfa_variable_specifier
    32343234        | cfa_function_specifier
    3235         | cfa_trait_declaring_list pop ',' push identifier_or_type_name
    3236                 { $$ = $1->set_last( $1->cloneType( $5 ) ); }
     3235        | cfa_trait_declaring_list ',' identifier_or_type_name
     3236                { $$ = $1->set_last( $1->cloneType( $3 ) ); }
    32373237        ;
    32383238
     
    32403240        type_specifier declarator
    32413241                { $$ = $2->addType( $1 ); }
    3242         | trait_declaring_list pop ',' push declarator
    3243                 { $$ = $1->set_last( $1->cloneBaseType( $5 ) ); }
     3242        | trait_declaring_list ',' declarator
     3243                { $$ = $1->set_last( $1->cloneBaseType( $3 ) ); }
    32443244        ;
    32453245
Note: See TracChangeset for help on using the changeset viewer.