Browse Source

Bug fix (for loops) in parser.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@675 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 18 years ago
parent
commit
81a951c643
  1. 8
      prism/src/parser/PrismParser.java
  2. 6
      prism/src/parser/PrismParser.jj

8
prism/src/parser/PrismParser.java

@ -2560,15 +2560,15 @@ public class PrismParser implements PrismParserConstants {
// For loop // For loop
static final public ForLoop ForLoop() throws ParseException { static final public ForLoop ForLoop() throws ParseException {
String s; String s;
Expression to = null, from = null, step = null;
Expression from = null, to = null, step = null;
ForLoop fl = new ForLoop(); ForLoop fl = new ForLoop();
Token begin; Token begin;
begin = getToken(1); begin = getToken(1);
s = Identifier(); s = Identifier();
jj_consume_token(EQ); jj_consume_token(EQ);
to = Expression();
jj_consume_token(COLON);
from = Expression(); from = Expression();
jj_consume_token(COLON);
to = Expression();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COLON: case COLON:
jj_consume_token(COLON); jj_consume_token(COLON);
@ -2580,8 +2580,8 @@ public class PrismParser implements PrismParserConstants {
} }
jj_consume_token(0); jj_consume_token(0);
fl.setLHS(s); fl.setLHS(s);
fl.setTo(to);
fl.setFrom(from); fl.setFrom(from);
fl.setTo(to);
if (step != null) fl.setStep(step); if (step != null) fl.setStep(step);
fl.setPosition(begin, getToken(0)); fl.setPosition(begin, getToken(0));
{if (true) return fl;} {if (true) return fl;}

6
prism/src/parser/PrismParser.jj

@ -1582,16 +1582,16 @@ int LtGt() :
ForLoop ForLoop() : ForLoop ForLoop() :
{ {
String s; String s;
Expression to = null, from = null, step = null;
Expression from = null, to = null, step = null;
ForLoop fl = new ForLoop(); ForLoop fl = new ForLoop();
Token begin; Token begin;
} }
{ {
( { begin = getToken(1); } s=Identifier() <EQ> to = Expression() <COLON> from = Expression() ( <COLON> step = Expression() )? <EOF> )
( { begin = getToken(1); } s=Identifier() <EQ> from = Expression() <COLON> to = Expression() ( <COLON> step = Expression() )? <EOF> )
{ {
fl.setLHS(s); fl.setLHS(s);
fl.setTo(to);
fl.setFrom(from); fl.setFrom(from);
fl.setTo(to);
if (step != null) fl.setStep(step); if (step != null) fl.setStep(step);
fl.setPosition(begin, getToken(0)); fl.setPosition(begin, getToken(0));
return fl; return fl;

Loading…
Cancel
Save