From: <fwi...@us...> - 2009-08-13 01:54:24
|
Revision: 6664 http://jython.svn.sourceforge.net/jython/?rev=6664&view=rev Author: fwierzbicki Date: 2009-08-13 01:54:15 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Better lineno col_offset match with CPython on elif. Modified Paths: -------------- trunk/jython/grammar/Python.g Modified: trunk/jython/grammar/Python.g =================================================================== --- trunk/jython/grammar/Python.g 2009-08-12 03:12:07 UTC (rev 6663) +++ trunk/jython/grammar/Python.g 2009-08-13 01:54:15 UTC (rev 6664) @@ -885,23 +885,23 @@ //if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] if_stmt - : IF test[expr_contextType.Load] COLON ifsuite=suite[false] elif_clause[$test.start]? + : IF test[expr_contextType.Load] COLON ifsuite=suite[false] elif_clause? -> ^(IF<If>[$IF, actions.castExpr($test.tree), actions.castStmts($ifsuite.stypes), actions.makeElse($elif_clause.stypes, $elif_clause.tree)]) ; //not in CPython's Grammar file elif_clause - [Token iftest] returns [List stypes] + returns [List stypes] : else_clause { $stypes = $else_clause.stypes; } | ELIF test[expr_contextType.Load] COLON suite[false] - (e2=elif_clause[$iftest] - -> ^(ELIF<If>[$iftest, actions.castExpr($test.tree), actions.castStmts($suite.stypes), actions.makeElse($e2.stypes, $e2.tree)]) + (e2=elif_clause + -> ^(ELIF<If>[$test.start, actions.castExpr($test.tree), actions.castStmts($suite.stypes), actions.makeElse($e2.stypes, $e2.tree)]) | - -> ^(ELIF<If>[$iftest, actions.castExpr($test.tree), actions.castStmts($suite.stypes), new ArrayList<stmt>()]) + -> ^(ELIF<If>[$test.start, actions.castExpr($test.tree), actions.castStmts($suite.stypes), new ArrayList<stmt>()]) ) ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |