Changeset d63aeba for src


Ignore:
Timestamp:
Mar 22, 2023, 9:39:55 PM (13 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
18ea270
Parents:
5d9c4bb
Message:

print unimplemented error for forall in typedef

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r5d9c4bb rd63aeba  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 21 19:01:00 2023
    13 // Update Count     : 5990
     12// Last Modified On : Wed Mar 22 21:26:01 2023
     13// Update Count     : 6002
    1414//
    1515
     
    270270        SemanticError( yylloc, ::toString( "Identifier \"", identifier, "\" cannot appear before a ", kind, ".\n"
    271271                                   "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter." ) );
     272} // IdentifierBeforeType
     273
     274static bool TypedefForall( DeclarationNode * decl ) {
     275        if ( decl->type->forall || (decl->type->kind == TypeData::Aggregate && decl->type->aggregate.params) ) {
     276                SemanticError( yylloc, "forall qualifier in typedef is currently unimplemented." );
     277                return true;
     278        } // if
     279        return false;
    272280} // IdentifierBeforeType
    273281
     
    19581966        TYPEDEF type_specifier declarator
    19591967                {
    1960                         // if type_specifier is an anon aggregate => name
    19611968                        typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "4" );
    1962                         $$ = $3->addType( $2 )->addTypedef();           // watchout frees $2 and $3
     1969                        if ( TypedefForall( $2 ) ) $$ = nullptr;
     1970                        else $$ = $3->addType( $2 )->addTypedef();              // watchout frees $2 and $3
    19631971                }
    19641972        | typedef_declaration pop ',' push declarator
     
    19701978                {
    19711979                        typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "6" );
    1972                         $$ = $4->addQualifiers( $1 )->addType( $3 )->addTypedef();
     1980                        if ( TypedefForall( $1 ) ) $$ = nullptr;
     1981                        else $$ = $4->addQualifiers( $1 )->addType( $3 )->addTypedef();
    19731982                }
    19741983        | type_specifier TYPEDEF declarator
    19751984                {
    19761985                        typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "7" );
    1977                         $$ = $3->addType( $1 )->addTypedef();
     1986                        if ( TypedefForall( $1 ) ) $$ = nullptr;
     1987                        else $$ = $3->addType( $1 )->addTypedef();
    19781988                }
    19791989        | type_specifier TYPEDEF type_qualifier_list declarator
    19801990                {
    19811991                        typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "8" );
    1982                         $$ = $4->addQualifiers( $1 )->addType( $1 )->addTypedef();
     1992                        if ( TypedefForall( $3 ) ) $$ = nullptr;
     1993                        else $$ = $4->addQualifiers( $1 )->addType( $1 )->addTypedef();
    19831994                }
    19841995        ;
Note: See TracChangeset for help on using the changeset viewer.