Revision: 20407
          http://sourceforge.net/p/jmol/code/20407
Author:   hansonr
Date:     2015-03-28 01:40:21 +0000 (Sat, 28 Mar 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.13_2015.03.27"

new feature: "." notation extended to x.[a]
  disambiguifies x[a][b][c]...
  allows for variables and expressions in "." notation
  i = 2
  x = [1,[2 3 4 [5 6 7]],3]
  show x[2].[4].[i]  
   ==> "6"
  x = [ 1,[ 2,3,4,[ 5,6,7 ],{ "testing":"now" } ],3 ]
  x[i + 1].[5].["testing"] = "again"
  show x
   ==> x = [ 1,[ 2,3,4,[ 5,6,7 ],{ "testing":"again" } ],3 ]
   

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

Modified: trunk/Jmol/src/org/jmol/script/ScriptTokenParser.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptTokenParser.java       2015-03-27 
23:29:48 UTC (rev 20406)
+++ trunk/Jmol/src/org/jmol/script/ScriptTokenParser.java       2015-03-28 
01:40:21 UTC (rev 20407)
@@ -359,6 +359,40 @@
       return false;
     if (logMessages)
         Logger.debug("addTokenToPostfix" + token);
+    if (token.tok == T.leftsquare && lastToken.tok == T.per) {
+      // new notation
+      int ipt = ltokenPostfix.size() - 1;
+      ltokenPostfix.remove(ipt);
+      ltokenPostfix.addLast(T.tokenRightParen);
+      int pcount = 0;
+      int tok;      
+      for (int i = ltokenPostfix.size(); --i >= 0 && pcount >= 0;) {
+        switch  (tok = ltokenPostfix.get(i).tok) {
+        case T.rightparen:
+        case T.rightsquare:
+          pcount++;
+          break;
+        case T.leftparen:
+        case T.leftsquare:
+          pcount--;
+          int tok2;
+          if (pcount == 1 && (tok2 = ltokenPostfix.get(i - 1).tok) != 
T.rightparen && tok2 != T.rightsquare) {
+            ipt = (tok == T.leftsquare ? i - 1 : i);
+            pcount = -10;
+          }
+          break;
+        default:
+          if (i == ipt - 1) {
+            ipt = i;
+            pcount = -10;
+          }
+          break;
+        }
+      }
+      if (pcount == -10) {
+        ltokenPostfix.add(ipt, T.tokenLeftParen);
+      }
+    }
     ltokenPostfix.addLast(token);
     lastToken = token;
     return true;

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-03-27 23:29:48 UTC 
(rev 20406)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-03-28 01:40:21 UTC 
(rev 20407)
@@ -14,8 +14,23 @@
 
 TODO: remove HTML5 dependency on synchronous file loading (check SCRIPT 
command for problems)
 
-Jmol.___JmolVersion="14.3.13_2015.03.25"
+Jmol.___JmolVersion="14.3.13_2015.03.27"
 
+new feature: "." notation extended to x.[a]
+  disambiguifies x[a][b][c]...
+  allows for variables and expressions in "." notation
+  i = 2
+  x = [1,[2 3 4 [5 6 7]],3]
+  show x[2].[4].[i]  
+   ==> "6"
+  x = [ 1,[ 2,3,4,[ 5,6,7 ],{ "testing":"now" } ],3 ]
+  x[i + 1].[5].["testing"] = "again"
+  show x
+   ==> x = [ 1,[ 2,3,4,[ 5,6,7 ],{ "testing":"again" } ],3 ]
+   
+  
+JmolVersion="14.3.13_2015.03.25"
+
 bug fix: translate SELECTED {1 1 1} @1 not working (works fine without the 
SELECTED keyword)
          
 JmolVersion="14.3.13_2015.03.23"

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


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to