Commit Graph

1250 Commits

Author SHA1 Message Date
Guido van Rossum
342d8f7780 Update outdated text about how to fix the font. 2001-10-08 22:49:12 +00:00
Jeremy Hylton
eaa6e3c712 Replace all instances of err.strerror with err.
The strerror attribute contained only partial information about the
exception and produced some very confusing error messages.  By passing
err (the exception object itself) and letting it convert itself to a
string, the error messages are better.
2001-10-08 20:33:20 +00:00
Tim Peters
ba001a0b67 Changed the reindenter to strip only trailing spaces and tabs from lines,
not other control characters string.rstrip() got rid of.  This caters to
the \f thingies Barry likes putting in Python source files.
2001-10-04 19:44:10 +00:00
Fred Drake
19405a4a2a Removed files no longer needed. 2001-09-28 17:22:35 +00:00
Tim Peters
2c9aa5ea8d Generalize file.writelines() to allow iterable objects. 2001-09-23 04:06:05 +00:00
Tim Peters
42b6877293 Fix restore (difflib.restore() became a generator too). 2001-09-22 21:59:18 +00:00
Tim Peters
8a9c284437 Make difflib.ndiff() and difflib.Differ.compare() generators. This
restores the 2.1 ability of Tools/scripts/ndiff.py to start producing
output before the entire comparison is complete.
2001-09-22 21:30:22 +00:00
Jeremy Hylton
fe148c80b7 Update description of Tools/compiler 2001-09-20 15:27:30 +00:00
Jeremy Hylton
5953b40442 Remove setup.py, unnecessary since compiler package is the std
library.

Update README.
2001-09-20 15:02:27 +00:00
Jeremy Hylton
e54b5b4f81 Moved to Tools/compiler along with astgen.py 2001-09-20 14:59:00 +00:00
Jeremy Hylton
b3c569ce82 The compiler package is now part of the standard library.
Remove all these files.  All except astgen.py are moved to Lib/compiler.
2001-09-20 01:27:40 +00:00
Jeremy Hylton
5d1e34aa42 Track changes to compiler API 2001-09-17 21:31:35 +00:00
Jeremy Hylton
9dca36432e API change:
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.
2001-09-17 21:02:51 +00:00
Jeremy Hylton
c8ed18a4e3 Re-created after change to astgen to calculate hardest_arg correctly 2001-09-17 20:17:02 +00:00
Jeremy Hylton
eab4328f1a Fix calculation of hardest_arg.
The argument properties are ordered from easiest to hardest.  The
harder the arg, the more complicated that code that must be generated
to return it from getChildren() and/or getChildNodes().  The old
calculation routine was bogus, because it always set hardest_arg to
the hardness of the last argument.  Now use max() to always set it to
the hardness of the hardest argument.
2001-09-17 20:16:30 +00:00
Jeremy Hylton
2e4cc7e0d8 Last set of change to get regression tests to pass
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
2001-09-17 19:33:48 +00:00
Jeremy Hylton
bf80a033ee Add -p option to invoke Python profiler 2001-09-17 18:08:40 +00:00
Jeremy Hylton
ce0c19c4a8 Only print attributes that start with co_.
If passed a .py file as an argument, try to find its accompanying
.pyc.
2001-09-17 18:08:20 +00:00
Jeremy Hylton
37c9351cf6 Handle more syntax errors.
Invoke compiler.syntax.check() after building AST.  If a SyntaxError
occurs, print the error and exit without generating a .pyc file.

Refactor code to use compiler.misc.set_filename() rather than passing
filename argument around to each CodeGenerator instance.
2001-09-17 18:03:55 +00:00
Jeremy Hylton
09392b77a4 Add utility to set filename attribute on all nodes 2001-09-17 18:02:21 +00:00
Jeremy Hylton
aee0bfedcc support true division 2001-09-17 16:41:02 +00:00
Tim Peters
a2e2dbe8cd Improve handling of docstrings. I had feared this was a case of
introspection incompatibility, but in fact it's just that calltips
always gave up on a docstring that started with a newline (but
didn't realize they were giving up <wink>).
2001-09-16 02:19:49 +00:00
Jeremy Hylton
1048aa933f Add code generator for yield stmt 2001-09-14 23:17:55 +00:00
Jeremy Hylton
6a9cac68b6 del no longer necessary now that new module is gone 2001-09-14 22:54:48 +00:00
Jeremy Hylton
1e99a77120 Various sundry changes for 2.2 compatibility
Remove the option to have nested scopes or old LGB scopes.  This has a
large impact on the code base, by removing the need for two variants
of each CodeGenerator.

Add a get_module() method to CodeGenerator objects, used to get the
future features for the current module.

Set CO_GENERATOR, CO_GENERATOR_ALLOWED, and CO_FUTURE_DIVISION flags
as appropriate.

Attempt to fix the value of nlocals in newCodeObject(), assuming that
nlocals is 0 if CO_NEWLOCALS is not defined.
2001-09-14 22:49:08 +00:00