From: <ha...@us...> - 2007-11-03 22:40:18
|
Revision: 8563 http://jmol.svn.sourceforge.net/jmol/?rev=8563&view=rev Author: hansonr Date: 2007-11-03 15:40:16 -0700 (Sat, 03 Nov 2007) Log Message: ----------- version=11.3.41_dev # math cleanup Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/Compiler.java trunk/Jmol/src/org/jmol/viewer/Eval.java Modified: trunk/Jmol/src/org/jmol/viewer/Compiler.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Compiler.java 2007-11-03 22:23:48 UTC (rev 8562) +++ trunk/Jmol/src/org/jmol/viewer/Compiler.java 2007-11-03 22:40:16 UTC (rev 8563) @@ -1724,7 +1724,7 @@ return false; if (!addNextTokenIf(Token.rightparen)) return rightParenthesisExpected(); - return checkForMath(); + return checkForItemSelector(); case Token.leftbrace: return checkForCoordinate(isImplicitExpression); } @@ -1787,23 +1787,16 @@ tokenNext(); else addNextToken(); - return checkForMath(); + return checkForItemSelector(); } - private boolean checkForMath() { + private boolean checkForItemSelector() { + // {x[1]} @{x}[1][3] (atomno=3)[2][5] for (int i = 0; i < 2; i++) { if (!addNextTokenIf(Token.leftsquare)) break; if (!clauseItemSelector()) return false; - if (addNextTokenIf(Token.comma)) { - if (!clauseItemSelector()) - return false; - if (!addNextTokenIf(Token.comma)) - return false; - if (!clauseItemSelector()) - return false; - } if (!addNextTokenIf(Token.rightsquare)) return rightBracketExpected(); } @@ -2069,7 +2062,7 @@ // we allow @x[1], which compiles as {@x}[1], not @{x[1]} // otherwise [1] gets read as a general atom name selector if (!addSubstituteTokenIf(Token.leftbrace, Token.tokenExpressionBegin)) - return addNextToken() && checkForMath(); + return addNextToken() && checkForItemSelector(); while (moreTokens() && !tokPeek(Token.rightbrace)) { if (tokPeek(Token.leftbrace)) { if (!checkForCoordinate(true)) @@ -2079,7 +2072,7 @@ } } return addSubstituteTokenIf(Token.rightbrace, Token.tokenExpressionEnd) - && checkForMath(); + && checkForItemSelector(); } private boolean residueSpecCodeGenerated; Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-11-03 22:23:48 UTC (rev 8562) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-11-03 22:40:16 UTC (rev 8563) @@ -256,8 +256,7 @@ this.historyDisabled = historyDisabled; try { instructionDispatchLoop(false); - } catch (ScriptException e) { - error = true; + } catch (ScriptException e) { error = true; setErrorMessage(e.toString()); scriptStatus(errorMessage); } @@ -10537,10 +10536,8 @@ return false; oStack[oPt].intValue |= op.tok; return true; - case Token.leftsquare: // two contexts: [x x].distance or {....}[n] - isLeftOp = true;//!wasX; - //if (isLeftOp) - //op = newOp = new Token(Token.leftsquare, 0, "["); + case Token.leftsquare: // {....}[n][m] + isLeftOp = true; break; case Token.minus: if (wasX) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |