From: <fwi...@us...> - 2009-03-02 18:12:27
|
Revision: 6056 http://jython.svn.sourceforge.net/jython/?rev=6056&view=rev Author: fwierzbicki Date: 2009-03-02 18:12:22 +0000 (Mon, 02 Mar 2009) Log Message: ----------- Intital 2.7 tweaks: parser updates, with statement always on, add abc.py. Modified Paths: -------------- trunk/sandbox/wierzbicki/test27/CPythonLib.includes trunk/sandbox/wierzbicki/test27/grammar/Python.g trunk/sandbox/wierzbicki/test27/src/org/python/antlr/GrammarActions.java trunk/sandbox/wierzbicki/test27/src/org/python/compiler/CodeCompiler.java Property Changed: ---------------- trunk/sandbox/wierzbicki/test27/ Property changes on: trunk/sandbox/wierzbicki/test27 ___________________________________________________________________ Modified: svn:externals - CPythonLib -r70085 http://svn.python.org/projects/python/branches/release25-maint/Lib/ + CPythonLib -r70098 http://svn.python.org/projects/python/trunk/Lib/ Modified: trunk/sandbox/wierzbicki/test27/CPythonLib.includes =================================================================== --- trunk/sandbox/wierzbicki/test27/CPythonLib.includes 2009-03-02 15:59:20 UTC (rev 6055) +++ trunk/sandbox/wierzbicki/test27/CPythonLib.includes 2009-03-02 18:12:22 UTC (rev 6056) @@ -16,6 +16,7 @@ _MozillaCookieJar.py _strptime.py _threading_local.py +abc.py aifc.py anydbm.py atexit.py Modified: trunk/sandbox/wierzbicki/test27/grammar/Python.g =================================================================== --- trunk/sandbox/wierzbicki/test27/grammar/Python.g 2009-03-02 15:59:20 UTC (rev 6055) +++ trunk/sandbox/wierzbicki/test27/grammar/Python.g 2009-03-02 18:12:22 UTC (rev 6056) @@ -936,9 +936,9 @@ } ; -//except_clause: 'except' [test [',' test]] +//except_clause: 'except' [test [('as' | ',') test]] except_clause - : EXCEPT (t1=test[expr_contextType.Load] (COMMA t2=test[expr_contextType.Store])?)? COLON suite[!$suite.isEmpty() && $suite::continueIllegal] + : EXCEPT (t1=test[expr_contextType.Load] ((COMMA | AS) t2=test[expr_contextType.Store])?)? COLON suite[!$suite.isEmpty() && $suite::continueIllegal] -> ^(EXCEPT<ExceptHandler>[$EXCEPT, actions.castExpr($t1.tree), actions.castExpr($t2.tree), actions.castStmts($suite.stypes)]) ; @@ -1481,7 +1481,7 @@ } : argument[arguments, kws, gens, true] (COMMA argument[arguments, kws, gens, false])* (COMMA - ( STAR s=test[expr_contextType.Load] (COMMA DOUBLESTAR k=test[expr_contextType.Load])? + ( STAR s=test[expr_contextType.Load] (COMMA argument[arguments, kws, gens, false])* (COMMA DOUBLESTAR k=test[expr_contextType.Load])? | DOUBLESTAR k=test[expr_contextType.Load] )? )? @@ -1735,8 +1735,12 @@ INT : // Hex '0' ('x' | 'X') ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ | // Octal - '0' ( '0' .. '7' )* - | '1'..'9' DIGITS* + '0' ('o' | 'O') ( '0' .. '7' )* + | '0' ( '0' .. '7' )* + | // Binary + '0' ('b' | 'B') ( '0' .. '1' )* + | // Decimal + '1'..'9' DIGITS* ; COMPLEX @@ -1755,7 +1759,7 @@ * should make us exit loop not continue. */ STRING - : ('r'|'u'|'ur'|'R'|'U'|'UR'|'uR'|'Ur')? + : ('r'|'u'|'b'|'ur'|'R'|'U'|'B'|'UR'|'uR'|'Ur')? ( '\'\'\'' (options {greedy=false;}:TRIAPOS)* '\'\'\'' | '"""' (options {greedy=false;}:TRIQUOTE)* '"""' | '"' (ESC|~('\\'|'\n'|'"'))* '"' @@ -1769,7 +1773,7 @@ ; STRINGPART - : {partial}?=> ('r'|'u'|'ur'|'R'|'U'|'UR'|'uR'|'Ur')? + : {partial}?=> ('r'|'u'|'b'|'ur'|'R'|'U'|'B'|'UR'|'uR'|'Ur')? ( '\'\'\'' ~('\'\'\'')* | '"""' ~('"""')* ) Modified: trunk/sandbox/wierzbicki/test27/src/org/python/antlr/GrammarActions.java =================================================================== --- trunk/sandbox/wierzbicki/test27/src/org/python/antlr/GrammarActions.java 2009-03-02 15:59:20 UTC (rev 6055) +++ trunk/sandbox/wierzbicki/test27/src/org/python/antlr/GrammarActions.java 2009-03-02 18:12:22 UTC (rev 6056) @@ -350,6 +350,12 @@ if (s.startsWith("0x") || s.startsWith("0X")) { radix = 16; s = s.substring(2, s.length()); + } else if (s.startsWith("0o") || s.startsWith("0O")) { + radix = 8; + s = s.substring(2, s.length()); + } else if (s.startsWith("0b") || s.startsWith("0B")) { + radix = 2; + s = s.substring(2, s.length()); } else if (s.startsWith("0")) { radix = 8; } @@ -415,6 +421,10 @@ int end; boolean ustring = false; + if (quoteChar == 'b' || quoteChar == 'B') { + start++; + } + if (quoteChar == 'u' || quoteChar == 'U') { ustring = true; start++; Modified: trunk/sandbox/wierzbicki/test27/src/org/python/compiler/CodeCompiler.java =================================================================== --- trunk/sandbox/wierzbicki/test27/src/org/python/compiler/CodeCompiler.java 2009-03-02 15:59:20 UTC (rev 6055) +++ trunk/sandbox/wierzbicki/test27/src/org/python/compiler/CodeCompiler.java 2009-03-02 18:12:22 UTC (rev 6056) @@ -2229,10 +2229,6 @@ @Override public Object visitWith(With node) throws Exception { - if (!module.getFutures().withStatementSupported()) { - throw new ParseException("'with' will become a reserved keyword in Python 2.6", node); - } - final Label label_body_start = new Label(); final Label label_body_end = new Label(); final Label label_catch = new Label(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |