Author: olga Date: Thu Feb 21 14:00:22 2008 New Revision: 630017 URL: http://svn.apache.org/viewvc?rev=630017&view=rev Log: PIG-46: throw exception on parse error in batch mode
Modified: incubator/pig/trunk/CHANGES.txt incubator/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj Modified: incubator/pig/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=630017&r1=630016&r2=630017&view=diff ============================================================================== --- incubator/pig/trunk/CHANGES.txt (original) +++ incubator/pig/trunk/CHANGES.txt Thu Feb 21 14:00:22 2008 @@ -117,3 +117,6 @@ gates). PIG-107: enabled several tests. (francisoud via olgan) + + PIG-46: abort processing on error for non-interactive mode (olston via + olgan) Modified: incubator/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj?rev=630017&r1=630016&r2=630017&view=diff ============================================================================== --- incubator/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj (original) +++ incubator/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj Thu Feb 21 14:00:22 2008 @@ -378,7 +378,7 @@ {} | // handle invalid token - skip_invalid_command(EOL) + handle_invalid_command(EOL) {prompt();} ) } @@ -490,12 +490,17 @@ JAVACODE -void skip_invalid_command(int kind) +void handle_invalid_command(int kind) { ParseException e = generateParseException(); // generate the exception object. - System.out.println(e.toString()); // print the error message - Token t = getNextToken(); - - while (t.kind != kind) - t = getNextToken(); -} + + if (mInteractive) { + System.out.println(e.toString()); // print the error message + Token t = getNextToken(); + + while (t.kind != kind) + t = getNextToken(); + } else { + throw e; + } +} \ No newline at end of file