Revision: 20786
          http://sourceforge.net/p/jmol/code/20786
Author:   hansonr
Date:     2015-09-22 04:03:42 +0000 (Tue, 22 Sep 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.16_2015.09.21b"

new feature: for allows one continuation line, as in JavaScript and Java
  -- for example:
        for (i = 1; i <= 3; i++)
          print i;

bug fix: for (key in hash){...} fails upon functional iteration (deepCopy)
  -- code was reusing the FOR variable when it should have been caching it in 
the context stack
  

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/script/ScriptCompiler.java
    trunk/Jmol/src/org/jmol/script/ScriptFlowContext.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java  2015-09-22 02:52:54 UTC 
(rev 20785)
+++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java  2015-09-22 04:03:42 UTC 
(rev 20786)
@@ -444,9 +444,20 @@
       return false;
     if (parenCount > 0 || bracketCount > 0)
       return true;
-    if ((tokCommand != T.set || !isNewSet) && tokCommand != T.print
-        && tokCommand != T.log)
+    switch (tokCommand) {
+    case T.forcmd:
+      flowContext.addLine = 1;
       return false;
+    case T.set:
+      if (isNewSet)
+        break;
+      //$FALL-THROUGH$
+    case T.print:
+    case T.log:
+      break;
+    default:
+      return false;
+    }
     if (lastToken.tok == tokLastMath)
       return true;
     ichT += n;

Modified: trunk/Jmol/src/org/jmol/script/ScriptFlowContext.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptFlowContext.java       2015-09-22 
02:52:54 UTC (rev 20785)
+++ trunk/Jmol/src/org/jmol/script/ScriptFlowContext.java       2015-09-22 
04:03:42 UTC (rev 20786)
@@ -149,6 +149,7 @@
   int ptCommand;
   boolean forceEndIf = true;
   String ident;
+  public int addLine;
   
   ScriptFlowContext(ScriptCompiler compiler, ContextToken token, int pt0, 
ScriptFlowContext parent) {
     this.compiler = compiler;
@@ -171,7 +172,7 @@
   boolean checkForceEndIf() {
     boolean test = forceEndIf 
         && ptCommand < this.compiler.iCommand 
-        && ptLine == this.compiler.lineCurrent;
+        && ptLine + addLine == this.compiler.lineCurrent;
     //System.out.println("checking" + pt + " " + test + " " + ident + " " + 
forceEndIf + " " + ptCommand + " " + iCommand + "/" + ptLine + " " + 
lineCurrent);
     if (test) // only once!
       forceEndIf = false;

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-09-22 02:52:54 UTC 
(rev 20785)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-09-22 04:03:42 UTC 
(rev 20786)
@@ -63,6 +63,11 @@
 
 Jmol.___JmolVersion="14.3.16_2015.09.21b"
 
+new feature: for allows one continuation line, as in JavaScript and Java
+  -- for example:
+       for (i = 1; i <= 3; i++)
+         print i;
+
 bug fix: for (key in hash){...} fails upon functional iteration (deepCopy)
   -- code was reusing the FOR variable when it should have been caching it in 
the context stack
   

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to