Ignore:
Timestamp:
May 11, 2020, 1:53:29 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
504a7dc
Parents:
b7d6a36 (diff), a7b486b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into relaxed_ready

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rb7d6a36 r6a490b2  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Feb 16 08:22:14 2020
    13 // Update Count     : 4461
     12// Last Modified On : Mon Apr 27 12:25:42 2020
     13// Update Count     : 4483
    1414//
    1515
     
    278278%token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
    279279%token SIZEOF OFFSETOF
    280 // %token SUSPEND RESUME                                                                        // CFA
     280// %token RESUME                                                                        // CFA
     281%token SUSPEND                                                                  // CFA
    281282%token ATTRIBUTE EXTENSION                                                              // GCC
    282283%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
     
    918919        conditional_expression
    919920        | unary_expression assignment_operator assignment_expression
    920                 { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
     921                {
     922                        if ( $2 == OperKinds::AtAssn ) {
     923                                SemanticError( yylloc, "C @= assignment is currently unimplemented." ); $$ = nullptr;
     924                        } else {
     925                                $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) );
     926                        } // if
     927                }
    921928        | unary_expression '=' '{' initializer_list_opt comma_opt '}'
    922929                { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; }
     
    959966
    960967tuple_expression_list:
    961         assignment_expression_opt
    962         | tuple_expression_list ',' assignment_expression_opt
     968        assignment_expression
     969        | '@'                                                                                           // CFA
     970                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
     971        | tuple_expression_list ',' assignment_expression
    963972                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     973        | tuple_expression_list ',' '@'
     974                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
    964975        ;
    965976
     
    12591270        | RETURN '{' initializer_list_opt comma_opt '}' ';'
    12601271                { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; }
    1261         // | SUSPEND ';'
    1262         //      { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
    1263         // | SUSPEND compound_statement ';'
    1264         //      { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1272        | SUSPEND ';'
     1273                { $$ = new StatementNode( build_suspend( nullptr ) ); }
     1274        | SUSPEND compound_statement
     1275                { $$ = new StatementNode( build_suspend( $2 ) ); }
     1276        | SUSPEND COROUTINE ';'
     1277                { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Coroutine ) ); }
     1278        | SUSPEND COROUTINE compound_statement
     1279                { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Coroutine ) ); }
     1280        | SUSPEND GENERATOR ';'
     1281                { $$ = new StatementNode( build_suspend( nullptr, SuspendStmt::Generator ) ); }
     1282        | SUSPEND GENERATOR compound_statement
     1283                { $$ = new StatementNode( build_suspend( $3, SuspendStmt::Generator ) ); }
    12651284        | THROW assignment_expression_opt ';'                           // handles rethrow
    12661285                { $$ = new StatementNode( build_throw( $2 ) ); }
     
    15891608                // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be
    15901609                // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name.
    1591         cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
     1610        cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' attribute_list_opt
    15921611                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    1593                 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
    1594         | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
    1595                 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
     1612                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 )->addQualifiers( $8 ); }
     1613        | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' attribute_list_opt
     1614                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 )->addQualifiers( $8 ); }
    15961615        ;
    15971616
     
    20772096aggregate_control:                                                                              // CFA
    20782097        GENERATOR
    2079                 { yyy = true; $$ = AggregateDecl::Coroutine; }
     2098                { yyy = true; $$ = AggregateDecl::Generator; }
     2099        | MONITOR GENERATOR
     2100                { SemanticError( yylloc, "monitor generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
    20802101        | COROUTINE
    20812102                { yyy = true; $$ = AggregateDecl::Coroutine; }
    20822103        | MONITOR
    20832104                { yyy = true; $$ = AggregateDecl::Monitor; }
     2105        | MONITOR COROUTINE
     2106                { SemanticError( yylloc, "monitor coroutine is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
    20842107        | THREAD
    20852108                { yyy = true; $$ = AggregateDecl::Thread; }
     2109        | MONITOR THREAD
     2110                { SemanticError( yylloc, "monitor thread is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
    20862111        ;
    20872112
Note: See TracChangeset for help on using the changeset viewer.