summaryrefslogtreecommitdiffstats
path: root/Lib/compiler/transformer.py
Commit message (Collapse)AuthorAgeFilesLines
* #4578: fix has_key() usage in compiler package.Georg Brandl2008-12-151-2/+2
|
* follow-up of issue3473: update the compiler package to recognize the new syntax.Amaury Forgeot d'Arc2008-08-201-26/+24
|
* Issue 2117. Update compiler module to handle class decorators.Facundo Batista2008-02-251-0/+12
| | | | Thanks Thomas Herve
* Patch #2167 from calvin: Remove unused importsChristian Heimes2008-02-231-1/+0
|
* Backport PEP 3110's new 'except' syntax to 2.6.Collin Winter2007-05-181-1/+1
|
* Patch #1638243: the compiler package is now able to correctly compileGeorg Brandl2007-01-271-1/+1
| | | | | a with statement; previously, executing code containing a with statement compiled by the compiler package crashed the interpreter.
* Bug #1441397: The compiler module now recognizes module and functionGeorg Brandl2006-07-291-0/+1
| | | | docstrings correctly as it did in Python 2.4.
* Whitespace normalization.Tim Peters2006-06-271-1/+1
|
* Set lineno correctly on list, tuple and dict literals.Georg Brandl2006-06-221-5/+5
|
* fix [ 1509132 ] compiler module builds incorrect AST for TryExceptFinallyGeorg Brandl2006-06-211-18/+23
|
* Fix errors found by pycheckerNeal Norwitz2006-06-111-2/+0
|
* Bug #1385040: don't allow "def foo(a=1, b): pass" in the compiler package.Georg Brandl2006-05-031-7/+5
|
* Use absolute importsNeal Norwitz2006-04-031-2/+2
|
* Add support for absolute/relative imports and if/else expressions:Thomas Wouters2006-03-031-10/+30
| | | | | | | | | - regenerate ast.py - add future flags for absolute-import and with-statement so they (hopefully) properly get set in code-object flags - try out if/else expressions in actual code for the hell of it. Seems to generate the same kind of bytecode as the normal compiler.
* Fix failure of test_compiler.py when compiling test_contextlib.py.Guido van Rossum2006-03-021-3/+3
| | | | | | The culprit was an expression-less yield -- the first apparently in the standard library. I added a unit test for this. Also removed the hack to force compilation of test_with.py.
* Update the compiler package to compile the with-statement.Guido van Rossum2006-02-281-0/+21
| | | | Jeremy, please review!
* Make or_test similar to test, not testlist.Martin v. Löwis2006-02-271-1/+2
|
* Handle testlist_safe and or_test like testlist.Martin v. Löwis2006-02-271-2/+2
|
* Alias non-terminals introduced for backwards compatibility.Martin v. Löwis2006-02-271-0/+3
|
* Remove unused _callers member. No need for types, use isinstanceNeal Norwitz2005-11-251-5/+2
|
* PEP 342 implementation. Per Guido's comments, the generator throw()Phillip J. Eby2005-08-021-1/+11
| | | | | method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
* patch [ 1231538 ] Typo fix in compiler/transformer.py (WalkerEror)Georg Brandl2005-07-021-11/+11
|
* Flush out support for ``class B(): pass`` syntax by adding support to theBrett Cannon2005-04-091-1/+3
| | | | | | 'parser' module and 'compiler' package. Closes patch #1176012. Thanks logistix.
* Fix bugMichael W. Hudson2004-11-081-2/+2
| | | | [ 1057835 ] compiler.transformer, "from module import *"
* This is jiwon's patch to fix:Michael W. Hudson2004-10-111-1/+6
| | | | [ 1042238 ] Lib/compiler chokes on certain genexps
* Whitespace normalization.Tim Peters2004-09-121-6/+6
|
* Remove debugging print (not triggered by test suite) and add XXX comment ↵Jeremy Hylton2004-09-071-1/+1
| | | | about how the code should raise a SyntaxError.
* compiler.transformer: correct lineno attribute when possibleJeremy Hylton2004-09-071-176/+111
| | | | | | | | | | | | | | | | SF patch #1015989 The basic idea of this patch is to compute lineno attributes for all AST nodes. The actual implementation lead to a lot of restructing and code cleanup. The generated AST nodes now have an optional lineno argument to constructor. Remove the top-level asList(), since it didn't seem to serve any purpose. Add an __iter__ to ast nodes. Use isinstance() instead of explicit type tests. Change transformer to use the new lineno attribute, which replaces three lines of code with one. Use universal newlines so that we can get rid of special-case code for line endings. Use lookup_node() in a few more frequently called, but simple com_xxx methods(). Change string exception to class exception.
* SF patch #1007189, multi-line imports, for instance:Anthony Baxter2004-08-311-32/+44
| | | | | "from blah import (foo, bar baz, bongo)"
* This is Mark Russell's patch:Michael W. Hudson2004-08-171-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ 1009560 ] Fix @decorator evaluation order From the description: Changes in this patch: - Change Grammar/Grammar to require newlines between adjacent decorators. - Fix order of evaluation of decorators in the C (compile.c) and python (Lib/compiler/pycodegen.py) compilers - Add better order of evaluation check to test_decorators.py (test_eval_order) - Update the decorator documentation in the reference manual (improve description of evaluation order and update syntax description) and the comment: Used Brett's evaluation order (see http://mail.python.org/pipermail/python-dev/2004-August/047835.html) (I'm checking this in for Anthony who was having problems getting SF to talk to him)
* Whitespace normalization.Tim Peters2004-08-041-5/+5
|
* PEP-0318, @decorator-style. In Guido's words:Anthony Baxter2004-08-021-7/+59
| | | | | "@ seems the syntax that everybody can hate equally" Implementation by Mark Russell, from SF #979728.
* this is patchMichael W. Hudson2004-07-121-1/+1
| | | | | | | | [ 988698 ] compiler.transformer fix for (a, b) = 1, 2 fixing bug [ 988613 ] compiler.transformer and tuple unpacking
* SF patch #872326: Generator expression implementationRaymond Hettinger2004-05-191-0/+53
| | | | | | | | | | | | | | (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
* SF patch #701494: more apply removalsRaymond Hettinger2003-04-061-1/+1
|
* Whitespace normalization.Tim Peters2003-03-071-1/+1
|
* Remove debugging prints.Michael W. Hudson2003-01-031-2/+0
|
* SF patch [ 597919 ] compiler package and SET_LINENOJeremy Hylton2002-12-311-3/+29
| | | | | | | | | | | | | | | | | A variety of changes from Michael Hudson to get the compiler working with 2.3. The primary change is the handling of SET_LINENO: # The set_lineno() function and the explicit emit() calls for # SET_LINENO below are only used to generate the line number table. # As of Python 2.3, the interpreter does not have a SET_LINENO # instruction. pyassem treats SET_LINENO opcodes as a special case. A few other small changes: - Remove unused code from pycodegen and pyassem. - Fix error handling in parsermodule. When PyParser_SimplerParseString() fails, it sets an exception with detailed info. The parsermodule was clobbering that exception and replacing it was a generic "could not parse string" exception. Keep the original exception.
* Remove uses of string module and stat.ST_MODENeal Norwitz2002-06-061-2/+1
|
* Fix com_arglist() and update grammar fragment.Jeremy Hylton2002-04-191-6/+3
| | | | | | | | | | | | | | | | | SF bug #522264 reported by Evelyn Mitchell. The code included a comment about "STAR STAR" which was translated into the code as the bogus attribute token.STARSTAR. This name never caused an attribute error because it was never retrieved. The code was based on an old version of the grammar that specified kwargs as two tokens ('*' '*'). I checked as far back as 2.1 and didn't find this production. The fix is simple, because token.DOUBLESTAR is the only token allowed. Also update the grammar fragment in com_arglist(). XXX I'll bet lots of other grammar fragments in comments are out of date, probably in this module and in compile.c.
* Patch #522279: transformer.py nodes shadows global.Martin v. Löwis2002-02-281-3/+3
|
* Merge of the release22 branch changes back into the trunk.Barry Warsaw2001-12-211-1/+1
|
* Whitespace normalization.Tim Peters2001-10-181-9/+9
|
* Handle testlist_safe as if it were testlist.Jeremy Hylton2001-10-171-0/+4
|
* API change:Jeremy Hylton2001-09-171-2/+8
| | | | | | | | | | | | | | | | | | compile() becomes replacement for builtin compile() compileFile() generates a .pyc from a .py both are exported in __init__ compiler.parse() gets optional second argument to specify compilation mode, e.g. single, eval, exec Add AbstractCompileMode as parent class and Module, Expression, and Interactive as concrete subclasses. Each corresponds to a compilation mode. THe AbstractCompileMode instances in turn delegate to CodeGeneration subclasses specialized for their particular functions -- ModuleCodeGenerator, ExpressionCodeGeneration, InteractiveCodeGenerator.
* Last set of change to get regression tests to passJeremy Hylton2001-09-171-0/+4
| | | | | | | | | | | Remove the only test in the syntax module. It ends up that the transformer must handle this error case. In the transformer, check for a list compression in com_assign_list() by looking for a list_for node where a comma is expected. In pycodegen.compile() re-raise the SyntaxError rather than catching it and exiting
* Make sure that atoms (Tuple, List, etc.) have lineno attributesJeremy Hylton2001-08-291-2/+4
|
* Add support for // and //=.Jeremy Hylton2001-08-291-5/+16
| | | | | | | | Avoid if/elif/elif/else tests where the final else is supposed to handle exactly one case instead of all other cases. When the list of operators is extended, the catchall else treats all new operators as the last operator in the set of tests. Instead, raise an exception if an unexpected operator occurs.
* Don't include doc string of class in its code childJeremy Hylton2001-08-291-0/+5
|
* Add lookup_name() to optimize use of stack framesJeremy Hylton2001-08-271-5/+21
| | | | | | | | | | | | The use of com_node() introduces a lot of extra stack frames, enough to cause a stack overflow compiling test.test_parser with the standard interpreter recursionlimit. The com_node() is a convenience function that hides the dispatch details, but comes at a very high cost. It is more efficient to dispatch directly in the callers. In these cases, use lookup_node() and call the dispatched node directly. Also handle yield_stmt in a way that will work with Python 2.1 (suggested by Shane Hathaway)