From: <fwi...@us...> - 2009-01-09 03:59:20
|
Revision: 5895 http://jython.svn.sourceforge.net/jython/?rev=5895&view=rev Author: fwierzbicki Date: 2009-01-09 03:59:16 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Set support Modified Paths: -------------- branches/jy3k/grammar/Python.g Modified: branches/jy3k/grammar/Python.g =================================================================== --- branches/jy3k/grammar/Python.g 2009-01-09 03:19:43 UTC (rev 5894) +++ branches/jy3k/grammar/Python.g 2009-01-09 03:59:16 UTC (rev 5895) @@ -130,6 +130,7 @@ import org.python.antlr.ast.Pass; import org.python.antlr.ast.Raise; import org.python.antlr.ast.Return; +import org.python.antlr.ast.Set; import org.python.antlr.ast.Slice; import org.python.antlr.ast.Str; import org.python.antlr.ast.Subscript; @@ -1226,12 +1227,12 @@ ) RBRACK | LCURLY - (dictorsetmaker[$LCURLY] - -> dictorsetmaker - | - -> ^(LCURLY<Dict>[$LCURLY, new ArrayList<expr>(), new ArrayList<expr>()]) - ) - RCURLY + (dictorsetmaker[$LCURLY] + -> dictorsetmaker + | + -> ^(LCURLY<Dict>[$LCURLY, new ArrayList<expr>(), new ArrayList<expr>()]) + ) + RCURLY | NAME -> ^(NAME<Name>[$NAME, $NAME.text, $expr::ctype]) | INT @@ -1418,12 +1419,18 @@ @after { $dictorsetmaker.tree = etype; } - : k+=test[expr_contextType.Load] COLON v+=test[expr_contextType.Load] + : (test[null] COLON) + => k+=test[expr_contextType.Load] COLON v+=test[expr_contextType.Load] (options {k=2;}:COMMA k+=test[expr_contextType.Load] COLON v+=test[expr_contextType.Load])* (COMMA)? { etype = new Dict($lcurly, actions.castExprs($k), actions.castExprs($v)); } + | t+=test[$expr::ctype] (options {greedy=true;}:COMMA t+=test[$expr::ctype])* + (COMMA)? + { + etype = new Set($lcurly, actions.castExprs($t)); + } ; //classdef: 'class' NAME ['(' [testlist] ')'] ':' suite This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |