Ignore:
Timestamp:
Aug 11, 2020, 4:40:15 PM (4 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:
0d070ca
Parents:
07d867b (diff), 129674b (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 new-ast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r07d867b r22f94a4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 27 12:25:42 2020
    13 // Update Count     : 4483
     12// Last Modified On : Thu May 28 12:11:45 2020
     13// Update Count     : 4500
    1414//
    1515
     
    329329%type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
    330330%type<en> comma_expression                              comma_expression_opt
    331 %type<en> argument_expression_list              argument_expression                     default_initialize_opt
     331%type<en> argument_expression_list_opt          argument_expression                     default_initialize_opt
    332332%type<ifctl> if_control_expression
    333333%type<fctl> for_control_expression              for_control_expression_list
     
    624624                // equivalent to the old x[i,j].
    625625                { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, $3 ) ); }
    626         | postfix_expression '{' argument_expression_list '}' // CFA, constructor call
     626        | postfix_expression '{' argument_expression_list_opt '}' // CFA, constructor call
    627627                {
    628628                        Token fn;
     
    630630                        $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
    631631                }
    632         | postfix_expression '(' argument_expression_list ')'
     632        | postfix_expression '(' argument_expression_list_opt ')'
    633633                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
    634634        | postfix_expression '`' identifier                                     // CFA, postfix call
     
    662662        | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal
    663663                { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    664         | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call
     664        | '^' primary_expression '{' argument_expression_list_opt '}' // CFA, destructor call
    665665                {
    666666                        Token fn;
     
    670670        ;
    671671
    672 argument_expression_list:
     672argument_expression_list_opt:
    673673        // empty
    674674                { $$ = nullptr; }
    675675        | argument_expression
    676         | argument_expression_list ',' argument_expression
     676        | argument_expression_list_opt ',' argument_expression
    677677                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    678678        ;
     
    11961196                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11971197                                                OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1198         | '=' comma_expression                                                                  // CFA
     1198        | '=' comma_expression                                                          // CFA
    11991199                { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    12001200                                                OperKinds::LEThan, $2->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     
    12031203        | comma_expression inclexcl comma_expression '~' comma_expression // CFA
    12041204                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); }
     1205        | comma_expression ';'                                                          // CFA
     1206                { $$ = forCtrl( new ExpressionNode( build_constantInteger( *new string( "0u" ) ) ), $1, nullptr, OperKinds::LThan, nullptr, nullptr ); }
    12051207        | comma_expression ';' comma_expression                         // CFA
    12061208                { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    12071209                                                OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1208         | comma_expression ';' '=' comma_expression                             // CFA
     1210        | comma_expression ';' '=' comma_expression                     // CFA
    12091211                { $$ = forCtrl( $4, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    12101212                                                OperKinds::LEThan, $4->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     
    13041306// If MUTEX becomes a general qualifier, there are shift/reduce conflicts, so change syntax to "with mutex".
    13051307mutex_statement:
    1306         MUTEX '(' argument_expression_list ')' statement
     1308        MUTEX '(' argument_expression_list_opt ')' statement
    13071309                { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; }
    13081310        ;
     
    13211323        WAITFOR '(' cast_expression ')'
    13221324                { $$ = $3; }
    1323 //      | WAITFOR '(' cast_expression ',' argument_expression_list ')'
     1325//      | WAITFOR '(' cast_expression ',' argument_expression_list_opt ')'
    13241326//              { $$ = (ExpressionNode *)$3->set_last( $5 ); }
    1325         | WAITFOR '(' cast_expression_list ':' argument_expression_list ')'
     1327        | WAITFOR '(' cast_expression_list ':' argument_expression_list_opt ')'
    13261328                { $$ = (ExpressionNode *)($3->set_last( $5 )); }
    13271329        ;
     
    13301332        cast_expression
    13311333        | cast_expression_list ',' cast_expression
    1332                 { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     1334                // { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     1335                { SemanticError( yylloc, "List of mutex member is currently unimplemented." ); $$ = nullptr; }
    13331336        ;
    13341337
     
    20952098
    20962099aggregate_control:                                                                              // CFA
    2097         GENERATOR
     2100        MONITOR
     2101                { yyy = true; $$ = AggregateDecl::Monitor; }
     2102        | MUTEX STRUCT
     2103                { yyy = true; $$ = AggregateDecl::Monitor; }
     2104        | GENERATOR
    20982105                { yyy = true; $$ = AggregateDecl::Generator; }
    2099         | MONITOR GENERATOR
     2106        | MUTEX GENERATOR
    21002107                { SemanticError( yylloc, "monitor generator is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
    21012108        | COROUTINE
    21022109                { yyy = true; $$ = AggregateDecl::Coroutine; }
    2103         | MONITOR
    2104                 { yyy = true; $$ = AggregateDecl::Monitor; }
    2105         | MONITOR COROUTINE
     2110        | MUTEX COROUTINE
    21062111                { SemanticError( yylloc, "monitor coroutine is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
    21072112        | THREAD
    21082113                { yyy = true; $$ = AggregateDecl::Thread; }
    2109         | MONITOR THREAD
     2114        | MUTEX THREAD
    21102115                { SemanticError( yylloc, "monitor thread is currently unimplemented." ); $$ = AggregateDecl::NoAggregate; }
    21112116        ;
     
    27742779        | attr_name
    27752780                { $$ = DeclarationNode::newAttribute( $1 ); }
    2776         | attr_name '(' argument_expression_list ')'
     2781        | attr_name '(' argument_expression_list_opt ')'
    27772782                { $$ = DeclarationNode::newAttribute( $1, $3 ); }
    27782783        ;
Note: See TracChangeset for help on using the changeset viewer.