From: <fwi...@us...> - 2009-07-03 23:10:43
|
Revision: 6507 http://jython.svn.sourceforge.net/jython/?rev=6507&view=rev Author: fwierzbicki Date: 2009-07-03 23:10:43 +0000 (Fri, 03 Jul 2009) Log Message: ----------- Make PythonPartial easier to diff w/ Python.g, and small whitespace fix in Python.g. Modified Paths: -------------- trunk/jython/grammar/Python.g trunk/jython/grammar/PythonPartial.g Modified: trunk/jython/grammar/Python.g =================================================================== --- trunk/jython/grammar/Python.g 2009-07-03 15:45:08 UTC (rev 6506) +++ trunk/jython/grammar/Python.g 2009-07-03 23:10:43 UTC (rev 6507) @@ -620,7 +620,7 @@ | -> ^(PRINT<Print>[$PRINT, null, new ArrayList<expr>(), true]) ) - ; + ; //not in CPython's Grammar file printlist returns [boolean newline, List elts] Modified: trunk/jython/grammar/PythonPartial.g =================================================================== --- trunk/jython/grammar/PythonPartial.g 2009-07-03 15:45:08 UTC (rev 6506) +++ trunk/jython/grammar/PythonPartial.g 2009-07-03 23:10:43 UTC (rev 6507) @@ -255,78 +255,125 @@ | assert_stmt ; -expr_stmt : testlist - ( augassign yield_expr - | augassign testlist - | assigns - )? - ; +expr_stmt -assigns - : assign_testlist+ - | assign_yield+ + : ((testlist augassign) => testlist + ( (augassign yield_expr + + ) + | (augassign testlist + + ) + ) + | (testlist ASSIGN) => testlist + ( + | ((ASSIGN testlist)+ + + ) + | ((ASSIGN yield_expr)+ + + ) + ) + | testlist + + ) ; -assign_testlist - : ASSIGN testlist - ; - -assign_yield - : ASSIGN yield_expr +//augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | +// '<<=' | '>>=' | '**=' | '//=') +augassign + : PLUSEQUAL + | MINUSEQUAL + | STAREQUAL + | SLASHEQUAL + | PERCENTEQUAL + | AMPEREQUAL + | VBAREQUAL + | CIRCUMFLEXEQUAL + | LEFTSHIFTEQUAL + | RIGHTSHIFTEQUAL + | DOUBLESTAREQUAL + | DOUBLESLASHEQUAL ; -augassign : PLUSEQUAL - | MINUSEQUAL - | STAREQUAL - | SLASHEQUAL - | PERCENTEQUAL - | AMPEREQUAL - | VBAREQUAL - | CIRCUMFLEXEQUAL - | LEFTSHIFTEQUAL - | RIGHTSHIFTEQUAL - | DOUBLESTAREQUAL - | DOUBLESLASHEQUAL - ; +//print_stmt: 'print' ( [ test (',' test)* [','] ] | +// '>>' test [ (',' test)+ [','] ] ) +print_stmt + : PRINT + (printlist + + | RIGHTSHIFT printlist + + | + + ) + ; -print_stmt : PRINT (printlist | RIGHTSHIFT printlist)? - ; - +//not in CPython's Grammar file printlist returns [boolean newline] : test (options {k=2;}: COMMA test)* (COMMA)? ; -del_stmt : DELETE exprlist - ; +//del_stmt: 'del' exprlist +del_stmt + : DELETE exprlist + + ; -pass_stmt : PASS - ; +//pass_stmt: 'pass' +pass_stmt + : PASS + + ; -flow_stmt : break_stmt - | continue_stmt - | return_stmt - | raise_stmt - | yield_stmt - ; +//flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt +flow_stmt + : break_stmt + | continue_stmt + | return_stmt + | raise_stmt + | yield_stmt + ; -break_stmt : BREAK - ; +//break_stmt: 'break' +break_stmt + : BREAK + + ; -continue_stmt : CONTINUE - ; +//continue_stmt: 'continue' +continue_stmt + : CONTINUE + + ; -return_stmt : RETURN (testlist)? - ; +//return_stmt: 'return' [testlist] +return_stmt + : RETURN + (testlist + + | + + ) + ; -yield_stmt : yield_expr - ; +//yield_stmt: yield_expr +yield_stmt + : yield_expr + ; -raise_stmt: RAISE (test (COMMA test (COMMA test)?)?)? - ; +//raise_stmt: 'raise' [test [',' test [',' test]]] +raise_stmt + : RAISE (test (COMMA test + (COMMA test)?)?)? + + ; -import_stmt : import_name - | import_from - ; +//import_stmt: import_name | import_from +import_stmt + : import_name + | import_from + ; import_name : IMPORT dotted_as_names ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |