diff --git a/build.xml b/build.xml index 1b9f981..0984573 100644 --- a/build.xml +++ b/build.xml @@ -1,5 +1,5 @@ - + @@ -29,7 +29,7 @@ includeantruntime="false" classpathref="classpath" debuglevel="lines,vars,source" - release="8" + release="11" > diff --git a/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java b/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java index 45418fc..f8c9dcd 100644 --- a/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java +++ b/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java @@ -31,10 +31,12 @@ public IteratingNode(ASTNode parent, TokenList tokens) throws ASTParseException int preCount = 0; int postCount = 0; boolean pre = true; + boolean in = false; for (int i=0; i buf = new ArrayList(); - for (int i=0; i buf = new ArrayList(); + for (int i=0; i0) { - iterTokens[postIdx++] = new TokenList(buf, tokens.getLine()); + + if (buf.size()>0) { + iterTokens[postIdx++] = new TokenList(buf, tokens.getLine()); + } + } else { + // no 'IN' so we must be a for-while loop + iterTokens = new TokenList[1]; + iterTokens[0] = tokens; + varName = null; + } } @@ -124,42 +133,60 @@ public ASTNode exec(ExecContext context) throws ASTExecException { throw new ASTExecException("Missing done for for-loop", tokens); } - List> iterVals = new ArrayList>(); - - for (int i=0; i> iterVals = new ArrayList>(); + + for (int i=0; i evaluating: "+iterTokens[0]+" <== " + val + " | "+this); + if (!val.toBoolean()) { + return next; + } + ExecContext nested = new ExecContext(context); + ASTNode currentNode = headNode; + while (currentNode != null) { + currentNode = currentNode.exec(nested); + } } - } + } public void done() { diff --git a/src/java/io/compgen/cgpipe/runner/BatchQTemplateRunner.java b/src/java/io/compgen/cgpipe/runner/BatchQTemplateRunner.java index 64a1372..d075291 100644 --- a/src/java/io/compgen/cgpipe/runner/BatchQTemplateRunner.java +++ b/src/java/io/compgen/cgpipe/runner/BatchQTemplateRunner.java @@ -68,7 +68,8 @@ public boolean isJobIdValid(String jobId) throws RunnerException { if (spl[1].equals("QUEUED") || spl[1].equals("WAITING") || spl[1].equals("RUNNING") || - spl[1].equals("USERHOLD") ) { + spl[1].equals("USERHOLD") || + spl[1].equals("PROXYQUEUED") ) { return true; } } diff --git a/src/test-scripts/while.mvpt b/src/test-scripts/while.mvpt new file mode 100644 index 0000000..4d209db --- /dev/null +++ b/src/test-scripts/while.mvpt @@ -0,0 +1,17 @@ +i=1 +for i < 10 + print i + i = i + 1 +done + +val = true +for val +print "here" +val = false +done + +val = false +for val +print "nope" +done + diff --git a/src/test-scripts/while.mvpt.good b/src/test-scripts/while.mvpt.good new file mode 100644 index 0000000..0719398 --- /dev/null +++ b/src/test-scripts/while.mvpt.good @@ -0,0 +1,9 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9