From: <fwi...@us...> - 2008-08-26 16:51:17
|
Revision: 5251 http://jython.svn.sourceforge.net/jython/?rev=5251&view=rev Author: fwierzbicki Date: 2008-08-26 16:51:15 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Moved Subscript creation up a rule - fixed a bunch of unit tests. Modified Paths: -------------- branches/nowalker/build.xml branches/nowalker/grammar/Python.g Modified: branches/nowalker/build.xml =================================================================== --- branches/nowalker/build.xml 2008-08-26 15:05:19 UTC (rev 5250) +++ branches/nowalker/build.xml 2008-08-26 16:51:15 UTC (rev 5251) @@ -318,9 +318,7 @@ change to grammar files. If you are working on the grammars you might want to comment this out, as a clean is really only needed if you change the tokens defined in Python.g (and cleans make the build slow) --> - <antcall target="clean"/> <!-- force jarjar build --> - <property name="jarjar.needed" value="true" /> </target> <target name ="prepare-output" depends="init,needed-check,clean-if-antlr-needed,make-output-dirs"/> Modified: branches/nowalker/grammar/Python.g =================================================================== --- branches/nowalker/grammar/Python.g 2008-08-26 15:05:19 UTC (rev 5250) +++ branches/nowalker/grammar/Python.g 2008-08-26 16:51:15 UTC (rev 5251) @@ -1105,7 +1105,7 @@ @after { $power.tree = $etype; } - : atom (t+=trailer[$atom.start])* (options {greedy=true;}:d=DOUBLESTAR factor)? + : atom (t+=trailer[$atom.start, $atom.tree])* (options {greedy=true;}:d=DOUBLESTAR factor)? { $etype = (exprType)$atom.tree; if ($t != null) { @@ -1258,33 +1258,32 @@ ; //trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME -trailer [Token begin] +trailer [Token begin, PythonTree tree] : LPAREN (arglist - -> ^(LPAREN<Call>[$begin, null, actions.makeExprs($arglist.args), + -> ^(LPAREN<Call>[$begin, (exprType)$tree, actions.makeExprs($arglist.args), actions.makeKeywords($arglist.keywords), $arglist.starargs, $arglist.kwargs]) | - -> ^(LPAREN<Call>[$LPAREN, null, new exprType[0\], new keywordType[0\], null, null]) + -> ^(LPAREN<Call>[$LPAREN, (exprType)$tree, new exprType[0\], new keywordType[0\], null, null]) ) RPAREN - | LBRACK s=subscriptlist[begin] RBRACK - -> $s + | LBRACK subscriptlist[$begin] RBRACK + -> ^(LBRACK<Subscript>[$begin, (exprType)$tree, (sliceType)$subscriptlist.tree, $expr::ctype]) | DOT attr - -> ^(DOT<Attribute>[$begin, null, $attr.text, $expr::ctype]) + -> ^(DOT<Attribute>[$begin, (exprType)$tree, $attr.text, $expr::ctype]) ; //subscriptlist: subscript (',' subscript)* [','] -subscriptlist[Token begin] returns [exprType etype] +subscriptlist[Token begin] @init { - exprType etype = null; + sliceType sltype = null; } @after { - $subscriptlist.tree = etype; + $subscriptlist.tree = sltype; } : sub+=subscript (options {greedy=true;}:c1=COMMA sub+=subscript)* (c2=COMMA)? { - sliceType s = actions.makeSliceType($begin, $c1, $c2, $sub); - etype = new Subscript($begin, null, s, $expr::ctype); + sltype = actions.makeSliceType($begin, $c1, $c2, $sub); } ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |