From: <ha...@us...> - 2010-07-22 21:14:06
|
Revision: 13649 http://jmol.svn.sourceforge.net/jmol/?rev=13649&view=rev Author: hansonr Date: 2010-07-22 21:13:59 +0000 (Thu, 22 Jul 2010) Log Message: ----------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/script/ScriptContext.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java Modified: trunk/Jmol/src/org/jmol/script/ScriptContext.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptContext.java 2010-07-22 20:10:40 UTC (rev 13648) +++ trunk/Jmol/src/org/jmol/script/ScriptContext.java 2010-07-22 21:13:59 UTC (rev 13649) @@ -64,13 +64,13 @@ ScriptContext() { } - StringBuffer getContextTrace(StringBuffer sb) { + StringBuffer getContextTrace(StringBuffer sb, boolean isTop) { if (sb == null) sb = new StringBuffer(); sb.append(ScriptEvaluator.setErrorLineMessage(functionName, filename, - lineNumbers[pc], pc, ScriptEvaluator.statementAsString(statement, iToken, false))); + lineNumbers[pc], pc, ScriptEvaluator.statementAsString(statement, (isTop ? iToken : 9999), false))); if (parentContext != null) - parentContext.getContextTrace(sb); + parentContext.getContextTrace(sb, false); return sb; } } \ No newline at end of file Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2010-07-22 20:10:40 UTC (rev 13648) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2010-07-22 21:13:59 UTC (rev 13649) @@ -2695,7 +2695,7 @@ String err = "\n----"; if (filename != null || functionName != null) err += "line " + lineCurrent + " command " + (pcCurrent + 1) + " of " - + (functionName == null ? filename : "function " + functionName) + + (functionName == null ? filename : functionName.equals("try") ? "try" : "function " + functionName) + ":"; err += "\n " + lineInfo; return err; @@ -2714,7 +2714,7 @@ message = ""; return; } - String s = getScriptContext().getContextTrace(null).toString(); + String s = getScriptContext().getContextTrace(null, true).toString(); while (scriptLevel > 0) popContext(false, false); message += s; @@ -2916,6 +2916,11 @@ } else if (token.intValue != Integer.MAX_VALUE) sb.append(Token.nameOf(token.intValue)).append(" "); break; + case Token.trycmd: + continue; + case Token.end: + sb.append("try"); + continue; default: if (Token.tokAttr(token.tok, Token.identifier) || !doLogMessages) break; @@ -2923,10 +2928,9 @@ continue; } if (token.value != null) - // value SHOULD NEVER BE NULL, BUT JUST IN CASE... sb.append(token.value.toString()); } - if (iTok >= len - 1) + if (iTok >= len - 1 && iTok != 9999) sb.append(" <<"); return sb.toString(); } @@ -8793,7 +8797,7 @@ String msg = null; if (statementLength == 1) { if (!isSyntaxCheck) - msg = getScriptContext().getContextTrace(null).toString(); + msg = getScriptContext().getContextTrace(null, true).toString(); } else { msg = optParameterAsString(1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |