From: <fwi...@us...> - 2009-07-07 14:21:18
|
Revision: 6521 http://jython.svn.sourceforge.net/jython/?rev=6521&view=rev Author: fwierzbicki Date: 2009-07-07 12:43:53 +0000 (Tue, 07 Jul 2009) Log Message: ----------- More whitespace cleanup and "diff shrinking" between all of the grammars. Modified Paths: -------------- trunk/jython/grammar/Base.g trunk/jython/grammar/Python.g trunk/jython/grammar/PythonPartial.g Modified: trunk/jython/grammar/Base.g =================================================================== --- trunk/jython/grammar/Base.g 2009-07-07 11:36:34 UTC (rev 6520) +++ trunk/jython/grammar/Base.g 2009-07-07 12:43:53 UTC (rev 6521) @@ -80,12 +80,7 @@ } @rulecatch { -catch (RecognitionException re) { - errorHandler.reportError(this, re); - errorHandler.recover(this, input,re); - retval.tree = (PythonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } -} @lexer::header { package org.python.antlr; @@ -739,7 +734,7 @@ (list_for | (options {greedy=true;}:COMMA test)* ) (COMMA)? - ; + ; //testlist_gexp: test ( gen_for | (',' test)* [','] ) testlist_gexp Modified: trunk/jython/grammar/Python.g =================================================================== --- trunk/jython/grammar/Python.g 2009-07-07 11:36:34 UTC (rev 6520) +++ trunk/jython/grammar/Python.g 2009-07-07 12:43:53 UTC (rev 6521) @@ -320,9 +320,10 @@ if ($stmt.stypes != null) {stypes.addAll($stmt.stypes);} } - )* EOF { - mtype = new Module($file_input.start, actions.castStmts(stypes)); - } + )* EOF + { + mtype = new Module($file_input.start, actions.castStmts(stypes)); + } ; //XXX: this block is duplicated in three places, how to extract? catch [RecognitionException re] { @@ -332,7 +333,6 @@ retval.tree = new ErrorMod(badNode); } - //eval_input: testlist NEWLINE* ENDMARKER eval_input @init { @@ -753,7 +753,8 @@ //yield_stmt: yield_expr yield_stmt - : yield_expr -> ^(YIELD<Expr>[$yield_expr.start, actions.castExpr($yield_expr.tree)]) + : yield_expr + -> ^(YIELD<Expr>[$yield_expr.start, actions.castExpr($yield_expr.tree)]) ; //raise_stmt: 'raise' [test [',' test [',' test]]] @@ -1896,10 +1897,11 @@ */ CONTINUED_LINE : '\\' ('\r')? '\n' (' '|'\t')* { $channel=HIDDEN; } - ( c1=COMMENT - | nl=NEWLINE { - emit(new CommonToken(NEWLINE,nl.getText())); - } + ( COMMENT + | nl=NEWLINE + { + emit(new CommonToken(NEWLINE,nl.getText())); + } | ) { if (input.LA(1) == -1) { Modified: trunk/jython/grammar/PythonPartial.g =================================================================== --- trunk/jython/grammar/PythonPartial.g 2009-07-07 11:36:34 UTC (rev 6520) +++ trunk/jython/grammar/PythonPartial.g 2009-07-07 12:43:53 UTC (rev 6521) @@ -307,6 +307,8 @@ | assert_stmt ; +//expr_stmt: testlist (augassign (yield_expr|testlist) | +// ('=' (yield_expr|testlist))*) expr_stmt : ((testlist augassign) => testlist ( (augassign yield_expr @@ -353,8 +355,11 @@ ; //not in CPython's Grammar file -printlist returns [boolean newline] - : test (options {k=2;}: COMMA test)* (COMMA)? +printlist + : (test COMMA) => + test (options {k=2;}: COMMA test)* + (COMMA)? + | test ; //del_stmt: 'del' exprlist @@ -392,7 +397,7 @@ (testlist | ) - ; + ; //yield_stmt: yield_expr yield_stmt @@ -459,8 +464,7 @@ //exec_stmt: 'exec' expr ['in' test [',' test]] exec_stmt - : EXEC expr (IN test - (COMMA test)?)? + : EXEC expr (IN test (COMMA test)?)? ; //assert_stmt: 'assert' test [',' test] @@ -1082,7 +1086,7 @@ */ CONTINUED_LINE : '\\' ('\r')? '\n' (' '|'\t')* { $channel=HIDDEN; } - ( c1=COMMENT + ( COMMENT | nl=NEWLINE | ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |