From 489e69197661d1a50ad62f89fad26bc40dc85361 Mon Sep 17 00:00:00 2001 From: Marcus Breese Date: Sat, 29 Nov 2025 12:06:10 -0500 Subject: [PATCH 1/5] Re-purposed for loops for while loops (like go-lang) --- build.xml | 2 +- .../cgpipe/parser/node/IteratingNode.java | 149 +++++++++++------- src/test-scripts/while.mvpt | 17 ++ src/test-scripts/while.mvpt.good | 9 ++ 4 files changed, 115 insertions(+), 62 deletions(-) create mode 100644 src/test-scripts/while.mvpt create mode 100644 src/test-scripts/while.mvpt.good diff --git a/build.xml b/build.xml index 1b9f981..855e849 100644 --- a/build.xml +++ b/build.xml @@ -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..6135e1a 100644 --- a/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java +++ b/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java @@ -26,15 +26,17 @@ public class IteratingNode extends ASTNode { public IteratingNode(ASTNode parent, TokenList tokens) throws ASTParseException { super(parent, tokens); -// System.err.println("ITER: " + tokens); + System.err.println("ITER: " + tokens); 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/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 From 2880a0bff78584ff9b0e568e21fe6743c6a7f9ee Mon Sep 17 00:00:00 2001 From: Marcus Breese Date: Sat, 29 Nov 2025 12:07:24 -0500 Subject: [PATCH 2/5] version bump... --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 855e849..0984573 100644 --- a/build.xml +++ b/build.xml @@ -1,5 +1,5 @@ - + From c60c0d94e0e2fe651bb393d2704c45e9a5432109 Mon Sep 17 00:00:00 2001 From: Marcus Breese Date: Sat, 29 Nov 2025 12:08:48 -0500 Subject: [PATCH 3/5] debug --- src/java/io/compgen/cgpipe/parser/node/IteratingNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java b/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java index 6135e1a..9fd5f71 100644 --- a/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java +++ b/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java @@ -175,7 +175,7 @@ public ASTNode exec(ExecContext context) throws ASTExecException { // for test while loop while (true) { VarValue val = Eval.evalTokenExpression(iterTokens[0], context); -// System.out.println(" ==> evaluating: "+iterTokens[0]+" <== " + val + " | "+this); +// System.err.println(" ==> evaluating: "+iterTokens[0]+" <== " + val + " | "+this); if (!val.toBoolean()) { return next; } From 55c43af070d43c18a79eaabba60abe57cbf6ee08 Mon Sep 17 00:00:00 2001 From: Marcus Breese Date: Sun, 30 Nov 2025 01:01:51 -0500 Subject: [PATCH 4/5] missing comment --- src/java/io/compgen/cgpipe/parser/node/IteratingNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java b/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java index 9fd5f71..f8c9dcd 100644 --- a/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java +++ b/src/java/io/compgen/cgpipe/parser/node/IteratingNode.java @@ -26,7 +26,7 @@ public class IteratingNode extends ASTNode { public IteratingNode(ASTNode parent, TokenList tokens) throws ASTParseException { super(parent, tokens); - System.err.println("ITER: " + tokens); +// System.err.println("ITER: " + tokens); int preCount = 0; int postCount = 0; From 0bf84ffcdb8244e742280755b6d4b24ae32daf63 Mon Sep 17 00:00:00 2001 From: Marcus Breese Date: Thu, 4 Dec 2025 02:11:30 -0500 Subject: [PATCH 5/5] added batchq support for PROXYQUEUED state --- src/java/io/compgen/cgpipe/runner/BatchQTemplateRunner.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } }