Changeset 407bde5


Ignore:
Timestamp:
Jun 6, 2018, 5:24:52 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
5c25eee
Parents:
25bca42
Message:

first attempt at nested types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r25bca42 r407bde5  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  4 22:22:04 2018
    13 // Update Count     : 3492
     12// Last Modified On : Wed Jun  6 14:53:38 2018
     13// Update Count     : 3522
    1414//
    1515
     
    503503                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    504504        | type_name '.' no_attr_identifier                                      // CFA, nested type
    505                 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     505                // { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     506                { $$ = nullptr; }
    506507        | type_name '.' '[' field_list ']'                                      // CFA, nested type / tuple field selector
    507                 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     508                // { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     509                { $$ = nullptr; }
    508510        | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11
    509511                {
     
    13001302        ;
    13011303
    1302 KR_parameter_list_opt:                                                          // used to declare parameter types in K&R style functions
     1304KR_parameter_list_opt:                                                                  // used to declare parameter types in K&R style functions
    13031305        // empty
    13041306                { $$ = nullptr; }
     
    17901792                { $$ = DeclarationNode::newFromTypedef( $1 ); }
    17911793        | '.' TYPEDEFname
    1792                 { $$ = DeclarationNode::newFromTypedef( $2 ); } // FIX ME
     1794                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    17931795        | type_name '.' TYPEDEFname
    1794                 { $$ = DeclarationNode::newFromTypedef( $3 ); } // FIX ME
     1796                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    17951797        | typegen_name
    17961798        | '.' typegen_name
    1797                 { $$ = $2; }                                                                    // FIX ME
     1799                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    17981800        | type_name '.' typegen_name
    1799                 { $$ = $3; }                                                                    // FIX ME
     1801                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    18001802        ;
    18011803
     
    18221824        aggregate_key attribute_list_opt '{' field_declaration_list_opt '}'
    18231825                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); }
    1824         | aggregate_key attribute_list_opt no_attr_identifier_or_type_name
     1826        | aggregate_key attribute_list_opt no_attr_identifier
    18251827                {
    18261828                        typedefTable.makeTypedef( *$3 );                        // create typedef
     
    18301832          '{' field_declaration_list_opt '}'
    18311833                { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); }
     1834        | aggregate_key attribute_list_opt type_name
     1835                {
     1836                        typedefTable.makeTypedef( *$3->type->symbolic.name ); // create typedef
     1837                        if ( forall ) typedefTable.changeKind( *$3->type->symbolic.name, TYPEGENname ); // possibly update
     1838                        forall = false;                                                         // reset
     1839                }
     1840          '{' field_declaration_list_opt '}'
     1841                { $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, nullptr, $6, true )->addQualifiers( $2 ); }
    18321842        | aggregate_key attribute_list_opt '(' type_list ')' '{' field_declaration_list_opt '}' // CFA
    18331843                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $4, $7, false )->addQualifiers( $2 ); }
     
    18431853                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    18441854                }
    1845         | aggregate_key attribute_list_opt TYPEDEFname
    1846                 {
    1847                         typedefTable.makeTypedef( *$3 );
    1848                         $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    1849                 }
    1850         | aggregate_key attribute_list_opt typegen_name         // CFA
     1855        | aggregate_key attribute_list_opt type_name
    18511856                {
    18521857                        // Create new generic declaration with same name as previous forward declaration, where the IDENTIFIER is
     
    19431948        ENUM attribute_list_opt '{' enumerator_list comma_opt '}'
    19441949                { $$ = DeclarationNode::newEnum( new string( DeclarationNode::anonymous.newName() ), $4, true )->addQualifiers( $2 ); }
    1945         | ENUM attribute_list_opt no_attr_identifier_or_type_name
     1950        | ENUM attribute_list_opt no_attr_identifier
    19461951                { typedefTable.makeTypedef( *$3 ); }
    19471952          '{' enumerator_list comma_opt '}'
    19481953                { $$ = DeclarationNode::newEnum( $3, $6, true )->addQualifiers( $2 ); }
     1954        | ENUM attribute_list_opt type_name
     1955          '{' enumerator_list comma_opt '}'
     1956                { $$ = DeclarationNode::newEnum( $3->type->symbolic.name, $5, true )->addQualifiers( $2 ); }
    19491957        | enum_type_nobody
    19501958        ;
    19511959
    19521960enum_type_nobody:                                                                               // enum - {...}
    1953         ENUM attribute_list_opt no_attr_identifier_or_type_name
     1961        ENUM attribute_list_opt no_attr_identifier
    19541962                {
    19551963                        typedefTable.makeTypedef( *$3 );
    19561964                        $$ = DeclarationNode::newEnum( $3, 0, false )->addQualifiers( $2 );
     1965                }
     1966        | ENUM attribute_list_opt type_name
     1967                {
     1968                        typedefTable.makeTypedef( *$3->type->symbolic.name );
     1969                        $$ = DeclarationNode::newEnum( $3->type->symbolic.name, 0, false )->addQualifiers( $2 );
    19571970                }
    19581971        ;
Note: See TracChangeset for help on using the changeset viewer.