@@ -9431,89 +9431,107 @@ statement2nc:
9431
9431
| DIM dim_definitions
9432
9432
| FILL fill_definitions
9433
9433
| const_instruction STRING Identifier OP_ASSIGN const_expr_string_const {
9434
- Constant * c1 = constant_find ( ((Environment *)_environment)->constants , $5 );
9435
-
9436
- Constant * c3 = malloc ( sizeof ( Constant ) );
9437
- memset ( c3, 0 , sizeof ( Constant ) );
9438
- c3->name = strdup ( $3 );
9439
- c3->realName = strdup ( $3 );
9440
-
9441
- c3->valueString = malloc ( sizeof ( StaticString ) );
9442
- memset ( c3->valueString , 0 , sizeof ( StaticString ) );
9443
-
9444
- c3->valueString ->id = UNIQUE_ID;
9445
- c3->valueString ->value = malloc ( c1->valueString ->size );
9446
- memcpy ( c3->valueString ->value , c1->valueString ->value , c1->valueString ->size );
9447
- c3->valueString ->size = c1->valueString ->size ;
9448
- c3->valueString ->next = ((Environment *)_environment)->strings ;
9449
- ((Environment *)_environment)->strings = c3->valueString ;
9450
-
9451
- c3->type = CT_STRING;
9452
- Constant * constLast = ((Environment *)_environment)->constants ;
9453
- if ( constLast ) {
9454
- while ( constLast->next ) {
9455
- constLast = constLast->next ;
9434
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9435
+ Constant * c1 = constant_find ( ((Environment *)_environment)->constants , $5 );
9436
+
9437
+ Constant * c3 = malloc ( sizeof ( Constant ) );
9438
+ memset ( c3, 0 , sizeof ( Constant ) );
9439
+ c3->name = strdup ( $3 );
9440
+ c3->realName = strdup ( $3 );
9441
+
9442
+ c3->valueString = malloc ( sizeof ( StaticString ) );
9443
+ memset ( c3->valueString , 0 , sizeof ( StaticString ) );
9444
+
9445
+ c3->valueString ->id = UNIQUE_ID;
9446
+ c3->valueString ->value = malloc ( c1->valueString ->size );
9447
+ memcpy ( c3->valueString ->value , c1->valueString ->value , c1->valueString ->size );
9448
+ c3->valueString ->size = c1->valueString ->size ;
9449
+ c3->valueString ->next = ((Environment *)_environment)->strings ;
9450
+ ((Environment *)_environment)->strings = c3->valueString ;
9451
+
9452
+ c3->type = CT_STRING;
9453
+ Constant * constLast = ((Environment *)_environment)->constants ;
9454
+ if ( constLast ) {
9455
+ while ( constLast->next ) {
9456
+ constLast = constLast->next ;
9457
+ }
9458
+ constLast->next = c3;
9459
+ } else {
9460
+ ((Environment *)_environment)->constants = c3;
9456
9461
}
9457
- constLast->next = c3;
9458
- } else {
9459
- ((Environment *)_environment)->constants = c3;
9460
- }
9461
9462
9462
- // const_emit( _environment, c1->name );
9463
+ // const_emit( _environment, c1->name );
9464
+ }
9463
9465
}
9464
9466
| const_instruction Identifier OP_ASSIGN const_expr_string {
9465
- const_define_string ( _environment, $2 , $4 );
9467
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9468
+ const_define_string ( _environment, $2 , $4 );
9469
+ }
9466
9470
}
9467
9471
| const_instruction Identifier OP_ASSIGN const_expr {
9468
- const_define_numeric ( _environment, $2 , $4 );
9472
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9473
+ const_define_numeric ( _environment, $2 , $4 );
9474
+ }
9469
9475
}
9470
9476
| const_instruction POSITIVE Identifier OP_ASSIGN const_expr {
9471
- if ( $5 < 0 ) {
9472
- CRITICAL_NEGATIVE_CONSTANT ( $3 , $5 );
9477
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9478
+ if ( $5 < 0 ) {
9479
+ CRITICAL_NEGATIVE_CONSTANT ( $3 , $5 );
9480
+ }
9481
+ const_define_numeric ( _environment, $3 , $5 );
9473
9482
}
9474
- const_define_numeric ( _environment, $3 , $5 );
9475
9483
}
9476
9484
| POSITIVE const_instruction Identifier OP_ASSIGN const_expr {
9477
- if ( $5 < 0 ) {
9478
- CRITICAL_NEGATIVE_CONSTANT ( $3 , $5 );
9485
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9486
+ if ( $5 < 0 ) {
9487
+ CRITICAL_NEGATIVE_CONSTANT ( $3 , $5 );
9488
+ }
9489
+ const_define_numeric ( _environment, $3 , $5 );
9479
9490
}
9480
- const_define_numeric ( _environment, $3 , $5 );
9481
9491
}
9482
9492
| const_instruction Identifier IN OP const_expr OP_COMMA const_expr CP OP_ASSIGN const_expr {
9483
- if ( $10 < $5 ) {
9484
- CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9485
- }
9486
- if ( $10 > $7 ) {
9487
- CRITICAL_TOO_BIG_CONSTANT ( $2 );
9493
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9494
+ if ( $10 < $5 ) {
9495
+ CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9496
+ }
9497
+ if ( $10 > $7 ) {
9498
+ CRITICAL_TOO_BIG_CONSTANT ( $2 );
9499
+ }
9500
+ const_define_numeric ( _environment, $2 , $10 );
9488
9501
}
9489
- const_define_numeric ( _environment, $2 , $10 );
9490
9502
}
9491
9503
| const_instruction Identifier IN OSP const_expr OP_COMMA const_expr CP OP_ASSIGN const_expr {
9492
- if ( $10 <= $5 ) {
9493
- CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9494
- }
9495
- if ( $10 > $7 ) {
9496
- CRITICAL_TOO_BIG_CONSTANT ( $2 );
9504
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9505
+ if ( $10 <= $5 ) {
9506
+ CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9507
+ }
9508
+ if ( $10 > $7 ) {
9509
+ CRITICAL_TOO_BIG_CONSTANT ( $2 );
9510
+ }
9511
+ const_define_numeric ( _environment, $2 , $10 );
9497
9512
}
9498
- const_define_numeric ( _environment, $2 , $10 );
9499
9513
}
9500
9514
| const_instruction Identifier IN OP const_expr OP_COMMA const_expr CSP OP_ASSIGN const_expr {
9501
- if ( $10 < $5 ) {
9502
- CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9503
- }
9504
- if ( $10 >= $7 ) {
9505
- CRITICAL_TOO_BIG_CONSTANT ( $2 );
9515
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9516
+ if ( $10 < $5 ) {
9517
+ CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9518
+ }
9519
+ if ( $10 >= $7 ) {
9520
+ CRITICAL_TOO_BIG_CONSTANT ( $2 );
9521
+ }
9522
+ const_define_numeric ( _environment, $2 , $10 );
9506
9523
}
9507
- const_define_numeric ( _environment, $2 , $10 );
9508
9524
}
9509
9525
| const_instruction Identifier IN OSP const_expr OP_COMMA const_expr CSP OP_ASSIGN const_expr {
9510
- if ( $10 <= $5 ) {
9511
- CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9512
- }
9513
- if ( $10 >= $7 ) {
9514
- CRITICAL_TOO_BIG_CONSTANT ( $2 );
9526
+ if ( !((Environment *)_environment)->emptyProcedure ) {
9527
+ if ( $10 <= $5 ) {
9528
+ CRITICAL_TOO_LITTLE_CONSTANT ( $2 );
9529
+ }
9530
+ if ( $10 >= $7 ) {
9531
+ CRITICAL_TOO_BIG_CONSTANT ( $2 );
9532
+ }
9533
+ const_define_numeric ( _environment, $2 , $10 );
9515
9534
}
9516
- const_define_numeric ( _environment, $2 , $10 );
9517
9535
}
9518
9536
| TI OP_ASSIGN expr {
9519
9537
set_timer ( _environment, $3 );
0 commit comments