From 81a951c6434b438d44423a9796e5ce47920c07b4 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Mon, 17 Mar 2008 14:11:21 +0000 Subject: [PATCH] Bug fix (for loops) in parser. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@675 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/parser/PrismParser.java | 8 ++++---- prism/src/parser/PrismParser.jj | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/prism/src/parser/PrismParser.java b/prism/src/parser/PrismParser.java index 04affea0..70a58c97 100644 --- a/prism/src/parser/PrismParser.java +++ b/prism/src/parser/PrismParser.java @@ -2560,15 +2560,15 @@ public class PrismParser implements PrismParserConstants { // For loop static final public ForLoop ForLoop() throws ParseException { String s; - Expression to = null, from = null, step = null; + Expression from = null, to = null, step = null; ForLoop fl = new ForLoop(); Token begin; begin = getToken(1); s = Identifier(); jj_consume_token(EQ); - to = Expression(); - jj_consume_token(COLON); from = Expression(); + jj_consume_token(COLON); + to = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COLON: jj_consume_token(COLON); @@ -2580,8 +2580,8 @@ public class PrismParser implements PrismParserConstants { } jj_consume_token(0); fl.setLHS(s); - fl.setTo(to); fl.setFrom(from); + fl.setTo(to); if (step != null) fl.setStep(step); fl.setPosition(begin, getToken(0)); {if (true) return fl;} diff --git a/prism/src/parser/PrismParser.jj b/prism/src/parser/PrismParser.jj index 96907b3f..be2611a7 100644 --- a/prism/src/parser/PrismParser.jj +++ b/prism/src/parser/PrismParser.jj @@ -1582,16 +1582,16 @@ int LtGt() : ForLoop ForLoop() : { String s; - Expression to = null, from = null, step = null; + Expression from = null, to = null, step = null; ForLoop fl = new ForLoop(); Token begin; } { - ( { begin = getToken(1); } s=Identifier() to = Expression() from = Expression() ( step = Expression() )? ) + ( { begin = getToken(1); } s=Identifier() from = Expression() to = Expression() ( step = Expression() )? ) { fl.setLHS(s); - fl.setTo(to); fl.setFrom(from); + fl.setTo(to); if (step != null) fl.setStep(step); fl.setPosition(begin, getToken(0)); return fl;