Revision: 20855
          http://sourceforge.net/p/jmol/code/20855
Author:   hansonr
Date:     2015-11-03 12:34:16 +0000 (Tue, 03 Nov 2015)
Log Message:
-----------


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

Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java  2015-11-03 12:17:44 UTC 
(rev 20854)
+++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java  2015-11-03 12:34:16 UTC 
(rev 20855)
@@ -811,16 +811,27 @@
       setEqualPt = Integer.MAX_VALUE;
 
     }
+    boolean isOneLine = (flowContext != null && flowContext.addLine == 0); // 
if (....) xxxxx;
+    boolean isEndFlow = ((endOfLine || !isOneLine) && !haveENDIF && 
flowContext != null && flowContext.checkForceEndIf(-1));
     if (endOfLine) {
-      if (!haveENDIF && flowContext != null 
-          && flowContext.checkForceEndIf(-1)) {
-        boolean isOneLine = (flowContext.addLine == 0); // if (....) xxxxx;
+      if (isEndFlow) {
         if (isComment) {
           if (!isOneLine) {
             flowContext.addLine++;
             flowContext.forceEndIf = true;
           }
         } else if (n > 0 && !haveENDIF || isOneLine) {
+          // looking for 
+          // for (...) 
+          //  print ...
+          //
+          // but not empty line after for:
+          //
+          // for (...) 
+          //
+          //  print ...
+          //
+
           forceFlowEnd(flowContext.token);
           if (!isOneLine) {
             forceFlowContext.forceEndIf = true;
@@ -829,13 +840,19 @@
         isEndOfCommand = true;
         cchToken = 0;
         ichCurrentCommand = ichToken;
-//        if (n > 0 || isOneLine)
-  //        lineCurrent--;
         return CONTINUE;
       }
       isComment = false;
       isShowCommand = false;
       ++lineCurrent;
+    } else if (isEndFlow) {
+      // looking at something like
+      //
+      // for (...) 
+      //  print ... ;
+      //
+      forceFlowEnd(flowContext.token);
+      forceFlowContext.forceEndIf = true;
     }
     if (ichToken >= cchScript) {
       // check for end of all brace work

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