Changeset bf20567


Ignore:
Timestamp:
Feb 25, 2023, 11:01:28 AM (14 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
be00a2d
Parents:
b1ad41f
Message:

generate error for empty mutex argument list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rb1ad41f rbf20567  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Feb 24 14:46:55 2023
    13 // Update Count     : 5983
     12// Last Modified On : Sat Feb 25 09:52:06 2023
     13// Update Count     : 5986
    1414//
    1515
     
    11731173        comma_expression_opt ';'
    11741174                { $$ = new StatementNode( build_expr( $1 ) ); }
    1175         | MUTEX '(' ')' comma_expression ';'
    1176                 { $$ = new StatementNode( build_mutex( nullptr, new StatementNode( build_expr( $4 ) ) ) ); }
    11771175        ;
    11781176
     
    15841582        ;
    15851583
    1586 // If MUTEX becomes a general qualifier, there are shift/reduce conflicts, so change syntax to "with mutex".
     1584// If MUTEX becomes a general qualifier, there are shift/reduce conflicts, so possibly change syntax to "with mutex".
    15871585mutex_statement:
    1588         MUTEX '(' argument_expression_list ')' statement
    1589                 { $$ = new StatementNode( build_mutex( $3, $5 ) ); }
     1586        MUTEX '(' argument_expression_list_opt ')' statement
     1587                {
     1588                        if ( ! $3 ) { SemanticError( yylloc, "mutex argument list cannot be empty." ); $$ = nullptr; }
     1589                        $$ = new StatementNode( build_mutex( $3, $5 ) );
     1590                }
    15901591        ;
    15911592
Note: See TracChangeset for help on using the changeset viewer.