|
43 | 43 | */ |
44 | 44 |
|
45 | 45 | #include "form3.h" |
| 46 | +#include "comtool.h" |
46 | 47 |
|
47 | 48 | /* |
48 | 49 | com1commands are the commands of which only part of the word has to |
@@ -617,8 +618,28 @@ int CompileStatement(UBYTE *in) |
617 | 618 | } |
618 | 619 | else if ( k->type == MIXED2 ) {} |
619 | 620 | else if ( k->type > AC.compiletype ) { |
620 | | - if ( StrCmp((UBYTE *)(k->name),(UBYTE *)"format") != 0 ) |
621 | | - AC.compiletype = k->type; |
| 621 | + /* |
| 622 | + * We intentionally do NOT update "compiletype" for: |
| 623 | + * - Format statements (type = TOOUTPUT) |
| 624 | + * - ModuleOption statements (type = ATENDOFMODULE) |
| 625 | + * with sum/maximum/minimum/local (i.e., $-variable-related options) |
| 626 | + * |
| 627 | + * This relaxes the ordering constraint, allowing statements with |
| 628 | + * type >= the current "compiletype" to follow. |
| 629 | + */ |
| 630 | + if ( StrCmp((UBYTE *)(k->name),(UBYTE *)"format") == 0 ) |
| 631 | + goto NoUpdateCompileType; |
| 632 | + if ( StrCmp((UBYTE *)(k->name),(UBYTE *)"moduleoption") == 0 ) { |
| 633 | + UBYTE *ss = s; |
| 634 | + SkipSpaces(&ss); |
| 635 | + if ( ConsumeOption(&ss,"sum") |
| 636 | + || ConsumeOption(&ss,"maximum") |
| 637 | + || ConsumeOption(&ss,"minimum") |
| 638 | + || ConsumeOption(&ss,"local") ) goto NoUpdateCompileType; |
| 639 | + } |
| 640 | + AC.compiletype = k->type; |
| 641 | +NoUpdateCompileType: |
| 642 | + ; |
622 | 643 | } |
623 | 644 | else if ( k->type < AC.compiletype ) { |
624 | 645 | switch ( k->type ) { |
|
0 commit comments