Changeset 473d1da0


Ignore:
Timestamp:
Jan 31, 2022, 6:59:08 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
0fba0d4
Parents:
c9c1c1c
git-author:
Peter A. Buhr <pabuhr@…> (01/31/22 18:57:10)
git-committer:
Peter A. Buhr <pabuhr@…> (01/31/22 18:59:08)
Message:

rename "if control" to "conditional control"

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    rc9c1c1c r473d1da0  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 14 17:28:53 2021
    13 // Update Count     : 900
     12// Last Modified On : Sat Jan 29 09:45:56 2022
     13// Update Count     : 901
    1414//
    1515
     
    390390Statement * build_expr( ExpressionNode * ctl );
    391391
    392 struct IfCtrl {
    393         IfCtrl( DeclarationNode * decl, ExpressionNode * condition ) :
     392struct CondCtl {
     393        CondCtl( DeclarationNode * decl, ExpressionNode * condition ) :
    394394                init( decl ? new StatementNode( decl ) : nullptr ), condition( condition ) {}
    395395
     
    409409};
    410410
    411 Expression * build_if_control( IfCtrl * ctl, std::list< Statement * > & init );
    412 Statement * build_if( IfCtrl * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
     411Expression * build_if_control( CondCtl * ctl, std::list< Statement * > & init );
     412Statement * build_if( CondCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
    413413Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt );
    414414Statement * build_case( ExpressionNode * ctl );
    415415Statement * build_default();
    416 Statement * build_while( IfCtrl * ctl, StatementNode * stmt );
     416Statement * build_while( CondCtl * ctl, StatementNode * stmt );
    417417Statement * build_do_while( ExpressionNode * ctl, StatementNode * stmt );
    418418Statement * build_for( ForCtrl * forctl, StatementNode * stmt );
  • src/Parser/StatementNode.cc

    rc9c1c1c r473d1da0  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct 24 04:20:55 2020
    13 // Update Count     : 383
     12// Last Modified On : Sat Jan 29 09:45:51 2022
     13// Update Count     : 384
    1414//
    1515
     
    7878} // build_expr
    7979
    80 Expression * build_if_control( IfCtrl * ctl, std::list< Statement * > & init ) {
     80Expression * build_if_control( CondCtl * ctl, std::list< Statement * > & init ) {
    8181        if ( ctl->init != 0 ) {
    8282                buildMoveList( ctl->init, init );
     
    100100} // build_if_control
    101101
    102 Statement * build_if( IfCtrl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ) {
     102Statement * build_if( CondCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ) {
    103103        Statement * thenb, * elseb = nullptr;
    104104        std::list< Statement * > branches;
     
    145145} // build_default
    146146
    147 Statement * build_while( IfCtrl * ctl, StatementNode * stmt ) {
     147Statement * build_while( CondCtl * ctl, StatementNode * stmt ) {
    148148        std::list< Statement * > branches;
    149149        buildMoveList< Statement, StatementNode >( stmt, branches );
  • src/Parser/parser.yy

    rc9c1c1c r473d1da0  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct 15 09:20:17 2021
    13 // Update Count     : 5163
     12// Last Modified On : Sun Jan 30 09:41:13 2022
     13// Update Count     : 5165
    1414//
    1515
     
    238238        WaitForStmt * wfs;
    239239        Expression * constant;
    240         IfCtrl * ifctl;
     240        CondCtl * ifctl;
    241241        ForCtrl * fctl;
    242242        enum OperKinds compop;
     
    327327%type<en> comma_expression                              comma_expression_opt
    328328%type<en> argument_expression_list_opt  argument_expression_list        argument_expression                     default_initializer_opt
    329 %type<ifctl> if_control_expression
     329%type<ifctl> conditional_declaration
    330330%type<fctl> for_control_expression              for_control_expression_list
    331331%type<compop> inclexcl
     
    11231123
    11241124if_statement:
    1125         IF '(' if_control_expression ')' statement                      %prec THEN
     1125        IF '(' conditional_declaration ')' statement            %prec THEN
    11261126                // explicitly deal with the shift/reduce conflict on if/else
    11271127                { $$ = new StatementNode( build_if( $3, maybe_build_compound( $5 ), nullptr ) ); }
    1128         | IF '(' if_control_expression ')' statement ELSE statement
     1128        | IF '(' conditional_declaration ')' statement ELSE statement
    11291129                { $$ = new StatementNode( build_if( $3, maybe_build_compound( $5 ), maybe_build_compound( $7 ) ) ); }
    11301130        ;
    11311131
    1132 if_control_expression:
     1132conditional_declaration:
    11331133        comma_expression
    1134                 { $$ = new IfCtrl( nullptr, $1 ); }
     1134                { $$ = new CondCtl( nullptr, $1 ); }
    11351135        | c_declaration                                                                         // no semi-colon
    1136                 { $$ = new IfCtrl( $1, nullptr ); }
     1136                { $$ = new CondCtl( $1, nullptr ); }
    11371137        | cfa_declaration                                                                       // no semi-colon
    1138                 { $$ = new IfCtrl( $1, nullptr ); }
     1138                { $$ = new CondCtl( $1, nullptr ); }
    11391139        | declaration comma_expression                                          // semi-colon separated
    1140                 { $$ = new IfCtrl( $1, $2 ); }
     1140                { $$ = new CondCtl( $1, $2 ); }
    11411141        ;
    11421142
     
    11931193iteration_statement:
    11941194        WHILE '(' ')' statement                                                         // CFA => while ( 1 )
    1195                 { $$ = new StatementNode( build_while( new IfCtrl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); }
    1196         | WHILE '(' if_control_expression ')' statement         %prec THEN
     1195                { $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); }
     1196        | WHILE '(' conditional_declaration ')' statement       %prec THEN
    11971197                { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ) ) ); }
    1198         | WHILE '(' if_control_expression ')' statement ELSE statement // CFA
     1198        | WHILE '(' conditional_declaration ')' statement ELSE statement // CFA
    11991199                { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; }
    12001200        | DO statement WHILE '(' ')' ';'                                        // CFA => do while( 1 )
Note: See TracChangeset for help on using the changeset viewer.