Changeset 2d2df9f


Ignore:
Timestamp:
Feb 20, 2019, 10:02:08 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, persistent-indexer
Children:
1b54b54
Parents:
96df1329
Message:

add default (empty) fields to for control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r96df1329 r2d2df9f  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 14 22:23:13 2019
    13 // Update Count     : 4217
     12// Last Modified On : Wed Feb 20 17:53:55 2019
     13// Update Count     : 4231
    1414//
    1515
     
    191191        return new ForCtrl(
    192192                distAttr( DeclarationNode::newTypeof( type, true ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
    193                 new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ),
    194                 new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
    195                                                                                           OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) );
     193                // NULL comp/inc => leave blank
     194                comp ? new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ) : 0,
     195                inc ? new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
     196                                                        OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) : 0 );
    196197} // forCtrl
    197198
     
    11681169        | comma_expression ';' comma_expression inclexcl comma_expression '~' comma_expression // CFA
    11691170                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, $7 ); }
     1171        | comma_expression ';' comma_expression '~' '@' '~' comma_expression // CFA
     1172                { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, $7 ); }
     1173        | comma_expression ';' comma_expression '~' '@' '~' '@' // CFA
     1174                { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, nullptr ); }
    11701175        ;
    11711176
Note: See TracChangeset for help on using the changeset viewer.