Ignore:
Timestamp:
May 29, 2023, 11:44:29 AM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT
Children:
fa2c005
Parents:
3a513d89 (diff), 2b78949 (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 ADT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r3a513d89 r044ae62  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Apr  4 14:02:00 2023
    13 // Update Count     : 6329
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Apr 26 16:45:37 2023
     13// Update Count     : 6330
    1414//
    1515
     
    307307        ClauseNode * clause;
    308308        ast::WaitForStmt * wfs;
     309    ast::WaitUntilStmt::ClauseNode * wucn;
    309310        CondCtl * ifctl;
    310311        ForCtrl * forctl;
     
    427428%type<expr> when_clause                                 when_clause_opt                         waitfor         waituntil               timeout
    428429%type<stmt> waitfor_statement                           waituntil_statement
    429 %type<wfs> wor_waitfor_clause                   waituntil_clause                        wand_waituntil_clause   wor_waituntil_clause
     430%type<wfs> wor_waitfor_clause
     431%type<wucn> waituntil_clause                    wand_waituntil_clause       wor_waituntil_clause
    430432
    431433// declarations
     
    16821684
    16831685waituntil:
    1684         WAITUNTIL '(' cast_expression ')'
     1686        WAITUNTIL '(' comma_expression ')'
    16851687                { $$ = $3; }
    16861688        ;
     
    16881690waituntil_clause:
    16891691        when_clause_opt waituntil statement
    1690                 { printf( "waituntil_clause 1\n" ); $$ = nullptr; }
     1692                { $$ = build_waituntil_clause( yylloc, $1, $2, maybe_build_compound( yylloc, $3 ) ); }
    16911693        | '(' wor_waituntil_clause ')'
    1692                 { printf( "waituntil_clause 2\n" ); $$ = nullptr; }
     1694                { $$ = $2; }
    16931695        ;
    16941696
    16951697wand_waituntil_clause:
    16961698        waituntil_clause                                                                        %prec THEN
    1697                 { printf( "wand_waituntil_clause 1\n" ); $$ = nullptr; }
     1699                { $$ = $1; }
    16981700        | waituntil_clause wand wand_waituntil_clause
    1699                 { printf( "wand_waituntil_clause 2\n" ); $$ = nullptr; }
     1701                { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::AND, $1, $3 ); }
    17001702        ;
    17011703
    17021704wor_waituntil_clause:
    17031705        wand_waituntil_clause
    1704                 { printf( "wor_waituntil_clause 1\n" ); $$ = nullptr; }
     1706                { $$ = $1; }
    17051707        | wor_waituntil_clause wor wand_waituntil_clause
    1706                 { printf( "wor_waituntil_clause 2\n" ); $$ = nullptr; }
     1708                { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::OR, $1, $3 ); }
    17071709        | wor_waituntil_clause wor when_clause_opt ELSE statement
    1708                 { printf( "wor_waituntil_clause 3\n" ); $$ = nullptr; }
     1710                { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1, build_waituntil_else( yylloc, $3, maybe_build_compound( yylloc, $5 ) ) ); }
    17091711        | wor_waituntil_clause wor when_clause_opt timeout statement    %prec THEN
    1710                 { printf( "wor_waituntil_clause 4\n" ); $$ = nullptr; }
     1712                { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1, build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ) ); }
    17111713        // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
    17121714        | wor_waituntil_clause wor when_clause_opt timeout statement wor ELSE statement // syntax error
    17131715                { SemanticError( yylloc, "else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; }
    17141716        | wor_waituntil_clause wor when_clause_opt timeout statement wor when_clause ELSE statement
    1715                 { printf( "wor_waituntil_clause 6\n" ); $$ = nullptr; }
     1717                { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1,
     1718                new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::OR,
     1719                    build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ),
     1720                    build_waituntil_else( yylloc, $7, maybe_build_compound( yylloc, $9 ) ) ) ); }
    17161721        ;
    17171722
     
    17191724        wor_waituntil_clause                                                            %prec THEN
    17201725                // SKULLDUGGERY: create an empty compound statement to test parsing of waituntil statement.
    1721                 { $$ = new StatementNode( build_compound( yylloc, nullptr ) ); }
     1726                {
     1727            $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) );
     1728            // $$ = new StatementNode( build_compound( yylloc, nullptr ) );
     1729        }
    17221730        ;
    17231731
Note: See TracChangeset for help on using the changeset viewer.