Changes in / [1d9dc9c:ed274fe]


Ignore:
Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypedefTable.cc

    r1d9dc9c red274fe  
    1010// Created On       : Sat May 16 15:20:13 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 12 06:11:28 2023
    13 // Update Count     : 276
     12// Last Modified On : Tue Feb 15 08:27:24 2022
     13// Update Count     : 275
    1414//
    1515
     
    1717#include "TypedefTable.h"
    1818
    19 #include <cassert>                                                                              // for assert
    20 #include <string>                                                                               // for string
    21 #include <iostream>                                                                             // for iostream
     19#include <cassert>                                // for assert
     20#include <string>                                 // for string
     21#include <iostream>                               // for iostream
    2222
    23 #include "ExpressionNode.h"                                                             // for LabelNode
    24 #include "ParserTypes.h"                                                                // for Token
    25 #include "StatementNode.h"                                                              // for CondCtl, ForCtrl
     23#include "ExpressionNode.h"                       // for LabelNode
     24#include "ParserTypes.h"                          // for Token
     25#include "StatementNode.h"                        // for CondCtl, ForCtrl
    2626// This (generated) header must come late as it is missing includes.
    27 #include "parser.hh"                                                                    // for IDENTIFIER, TYPEDEFname, TYPEGENname
     27#include "parser.hh"              // for IDENTIFIER, TYPEDEFname, TYPEGENname
    2828
    2929using namespace std;
     
    7272// "struct". Only generate the typedef, if the name is not in use. The typedef is implicitly (silently) removed if the
    7373// name is explicitly used.
    74 void TypedefTable::makeTypedef( const string & name, int kind, const char * locn __attribute__((unused)) ) {
     74void TypedefTable::makeTypedef( const string & name, int kind ) {
    7575//    Check for existence is necessary to handle:
    7676//        struct Fred {};
     
    8080//           Fred();
    8181//        }
    82         debugPrint( cerr << "Make typedef at " << locn << " \"" << name << "\" as " << kindName( kind ) << " scope " << kindTable.currentScope() << endl );
    8382        if ( ! typedefTable.exists( name ) ) {
    8483                typedefTable.addToEnclosingScope( name, kind, "MTD" );
     
    8685} // TypedefTable::makeTypedef
    8786
    88 void TypedefTable::makeTypedef( const string & name, const char * locn __attribute__((unused)) ) {
    89         debugPrint( cerr << "Make typedef at " << locn << " \"" << name << " scope " << kindTable.currentScope() << endl );
    90         return makeTypedef( name, TYPEDEFname, "makeTypede" );
     87void TypedefTable::makeTypedef( const string & name ) {
     88        return makeTypedef( name, TYPEDEFname );
    9189} // TypedefTable::makeTypedef
    9290
    9391void TypedefTable::addToScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) {
    9492        KindTable::size_type scope = kindTable.currentScope();
    95         debugPrint( cerr << "Adding current at " << locn << " \"" << identifier << "\" as " << kindName( kind ) << " scope " << scope << endl );
     93        debugPrint( cerr << "Adding current at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << endl );
    9694        kindTable.insertAt( scope, identifier, kind );
    9795} // TypedefTable::addToScope
     
    10098        KindTable::size_type scope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level;
    10199//      size_type scope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level;
    102         debugPrint( cerr << "Adding enclosing at " << locn << " \"" << identifier << "\" as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl );
     100        debugPrint( cerr << "Adding enclosing at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl );
    103101        pair< KindTable::iterator, bool > ret = kindTable.insertAt( scope, identifier, kind );
    104102        if ( ! ret.second ) ret.first->second = kind;           // exists => update
  • src/Parser/TypedefTable.h

    r1d9dc9c red274fe  
    1010// Created On       : Sat May 16 15:24:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 12 06:09:37 2023
    13 // Update Count     : 118
     12// Last Modified On : Sat Feb 15 08:06:37 2020
     13// Update Count     : 117
    1414//
    1515
     
    2121
    2222class TypedefTable {
    23         struct Note {
    24                 size_t level;
    25                 bool forall;
    26         };
     23        struct Note { size_t level; bool forall; };
    2724        typedef ScopedMap< std::string, int, Note > KindTable;
    2825        KindTable kindTable;
     
    3431        bool existsCurr( const std::string & identifier ) const;
    3532        int isKind( const std::string & identifier ) const;
    36         void makeTypedef( const std::string & name, int kind, const char * );
    37         void makeTypedef( const std::string & name, const char * );
     33        void makeTypedef( const std::string & name, int kind );
     34        void makeTypedef( const std::string & name );
    3835        void addToScope( const std::string & identifier, int kind, const char * );
    3936        void addToEnclosingScope( const std::string & identifier, int kind, const char * );
  • src/Parser/parser.yy

    r1d9dc9c red274fe  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 12 06:14:16 2023
    13 // Update Count     : 6382
     12// Last Modified On : Fri Jun 30 12:32:36 2023
     13// Update Count     : 6364
    1414//
    1515
     
    385385%type<str> string_literal_list
    386386
    387 %type<enum_hiding> hide_opt                             visible_hide_opt
     387%type<enum_hiding> hide_opt                                     visible_hide_opt
    388388
    389389// expressions
    390390%type<expr> constant
    391 %type<expr> tuple                                               tuple_expression_list
     391%type<expr> tuple                                                       tuple_expression_list
    392392%type<oper> ptrref_operator                             unary_operator                          assignment_operator                     simple_assignment_operator      compound_assignment_operator
    393393%type<expr> primary_expression                  postfix_expression                      unary_expression
    394 %type<expr> cast_expression_list                cast_expression                         exponential_expression          multiplicative_expression       additive_expression
    395 %type<expr> shift_expression                    relational_expression           equality_expression
     394%type<expr> cast_expression_list                        cast_expression                         exponential_expression          multiplicative_expression       additive_expression
     395%type<expr> shift_expression                            relational_expression           equality_expression
    396396%type<expr> AND_expression                              exclusive_OR_expression         inclusive_OR_expression
    397397%type<expr> logical_AND_expression              logical_OR_expression
    398398%type<expr> conditional_expression              constant_expression                     assignment_expression           assignment_expression_opt
    399 %type<expr> comma_expression                    comma_expression_opt
    400 %type<expr> argument_expression_list_opt argument_expression_list       argument_expression                     default_initializer_opt
     399%type<expr> comma_expression                            comma_expression_opt
     400%type<expr> argument_expression_list_opt        argument_expression_list        argument_expression                     default_initializer_opt
    401401%type<ifctl> conditional_declaration
    402 %type<forctl> for_control_expression    for_control_expression_list
     402%type<forctl> for_control_expression            for_control_expression_list
    403403%type<oper> upupeq updown updowneq downupdowneq
    404404%type<expr> subrange
    405405%type<decl> asm_name_opt
    406 %type<expr> asm_operands_opt                    asm_operands_list                       asm_operand
     406%type<expr> asm_operands_opt                            asm_operands_list                       asm_operand
    407407%type<labels> label_list
    408408%type<expr> asm_clobbers_list_opt
     
    412412
    413413// statements
    414 %type<stmt> statement                                   labeled_statement                       compound_statement
     414%type<stmt> statement                                           labeled_statement                       compound_statement
    415415%type<stmt> statement_decl                              statement_decl_list                     statement_list_nodecl
    416416%type<stmt> selection_statement                 if_statement
    417 %type<clause> switch_clause_list_opt    switch_clause_list
     417%type<clause> switch_clause_list_opt            switch_clause_list
    418418%type<expr> case_value
    419 %type<clause> case_clause                               case_value_list                         case_label      case_label_list
     419%type<clause> case_clause                               case_value_list                         case_label                                      case_label_list
    420420%type<stmt> iteration_statement                 jump_statement
    421 %type<stmt> expression_statement                asm_statement
     421%type<stmt> expression_statement                        asm_statement
    422422%type<stmt> with_statement
    423423%type<expr> with_clause_opt
     
    427427%type<stmt> mutex_statement
    428428%type<expr> when_clause                                 when_clause_opt                         waitfor         waituntil               timeout
    429 %type<stmt> waitfor_statement                   waituntil_statement
     429%type<stmt> waitfor_statement                           waituntil_statement
    430430%type<wfs> wor_waitfor_clause
    431431%type<wucn> waituntil_clause                    wand_waituntil_clause       wor_waituntil_clause
     
    601601// around the list separator.
    602602//
    603 //  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     603//  int f( forall(T) T (*f1) T , forall( S ) S (*f2)( S ) );
    604604//      push               pop   push                   pop
    605605
     
    17151715        | wor_waituntil_clause wor when_clause_opt timeout statement wor when_clause ELSE statement
    17161716                { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1,
    1717                                 new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::OR,
    1718                                         build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ),
    1719                                         build_waituntil_else( yylloc, $7, maybe_build_compound( yylloc, $9 ) ) ) ); }
     1717                new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::OR,
     1718                    build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ),
     1719                    build_waituntil_else( yylloc, $7, maybe_build_compound( yylloc, $9 ) ) ) ); }
    17201720        ;
    17211721
     
    17241724                // SKULLDUGGERY: create an empty compound statement to test parsing of waituntil statement.
    17251725                {
    1726                         $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) );
    1727                         // $$ = new StatementNode( build_compound( yylloc, nullptr ) );
    1728                 }
     1726            $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) );
     1727            // $$ = new StatementNode( build_compound( yylloc, nullptr ) );
     1728        }
    17291729        ;
    17301730
     
    20072007        TYPEDEF cfa_variable_specifier
    20082008                {
    2009                         typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "cfa_typedef_declaration 1" );
     2009                        typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "1" );
    20102010                        $$ = $2->addTypedef();
    20112011                }
    20122012        | TYPEDEF cfa_function_specifier
    20132013                {
    2014                         typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "cfa_typedef_declaration 2" );
     2014                        typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "2" );
    20152015                        $$ = $2->addTypedef();
    20162016                }
    20172017        | cfa_typedef_declaration pop ',' push identifier
    20182018                {
    2019                         typedefTable.addToEnclosingScope( *$5, TYPEDEFname, "cfa_typedef_declaration 3" );
     2019                        typedefTable.addToEnclosingScope( *$5, TYPEDEFname, "3" );
    20202020                        $$ = $1->appendList( $1->cloneType( $5 ) );
    20212021                }
     
    20282028        TYPEDEF type_specifier declarator
    20292029                {
    2030                         typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "typedef_declaration 1" );
     2030                        typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "4" );
    20312031                        if ( $2->type->forall || ($2->type->kind == TypeData::Aggregate && $2->type->aggregate.params) ) {
    20322032                                SemanticError( yylloc, "forall qualifier in typedef is currently unimplemented." ); $$ = nullptr;
     
    20352035        | typedef_declaration pop ',' push declarator
    20362036                {
    2037                         typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname, "typedef_declaration 2" );
     2037                        typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname, "5" );
    20382038                        $$ = $1->appendList( $1->cloneBaseType( $5 )->addTypedef() );
    20392039                }
     
    24652465        | aggregate_key attribute_list_opt identifier
    24662466                {
    2467                         typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type: 1" );
     2467                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
    24682468                        forall = false;                                                         // reset
    24692469                }
     
    24742474        | aggregate_key attribute_list_opt TYPEDEFname          // unqualified type name
    24752475                {
    2476                         typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type: 2" );
     2476                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
    24772477                        forall = false;                                                         // reset
    24782478                }
     
    24842484        | aggregate_key attribute_list_opt TYPEGENname          // unqualified type name
    24852485                {
    2486                         typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type: 3" );
     2486                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
    24872487                        forall = false;                                                         // reset
    24882488                }
     
    25052505        aggregate_key attribute_list_opt identifier
    25062506                {
    2507                         typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type_nobody" );
     2507                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname );
    25082508                        forall = false;                                                         // reset
    25092509                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
     
    26832683                { SemanticError( yylloc, "syntax error, hiding '!' the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr; }
    26842684        | ENUM attribute_list_opt identifier
    2685                 { typedefTable.makeTypedef( *$3, "enum_type 1" ); }
     2685                { typedefTable.makeTypedef( *$3 ); }
    26862686          hide_opt '{' enumerator_list comma_opt '}'
    26872687                { $$ = DeclarationNode::newEnum( $3, $7, true, false, nullptr, $5 )->addQualifiers( $2 ); }
     
    27082708                                SemanticError( yylloc, "syntax error, storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." );
    27092709                        }
    2710                         typedefTable.makeTypedef( *$6, "enum_type 2" );
     2710                        typedefTable.makeTypedef( *$6 );
    27112711                }
    27122712          hide_opt '{' enumerator_list comma_opt '}'
     
    27382738enum_type_nobody:                                                                               // enum - {...}
    27392739        ENUM attribute_list_opt identifier
    2740                 {
    2741                         typedefTable.makeTypedef( *$3, "enum_type_nobody 1" );
    2742                         $$ = DeclarationNode::newEnum( $3, nullptr, false, false )->addQualifiers( $2 );
    2743                 }
     2740                { typedefTable.makeTypedef( *$3 ); $$ = DeclarationNode::newEnum( $3, nullptr, false, false )->addQualifiers( $2 ); }
    27442741        | ENUM attribute_list_opt type_name
    2745                 {
    2746                         typedefTable.makeTypedef( *$3->type->symbolic.name, "enum_type_nobody 2" );
    2747                         $$ = DeclarationNode::newEnum( $3->type->symbolic.name, nullptr, false, false )->addQualifiers( $2 );
    2748                 }
     2742                { typedefTable.makeTypedef( *$3->type->symbolic.name ); $$ = DeclarationNode::newEnum( $3->type->symbolic.name, nullptr, false, false )->addQualifiers( $2 ); }
    27492743        ;
    27502744
     
    28142808                { $$ = nullptr; }
    28152809        | parameter_list
    2816         | parameter_list ',' ELLIPSIS
     2810        | parameter_list pop ',' push ELLIPSIS
    28172811                { $$ = $1->addVarArgs(); }
    28182812        ;
     
    28212815        abstract_parameter_declaration
    28222816        | parameter_declaration
    2823         | parameter_list ',' abstract_parameter_declaration
    2824                 { $$ = $1->appendList( $3 ); }
    2825         | parameter_list ',' parameter_declaration
    2826                 { $$ = $1->appendList( $3 ); }
     2817        | parameter_list pop ',' push abstract_parameter_declaration
     2818                { $$ = $1->appendList( $5 ); }
     2819        | parameter_list pop ',' push parameter_declaration
     2820                { $$ = $1->appendList( $5 ); }
    28272821        ;
    28282822
     
    29892983        type_class identifier_or_type_name
    29902984                {
    2991                         typedefTable.addToScope( *$2, TYPEDEFname, "type_parameter 1" );
     2985                        typedefTable.addToScope( *$2, TYPEDEFname, "9" );
    29922986                        if ( $1 == ast::TypeDecl::Otype ) { SemanticError( yylloc, "otype keyword is deprecated, use T " ); }
    29932987                        if ( $1 == ast::TypeDecl::Dtype ) { SemanticError( yylloc, "dtype keyword is deprecated, use T &" ); }
     
    29972991                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    29982992        | identifier_or_type_name new_type_class
    2999                 { typedefTable.addToScope( *$1, TYPEDEFname, "type_parameter 2" ); }
     2993                { typedefTable.addToScope( *$1, TYPEDEFname, "9" ); }
    30002994          type_initializer_opt assertion_list_opt
    30012995                { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    30022996        | '[' identifier_or_type_name ']'
    30032997                {
    3004                         typedefTable.addToScope( *$2, TYPEDIMname, "type_parameter 3" );
     2998                        typedefTable.addToScope( *$2, TYPEDIMname, "9" );
    30052999                        $$ = DeclarationNode::newTypeParam( ast::TypeDecl::Dimension, $2 );
    30063000                }
     
    30843078        identifier_or_type_name
    30853079                {
    3086                         typedefTable.addToEnclosingScope( *$1, TYPEDEFname, "type_declarator_name 1" );
     3080                        typedefTable.addToEnclosingScope( *$1, TYPEDEFname, "10" );
    30873081                        $$ = DeclarationNode::newTypeDecl( $1, nullptr );
    30883082                }
    30893083        | identifier_or_type_name '(' type_parameter_list ')'
    30903084                {
    3091                         typedefTable.addToEnclosingScope( *$1, TYPEGENname, "type_declarator_name 2" );
     3085                        typedefTable.addToEnclosingScope( *$1, TYPEGENname, "11" );
    30923086                        $$ = DeclarationNode::newTypeDecl( $1, $3 );
    30933087                }
     
    34783472
    34793473variable_function:
    3480         '(' variable_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3481                 { $$ = $2->addParamList( $5 ); }
    3482         | '(' attribute_list variable_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3483                 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); }
     3474        '(' variable_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3475                { $$ = $2->addParamList( $6 ); }
     3476        | '(' attribute_list variable_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3477                { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); }
    34843478        | '(' variable_function ')'                                                     // redundant parenthesis
    34853479                { $$ = $2; }
     
    35013495
    35023496function_no_ptr:
    3503         paren_identifier '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3504                 { $$ = $1->addParamList( $3 ); }
    3505         | '(' function_ptr ')' '(' parameter_type_list_opt ')'
    3506                 { $$ = $2->addParamList( $5 ); }
    3507         | '(' attribute_list function_ptr ')' '(' parameter_type_list_opt ')'
    3508                 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); }
     3497        paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3498                { $$ = $1->addParamList( $4 ); }
     3499        | '(' function_ptr ')' '(' push parameter_type_list_opt pop ')'
     3500                { $$ = $2->addParamList( $6 ); }
     3501        | '(' attribute_list function_ptr ')' '(' push parameter_type_list_opt pop ')'
     3502                { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); }
    35093503        | '(' function_no_ptr ')'                                                       // redundant parenthesis
    35103504                { $$ = $2; }
     
    35553549        paren_identifier '(' identifier_list ')'                        // function_declarator handles empty parameter
    35563550                { $$ = $1->addIdList( $3 ); }
    3557         | '(' KR_function_ptr ')' '(' parameter_type_list_opt ')'
    3558                 { $$ = $2->addParamList( $5 ); }
    3559         | '(' attribute_list KR_function_ptr ')' '(' parameter_type_list_opt ')'
    3560                 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); }
     3551        | '(' KR_function_ptr ')' '(' push parameter_type_list_opt pop ')'
     3552                { $$ = $2->addParamList( $6 ); }
     3553        | '(' attribute_list KR_function_ptr ')' '(' push parameter_type_list_opt pop ')'
     3554                { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); }
    35613555        | '(' KR_function_no_ptr ')'                                            // redundant parenthesis
    35623556                { $$ = $2; }
     
    36023596                {
    36033597                        // hide type name in enclosing scope by variable name
    3604                         typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER, "paren_type" );
     3598                        typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER, "ID" );
    36053599                }
    36063600        | '(' paren_type ')'
     
    36473641
    36483642variable_type_function:
    3649         '(' variable_type_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3650                 { $$ = $2->addParamList( $5 ); }
    3651         | '(' attribute_list variable_type_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3652                 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); }
     3643        '(' variable_type_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3644                { $$ = $2->addParamList( $6 ); }
     3645        | '(' attribute_list variable_type_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3646                { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); }
    36533647        | '(' variable_type_function ')'                                        // redundant parenthesis
    36543648                { $$ = $2; }
     
    36703664
    36713665function_type_no_ptr:
    3672         paren_type '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3673                 { $$ = $1->addParamList( $3 ); }
    3674         | '(' function_type_ptr ')' '(' parameter_type_list_opt ')'
    3675                 { $$ = $2->addParamList( $5 ); }
    3676         | '(' attribute_list function_type_ptr ')' '(' parameter_type_list_opt ')'
    3677                 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); }
     3666        paren_type '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3667                { $$ = $1->addParamList( $4 ); }
     3668        | '(' function_type_ptr ')' '(' push parameter_type_list_opt pop ')'
     3669                { $$ = $2->addParamList( $6 ); }
     3670        | '(' attribute_list function_type_ptr ')' '(' push parameter_type_list_opt pop ')'
     3671                { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); }
    36783672        | '(' function_type_no_ptr ')'                                          // redundant parenthesis
    36793673                { $$ = $2; }
     
    37463740
    37473741identifier_parameter_function:
    3748         paren_identifier '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3749                 { $$ = $1->addParamList( $3 ); }
    3750         | '(' identifier_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3751                 { $$ = $2->addParamList( $5 ); }
     3742        paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3743                { $$ = $1->addParamList( $4 ); }
     3744        | '(' identifier_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3745                { $$ = $2->addParamList( $6 ); }
    37523746        | '(' identifier_parameter_function ')'                         // redundant parenthesis
    37533747                { $$ = $2; }
     
    37993793
    38003794type_parameter_function:
    3801         typedef_name '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3802                 { $$ = $1->addParamList( $3 ); }
    3803         | '(' type_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3804                 { $$ = $2->addParamList( $5 ); }
     3795        typedef_name '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3796                { $$ = $1->addParamList( $4 ); }
     3797        | '(' type_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3798                { $$ = $2->addParamList( $6 ); }
    38053799        ;
    38063800
     
    38493843
    38503844abstract_function:
    3851         '(' parameter_type_list_opt ')'                 // empty parameter list OBSOLESCENT (see 3)
    3852                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    3853         | '(' abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3854                 { $$ = $2->addParamList( $5 ); }
     3845        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
     3846                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
     3847        | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3848                { $$ = $2->addParamList( $6 ); }
    38553849        | '(' abstract_function ')'                                                     // redundant parenthesis
    38563850                { $$ = $2; }
     
    39723966
    39733967abstract_parameter_function:
    3974         '(' parameter_type_list_opt ')'                 // empty parameter list OBSOLESCENT (see 3)
    3975                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
    3976         | '(' abstract_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    3977                 { $$ = $2->addParamList( $5 ); }
     3968        '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
     3969                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
     3970        | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     3971                { $$ = $2->addParamList( $6 ); }
    39783972        | '(' abstract_parameter_function ')'                           // redundant parenthesis
    39793973                { $$ = $2; }
     
    40124006// This pattern parses a declaration of an abstract variable, but does not allow "int ()" for a function pointer.
    40134007//
    4014 //   struct S {
    4015 //       int;
    4016 //       int *;
    4017 //       int [10];
    4018 //       int (*)();
    4019 //   };
     4008//              struct S {
     4009//          int;
     4010//          int *;
     4011//          int [10];
     4012//          int (*)();
     4013//      };
    40204014
    40214015variable_abstract_declarator:
     
    40514045
    40524046variable_abstract_function:
    4053         '(' variable_abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
    4054                 { $$ = $2->addParamList( $5 ); }
     4047        '(' variable_abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
     4048                { $$ = $2->addParamList( $6 ); }
    40554049        | '(' variable_abstract_function ')'                            // redundant parenthesis
    40564050                { $$ = $2; }
Note: See TracChangeset for help on using the changeset viewer.