Changeset 553772b


Ignore:
Timestamp:
May 16, 2019, 9:43:49 AM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7a54d67
Parents:
3c5dee4
Message:

add new type constructor "generator" with temporary coroutine semantics

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    r3c5dee4 r553772b  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Mar 13 14:54:30 2019
    13  * Update Count     : 707
     12 * Last Modified On : Wed May 15 21:25:27 2019
     13 * Update Count     : 708
    1414 */
    1515
     
    265265fortran                 { KEYWORD_RETURN(FORTRAN); }
    266266ftype                   { KEYWORD_RETURN(FTYPE); }                              // CFA
     267generator               { KEYWORD_RETURN(GENERATOR); }                  // CFA
    267268_Generic                { KEYWORD_RETURN(GENERIC); }                    // C11
    268269goto                    { KEYWORD_RETURN(GOTO); }
  • src/Parser/parser.yy

    r3c5dee4 r553772b  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 15 15:02:56 2019
    13 // Update Count     : 4290
     12// Last Modified On : Wed May 15 21:25:27 2019
     13// Update Count     : 4296
    1414//
    1515
     
    173173DeclarationNode * fieldDecl( DeclarationNode * typeSpec, DeclarationNode * fieldList ) {
    174174        if ( ! fieldList ) {                                                            // field declarator ?
    175                 if ( ! ( typeSpec->type && typeSpec->type->kind == TypeData::Aggregate ) ) {
     175                if ( ! ( typeSpec->type && (typeSpec->type->kind == TypeData::Aggregate || typeSpec->type->kind == TypeData::Enum) ) ) {
    176176                        stringstream ss;
    177177                        typeSpec->type->print( ss );
     
    275275%token ENUM STRUCT UNION
    276276%token EXCEPTION                                                                                // CFA
    277 %token COROUTINE MONITOR THREAD                                                 // CFA
     277%token GENERATOR COROUTINE MONITOR THREAD                               // CFA
    278278%token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
    279279%token SIZEOF OFFSETOF
     
    677677        // empty
    678678                { $$ = nullptr; }
    679         | '?'                                                                                           // CFA, default parameter
     679        | '@'                                                                                           // CFA, default parameter
    680680                { SemanticError( yylloc, "Default parameter for argument is currently unimplemented." ); $$ = nullptr; }
    681681                // { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); }
     
    796796                { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    797797                // keyword cast cannot be grouped because of reduction in aggregate_key
     798        | '(' GENERATOR '&' ')' cast_expression                         // CFA
     799                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); }
    798800        | '(' COROUTINE '&' ')' cast_expression                         // CFA
    799801                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); }
     
    20612063        | EXCEPTION
    20622064                { yyy = true; $$ = DeclarationNode::Exception; }
     2065        | GENERATOR
     2066                { yyy = true; $$ = DeclarationNode::Coroutine; }
    20632067        | COROUTINE
    20642068                { yyy = true; $$ = DeclarationNode::Coroutine; }
Note: See TracChangeset for help on using the changeset viewer.