From: <fwi...@us...> - 2008-08-13 03:48:03
|
Revision: 5166 http://jython.svn.sourceforge.net/jython/?rev=5166&view=rev Author: fwierzbicki Date: 2008-08-13 03:48:00 +0000 (Wed, 13 Aug 2008) Log Message: ----------- Remove direct exception throwing for tooling. Modified Paths: -------------- branches/asm/src/org/python/antlr/ErrorHandler.java branches/asm/src/org/python/antlr/FailFastHandler.java branches/asm/src/org/python/antlr/GrammarActions.java branches/asm/src/org/python/antlr/ListErrorHandler.java Modified: branches/asm/src/org/python/antlr/ErrorHandler.java =================================================================== --- branches/asm/src/org/python/antlr/ErrorHandler.java 2008-08-13 00:53:09 UTC (rev 5165) +++ branches/asm/src/org/python/antlr/ErrorHandler.java 2008-08-13 03:48:00 UTC (rev 5166) @@ -20,4 +20,6 @@ sliceType errorSlice(PythonTree t); stmtType errorStmt(PythonTree t); + //exceptions + void error(String message, PythonTree t); } Modified: branches/asm/src/org/python/antlr/FailFastHandler.java =================================================================== --- branches/asm/src/org/python/antlr/FailFastHandler.java 2008-08-13 00:53:09 UTC (rev 5165) +++ branches/asm/src/org/python/antlr/FailFastHandler.java 2008-08-13 03:48:00 UTC (rev 5166) @@ -47,6 +47,10 @@ throw new ParseException("Bad Stmt Node", t); } + public void error(String message, PythonTree t) { + throw new ParseException(message, t); + } + private String message(BaseRecognizer br, RecognitionException re) { String hdr = br.getErrorHeader(re); String msg = br.getErrorMessage(re, br.getTokenNames()); Modified: branches/asm/src/org/python/antlr/GrammarActions.java =================================================================== --- branches/asm/src/org/python/antlr/GrammarActions.java 2008-08-13 00:53:09 UTC (rev 5165) +++ branches/asm/src/org/python/antlr/GrammarActions.java 2008-08-13 03:48:00 UTC (rev 5166) @@ -97,7 +97,7 @@ } void throwGenExpNotSoleArg(PythonTree t) { - throw new ParseException("Generator expression must be parenthesized if not sole argument", t); + errorHandler.error("Generator expression must be parenthesized if not sole argument", t); } exprType[] makeExprs(List exprs) { @@ -482,17 +482,17 @@ void cantBeNone(PythonTree e) { if (e.getText().equals("None")) { - throw new ParseException("can't be None", e); + errorHandler.error("can't be None", e); } } void checkAssign(exprType e) { if (e instanceof Name && ((Name)e).id.equals("None")) { - throw new ParseException("assignment to None", e); + errorHandler.error("assignment to None", e); } else if (e instanceof GeneratorExp) { - throw new ParseException("can't assign to generator expression", e); + errorHandler.error("can't assign to generator expression", e); } else if (e instanceof Num) { - throw new ParseException("can't assign to number", e); + errorHandler.error("can't assign to number", e); } else if (e instanceof Tuple) { //XXX: performance problem? Any way to do this better? exprType[] elts = ((Tuple)e).elts; Modified: branches/asm/src/org/python/antlr/ListErrorHandler.java =================================================================== --- branches/asm/src/org/python/antlr/ListErrorHandler.java 2008-08-13 00:53:09 UTC (rev 5165) +++ branches/asm/src/org/python/antlr/ListErrorHandler.java 2008-08-13 03:48:00 UTC (rev 5166) @@ -47,4 +47,8 @@ return new ErrorStmt(t); } + public void error(String message, PythonTree t) { + System.err.println(message); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |