loop10.gms : Test relaxed punctuation for control structures

Description

In the past there was an error leading to embedded code blocks being
inserted inside previous control structures if the optional ';' at
the end of those was not set.

Contributor: Lutz Westermann, March 2020


Small Model of Type : GAMS


Category : GAMS Test library


Main file : loop10.gms

$Title Test relaxed punctuation for control structures (loop10,SEQ=819)

$ontext
In the past there was an error leading to embedded code blocks being
inserted inside previous control structures if the optional ';' at
the end of those was not set.

Contributor: Lutz Westermann, March 2020
$offtext


$log --- Using Python library %sysEnv.GMSPYTHONLIB%


Scalar i    Count number of EC calls / 0 /
       j;
Set    lSet Loop set             / l1*l3 /;

* Test 'if' w/o ending ';'
if(0,)
embeddedCode Python:
   i = list(gams.get("i"))
   i[0] += 1
   gams.set("i", i)
endembeddedCode i
abort$(i<>1) 'Expecting i=1',i;


* Test 'loop' w/o ending ';'
loop(lSet, )
embeddedCode Python:
   i = list(gams.get("i"))
   i[0] += 1
   gams.set("i", i)
endembeddedCode i
abort$(i<>2) 'Expecting i=2',i;


* Test 'while' w/o ending ';'
while(0, )
embeddedCode Python:
   i = list(gams.get("i"))
   i[0] += 1
   gams.set("i", i)
endembeddedCode i
abort$(i<>3) 'Expecting i=3',i;


* Test 'for' w/o ending ';'
for(j=1 to 0, )
embeddedCode Python:
   i = list(gams.get("i"))
   i[0] += 1
   gams.set("i", i)
endembeddedCode i
abort$(i<>4) 'Expecting i=4',i;

* Test 'repeat' w/o ending ';'
j=0;
repeat( j=j+1;
  until j>3   )
embeddedCode Python:
   i = list(gams.get("i"))
   i[0] += 1
   gams.set("i", i)
endembeddedCode i
abort$(i<>5) 'Expecting i=5',i;