Revision: 20411 http://sourceforge.net/p/jmol/code/20411 Author: hansonr Date: 2015-03-31 02:22:06 +0000 (Tue, 31 Mar 2015) Log Message: -----------
Modified Paths: -------------- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java trunk/Jmol/src/org/jmol/script/ScriptExpr.java trunk/Jmol/src/org/jmol/scriptext/MathExt.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-03-28 14:16:59 UTC (rev 20410) +++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2015-03-31 02:22:06 UTC (rev 20411) @@ -908,12 +908,13 @@ ident = script.substring(ichToken, ichToken + cchToken); identLC = ident.toLowerCase(); boolean isUserVar = (isContextVariable(identLC)); + String preserveCase = null; if (nTokens == 0) isUserToken = isUserVar; if (nTokens == 1 && (tokCommand == T.function || tokCommand == T.parallel || tokCommand == T.var) - || nTokens != 0 && isUserVar && lastToken.tok != T.per - || isUserFunction(identLC) + || nTokens != 0 && isUserVar && lastToken.tok != T.per || !isDotDot + && isUserFunction(identLC) && ((preserveCase = ident) != null) && (thisFunction == null || !thisFunction.name.equals(identLC))) { // we need to allow: @@ -926,7 +927,7 @@ // color += ... // color[ ... - ident = identLC; + ident = (preserveCase == null ? identLC : preserveCase); theToken = null; } else if (ident.length() == 1 || lastToken.tok == T.colon) { // hack to support case sensitive alternate locations and chains @@ -945,10 +946,11 @@ } if (theToken == null) { - if (identLC.indexOf("property_") == 0) + if (identLC.indexOf("property_") == 0) { theToken = T.o(T.property, identLC); - else + } else { theToken = T.o(T.identifier, ident); + } } theTok = theToken.tok; } Modified: trunk/Jmol/src/org/jmol/script/ScriptExpr.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptExpr.java 2015-03-28 14:16:59 UTC (rev 20410) +++ trunk/Jmol/src/org/jmol/script/ScriptExpr.java 2015-03-31 02:22:06 UTC (rev 20411) @@ -187,7 +187,7 @@ if (isImplicitAtomProperty && tokAt(i + 1) != T.per) { // local variable definition SV token = (localVars != null && localVars.containsKey(theToken.value) ? null - : getBitsetPropertySelector(i, false, false)); + : getBitsetPropertySelector(i)); if (token != null) { rpn.addX(localVars.get(localVar)); if (!rpn.addOpAllowMath(token, (tokAt(i + 1) == T.leftparen))) @@ -477,7 +477,7 @@ continue; } } - SV var = getBitsetPropertySelector(i + 1, false, false); + SV var = getBitsetPropertySelector(i + 1); if (var == null) invArg(); // check for added min/max modifier @@ -1461,9 +1461,7 @@ return bs; } - private SV getBitsetPropertySelector(int i, boolean mustBeSettable, - boolean isExpression) - throws ScriptException { + private SV getBitsetPropertySelector(int i) throws ScriptException { int tok = getToken(i).tok; switch (tok) { case T.min: @@ -1480,17 +1478,11 @@ if (tok != T.opIf && !T.tokAttr(tok, T.identifier)) return null; String name = paramAsStr(i); - if (!mustBeSettable && vwr.isFunction(name)) { + if (vwr.isFunction(name.toLowerCase())) { tok = T.function; break; } - if (isExpression && !name.endsWith("?")) - return null; - if (isExpression) - tok = T.identifier; } - if (mustBeSettable && isExpression && !T.tokAttr(tok, T.settable)) - return null; return SV.newSV(T.propselector, tok, paramAsStr(i)); } Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2015-03-28 14:16:59 UTC (rev 20410) +++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2015-03-31 02:22:06 UTC (rev 20411) @@ -2464,9 +2464,20 @@ SV x1 = null; if (isSelector) { x1 = mp.getX(); - if (x1.tok != T.bitset) + switch (x1.tok) { + case T.bitset: + break; + case T.hash: + // really xx.yyy where yyy is a function; + if (args.length > 0) + return false; + x1 = x1.getMap().get(name); + return (x1 == null ? mp.addXStr("") : mp.addX(x1)); + default: return false; + } } + name = name.toLowerCase(); mp.wasX = false; Lst<SV> params = new Lst<SV>(); for (int i = 0; i < args.length; i++) { Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-03-28 14:16:59 UTC (rev 20410) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-03-31 02:22:06 UTC (rev 20411) @@ -14,8 +14,13 @@ TODO: remove HTML5 dependency on synchronous file loading (check SCRIPT command for problems) -Jmol.___JmolVersion="14.3.13_2015.03.27" +Jmol.___JmolVersion="14.3.13_2015.03.30" +bug fix: {hash}.Key = value will be stored as "key" rather than "Key". +bug fix: {hash}.key will fail if "key" is also a user-defined function. + +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 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