Commit Graph

1680 Commits

Author SHA1 Message Date
Skip Montanaro 557fe7541d new script - helps track down symbols exported by modules but not
mentioned in the library reference manual
2002-03-28 22:01:40 +00:00
Skip Montanaro 9a29e7aba3 operate as a filter when no files or directories appear on the command line 2002-03-26 11:39:26 +00:00
Fredrik Lundh b622a81e56 use -kb on idle/Icons/minusnode.gif ("cvs up" kept checking it out all
the time...)
2002-03-18 21:43:04 +00:00
Jack Jansen 89dbd97279 Some structures should be passed to Py_BuildValue by reference, not by value,
notably FSSpec and FSRef objects. First half of fix for #531291.

2.2.1 candidate.
2002-03-18 15:24:22 +00:00
Martin v. Löwis 73e618734d Patch #512466: Script to move faqwiz entries. 2002-03-18 08:56:23 +00:00
Andrew M. Kuchling 566c0c737f [Bug #512799] urllib.splittype() returns a 2-tuple. (Reported by seb bacon) 2002-03-08 17:19:10 +00:00
Guido van Rossum 30efbccee4 Fix by Edward K Ream to make breakpoints work on Windows: insert a
missing call to self.canonic().
2002-02-25 23:11:03 +00:00
Martin v. Löwis dc13517586 Patch #520483: Make IDLE OutputWindow handle Unicode.
2.2.1 candidate.
2002-02-23 22:39:37 +00:00
Tim Peters 54e5b89d77 SF bug #497839: reindent chokes on empty first lines.
Reindenter.run():  copy over initial all-whitespace lines (if any, and
after normalizing to remove trailing blanks and tabs).
Bugfix candidate.
2002-02-17 07:03:05 +00:00
Barry Warsaw 56ab9214c9 Added a module docstring, which doubles as the --help text.
Added a bunch of command line options to make the script more
generic.
2002-02-08 23:25:46 +00:00
Guido van Rossum 65f50156cd www.google.com is better than google.com. 2002-02-08 16:20:07 +00:00
Tim Peters bd8ce79390 smart_backspace_event(): remove now-pointless int() call.
Bugfix candidate:  the current state of AutoIdent.py should be in 2.2.1.
2002-01-23 16:57:55 +00:00
Guido van Rossum 64e9d61a1e Properly fix SF bug #507298 (Gregor Lingl): shellpython2.2 -Qnew smart
indent error

Use // where int division is intended.  (This breaks IDLE for use with
previous Python versions -- I don't care.)
2002-01-23 15:15:13 +00:00
Tim Peters 4509168dbf classifyws(): Fix a "/" to work under -Qnew (as well as without it).
Bugfix candidate!
2002-01-23 05:02:20 +00:00
Jack Jansen dcfc20282b Added some support for Uicode arguments. Still leaves something to be desired, especially because of poor unicode support in PyArg_ParseTuple. 2002-01-01 22:40:08 +00:00
Jack Jansen f1472384dc Updated to current pathnames. 2002-01-01 22:39:07 +00:00
Jack Jansen 9aaee933da Patches by Jens B. Jorgensen with small mods by me:
- Converted the templates to use ANSI C prototypes (finally!)
- Use re in stead of deprecated regex
2001-12-27 23:35:43 +00:00
Jack Jansen 6f4f8c7fe1 Small change to allow for generation of QuickTime module for Windows. 2001-12-18 15:48:28 +00:00
Just van Rossum b48f1d3f8a OSX tweak: recognize both EXTERN_API_C and EXTERN_API declarations.
Jack: I hope I didn't break anything for you!
2001-12-12 20:51:22 +00:00
Guido van Rossum f0953b9dff Fix SF bug #482171: webchecker dies on file: URLs w/o robots.txt
The cause seems to be that when a file URL doesn't exist,
urllib.urlopen() raises OSError instead of IOError.  Simply add this
to the except clause.  Not elegant, but effective. :-)
2001-12-11 22:41:24 +00:00
Jack Jansen 5801a2d8e3 The module generator now tells its object generators about the module name (through the new setmodulename() method). If the module name has been set the object generators output it as part of the tp_name field for the object type. 2001-12-09 23:25:00 +00:00
Guido van Rossum 436fd75b4a Warning message about unfound file was missing trailing \n. 2001-12-06 03:28:17 +00:00
Guido van Rossum e51c3f5ecb SF patch #489680 (David Abrahams): h2py uses nonexistent method splitfields() 2001-12-06 03:24:30 +00:00
Guido van Rossum d3d8a1df5c A tiny but useful script that fires off a search on Google.
(Not sure if this is legal according to the Google terms of service. :-)
2001-12-04 15:23:47 +00:00
Jack Jansen b3be216b41 Merged changes made on r22b2-branch between r22b2 and r22b2-mac (the
changes from start of branch upto r22b2 were already merged, of course).
2001-11-30 14:16:36 +00:00
Guido van Rossum a30eacf458 Checking in Zooko's version per SF patch #476866, plus my changes to
the usage docs: (a) align properly, (b) explain properly.
2001-11-28 19:41:45 +00:00
Jack Jansen 1062e706e5 Don't initialize tp_type statically, it won't work on Windows. Spotted
by Thomas Heller (patch 459442).
2001-11-14 15:48:13 +00:00
Jack Jansen fc6a89270e Don't override asplit_pat in Scanner_UH3. No reason to do so, and it broke
generating Waste.
2001-10-30 13:11:24 +00:00
Guido van Rossum 03f7f08874 Part 2/2 of SF patch #416704: More robust freeze, by Toby Dickenson.
(With slight cosmetic improvements to shorten lines and a grammar fix
to a docstring.)

This addes -X and -E options to freeze.  From the docstring:

-X module     Like -x, except the module can never be imported by
              the frozen binary.

-E:           Freeze will fail if any modules can't be found (that
              were not excluded using -x or -X).
2001-10-18 19:15:32 +00:00
Jeremy Hylton b8903fbf9b Test utility to look for bad stacksize calculations. 2001-10-17 13:39:06 +00:00
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
Jeremy Hylton 652a22437a The object-being sliced in an assignment to a slice is referenced, not
bound.

When a Yield() node is visited, assign to the generator attribute of
the scope, not the visitor.
2001-09-14 22:45:57 +00:00
Jeremy Hylton 9ee78f7d61 the new new doesn't define CO_xxx as the old new did 2001-09-14 22:44:35 +00:00
Jeremy Hylton fff252d20d the names attribute of Global is not a node 2001-09-14 22:40:36 +00:00
Mark Hammond 773c83be04 Fix for bug #442374 - Modulefinder registry support broken 2001-09-05 23:42:36 +00:00
Jack Jansen 5a1516bce5 Only output the buffer size error label if it is used.
Shuts up another couple of gcc warnings.
2001-09-05 10:27:53 +00:00
Jack Jansen d157b3795b Don't use a default "int" return type, gcc gives a warning about it. 2001-09-04 22:16:33 +00:00
Guido van Rossum a0ca3d611e - Reverse the meaning of the -m option: warnings about multiple /
operators per line or statement are now on by default, and -m turns
  these warnings off.

- Change the way multiple / operators are reported; a regular
  recommendation is always emitted after the warning.

- Report ambiguous warnings (both int|long and float|complex used for
  the same operator).

- Update the doc string again to clarify all this and describe the
  possible messages more precisely.
2001-09-04 16:22:01 +00:00
Tim Peters 83e7ccc9fd Whitespace normalization. 2001-09-04 06:37:28 +00:00
Guido van Rossum 1832de4bc0 PEP 238 documented -Qwarn as warning only for classic int or long
division, and this makes sense.  Add -Qwarnall to warn for all
classic divisions, as required by the fixdiv.py tool.
2001-09-04 03:51:09 +00:00
Guido van Rossum 61c345fa37 Rename the -D option to -Q, to avoid a Jython option name conflict. 2001-09-04 03:26:15 +00:00
Guido van Rossum e7a95983b0 Implement what the docstring said: multiple slashes per line are
treated the same as single ones by default.  Added -m option to issue
a warning for this case instead.
2001-09-02 14:11:30 +00:00
Guido van Rossum 13c51ecb8c Added more text to the docstring, updated the way the exit status is
percolated out, and some general cleanup.  The output is still the
same, except it now prints "Index: <file>" instead of "Processing:
<file>", so that the output can be used as input for patch (but only
the diff-style parts of it).
2001-09-02 04:49:36 +00:00
Guido van Rossum 43db62e263 A grep-like tool that looks for division operators. 2001-09-02 04:43:30 +00:00
Guido van Rossum 822218b400 The beginnings of a script to help finding / operators that may need
to be change to //.  The code is pretty gross so far, and I promise
I'll work on this more, but I have to go eat now! :-)
2001-09-01 21:55:58 +00:00
Jeremy Hylton 71ebc3359b Fix _convert_NAME() so that it doesn't store locals for class bodies.
Fix list comp code generation -- emit GET_ITER instead of Const(0)
after the list.

Add CO_GENERATOR flag to generators.

Get CO_xxx flags from the new module
2001-08-30 20:25:55 +00:00
Jeremy Hylton f71b5fec43 spurious pop 2001-08-30 15:50:34 +00:00
Jeremy Hylton e4685ec57e Track the block stack more reasonably in order to handle continue in
try/except or try/finally.

Previous versions had only track SETUP_LOOP blocks and ignored the
exception part.  This meant that it allowed continue inside a
try/except but generated buggy code.  Now it does the right thing.
2001-08-29 22:30:09 +00:00
Jeremy Hylton 9263848fa1 Improve stack depth computation for try/except and try/finally
Add CONTINUE_LOOP to the list of unconditional transfers
2001-08-29 22:27:14 +00:00
Jeremy Hylton 4bd4dddd55 Add __getitem__() handler for use by visitContinue() 2001-08-29 22:26:35 +00:00
Jeremy Hylton 1936745668 Generate SET_LINENO for list and tuple literals when the open paren
starts a new line.

Also fix undetected typo in visitDict() -- uncovered by recent change
to add lineno attrs to atoms.
2001-08-29 20:57:43 +00:00
Jeremy Hylton 7845cf8d37 Make sure that atoms (Tuple, List, etc.) have lineno attributes 2001-08-29 20:56:30 +00:00
Jeremy Hylton 4ba9001f5c Fix off-by-one errors in code to find depth of stack.
XXX The code is still widely inaccurate, but most (all?) of the time
it's an overestimate.
2001-08-29 20:55:17 +00:00
Jeremy Hylton bf77c465bd Undo change from list to dict for handling varnames, consts, etc.
As the doc string for _lookupName() explains:

    This routine uses a list instead of a dictionary, because a
    dictionary can't store two different keys if the keys have the
    same value but different types, e.g. 2 and 2L.  The compiler
    must treat these two separately, so it does an explicit type
    comparison before comparing the values.
2001-08-29 19:45:33 +00:00
Jeremy Hylton 5a9ac97040 Change default() to use getChildNodes() instead of getChildren() 2001-08-29 18:17:22 +00:00
Jeremy Hylton 94afe32b5e Support // and //=
Generate SET_LINENO for del statements.

Define klass=1 for PyFlowGraph constructor for a class statement.  A
class has no varnames.
2001-08-29 18:14:39 +00:00
Jeremy Hylton 7abf520d6c Add support for // and //=.
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.
2001-08-29 18:12:30 +00:00
Jeremy Hylton d4be10dc2c Add generator detection to symbol table.
Fix bug in handling of statements like "l[x:y] = 2".  The visitor was
treating this as assignments to l, x, and y!
2001-08-29 18:10:51 +00:00
Jeremy Hylton e4e9cd4c01 Modify name conversion to be (hopefully) a bit more efficient.
Use a dictionary instead of a list to map objects to their offsets in
a const/name tuple of a code object.

XXX The conversion is perhaps incomplete, in that we shouldn't have to
do the list2dict to start.
2001-08-29 18:09:50 +00:00
Jeremy Hylton 5477f529d6 Revise implementations of getChildren() and getChildNodes().
Add support for floor division (// and //=)

The implementation of getChildren() and getChildNodes() is intended to
be faster, because it avoids calling flatten() on every return value.
But it's not clear that it is a lot faster, because constructing a
tuple with just the right values ends up being slow.  (Too many
attribute lookups probably.)

The ast.txt file is much more complicated, with funny characters at
the ends of names (*, &, !) to indicate the types of each child node.

The astgen script is also much more complex, making me wonder if it's
still useful.
2001-08-29 18:08:02 +00:00
Jeremy Hylton da8db8ca18 Don't include doc string of class in its code child 2001-08-29 17:19:02 +00:00
Jeremy Hylton 2ac9c3eec5 Make sure the JUMP_ABSOLUTE and POP_BLOCK at the end of a for loop are
contiguous.
2001-08-28 17:28:33 +00:00
Jeremy Hylton 63db7b9ca1 XXX_NAME ops should affect varnames
varnames should list all the local variables (with arguments first).
The XXX_NAME ops typically occur at the module level and assignment
ops should create locals.
2001-08-28 16:36:12 +00:00
Jeremy Hylton f354575328 Generate FOR_ITER-based loops instead of old FOR_LOOP-based loops 2001-08-28 16:35:18 +00:00
Jeremy Hylton c59e220000 Handle private names
(Hard to believe these were never handled before)

Add misc.mangle() that mangles based on the rules in compile.c.
XXX Need to test the corner cases

Update CodeGenerator with a class_name attribute bound to None.  If a
particular instance is created within a class scope, the instance's
class_name is bound to that class's name.

Add mangle() method to CodeGenerator that mangles if the class_name
has a class_name in it.

Modify the FunctionCodeGenerator family to handle an extra argument--
the class_name.

Wrap all name ops and attrnames in calls to self.mangle()
2001-08-27 22:56:16 +00:00
Jeremy Hylton 80ea40d858 emit SET_LINENO for augmented assignments 2001-08-27 21:58:09 +00:00
Jeremy Hylton 2afff324ea Many changes -- bug fixes and sundry improvements
Make nested scopes enabled by default

Add is_constant_false() helper so that compiled code and symbols are
consistent with builtin compiler's handling of "if 0:"

Fix doc string handling to be consistent with recent change that
eliminates the doc string from the Module's node attribute.

Add fix to print handling from Evan & Shane.

Track change to visitor api by making "verbose" explicit.

Comment out setting CO_NESTED flag (it's unnecessary in 2.2).
2001-08-27 21:51:52 +00:00
Jeremy Hylton cd8a127e1a Fix for sibling nodes that define the same free variable
Evan Simpson's fix.  And his explanation:

    If you defined two nested functions in a row that refer to the
    same non-global variable, the second one will be generated as
    though the variable were global.
2001-08-27 21:06:35 +00:00
Jeremy Hylton 7e30c9bb5a Add lookup_name() to optimize use of stack frames
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)
2001-08-27 21:02:51 +00:00
Jeremy Hylton 058a5adad0 Two changes to visitor API:
Remove _preorder as alias for dispatch and call dispatch directly.
    Add an extra optional argument to walk()

XXX Also comment out some code that does debugging prints.
2001-08-27 20:47:08 +00:00
Jeremy Hylton cccc478577 Why didn't I think of Fred off the top of my head? 2001-08-27 20:44:20 +00:00
Jeremy Hylton 627673396a Add everyone I can think of off the top of my head 2001-08-27 20:43:16 +00:00
Jeremy Hylton 2a8ec79353 Revise regrtest to compile entire standard library.
The tests are run from a copy of the library directory, where
everything has been compiled by the compiler package.

Add a raw_input() call at the end of the script, so that I can check
the output before the temp directory with the compiled code is
removed.
2001-08-27 20:40:43 +00:00
Jeremy Hylton 33c2a627f1 Add -c option to continue if one file has a SyntaxError 2001-08-27 20:39:21 +00:00
Jack Jansen 9403591014 Fixes by Thomas Heller:
- make the selftests work again (they were apparently not used since
  very early in bgen's development), with some minor cleanup by me
- make emacs python mode happier
2001-08-27 14:30:55 +00:00
Barry Warsaw e98e462dab Bump to version 1.3. Also document the new behavior of the chip widgets. 2001-08-23 16:15:21 +00:00
Barry Warsaw 924ea05e45 Bump to version 1.3 2001-08-23 16:15:02 +00:00
Barry Warsaw e47e97792a Implement some suggestions by Laura Creighton.
ChipWidget.__init__(): Added a message area just below the color
    name.  Both the message and name widgets are now FLAT, DISABLED
    Entry widgets instead of Labels.  This allows users to
    copy-n-paste the color names or color specs.  Also, the contents
    of both widgets are now driven by StringVars.

set_color(): This only sets the chip color; it does not set the name
    widgets.

set_name(): New method which only sets the name widget contents.

set_message(): New method which only sets the message widget contents.

ChipViewer.update_yourself(): Set the color, name, and message for
    each chip as follows: the first line always contains the color
    spec in #rrggbb format.  The second line will contain the color
    name, but slightly differently for each widget.  For the Selected
    widget, if the color exactly matches the Nearest color, the name
    is shown, otherwise the message field will be empty.  The name
    field of the Nearest widget will always contain the color name.
2001-08-23 16:14:45 +00:00
Jeremy Hylton 241d69c11b Add a little introductory text.
Change several sections to subsections (part of the manual -> howto
transformation).

Flesh out discussion of assignment nodes (and delete statements).

Add an example of manipulating AST objects at a >>> prompt
2001-08-18 00:24:46 +00:00
Jeremy Hylton ab427b8cce Generate correct reprs for Mul, Add, etc. 2001-08-18 00:14:37 +00:00
Jeremy Hylton ec5bfd13ca Track removal of doc string from Module().nodes[0] 2001-08-18 00:07:46 +00:00
Jeremy Hylton 8548f9b183 Add Yield() node 2001-08-18 00:07:14 +00:00
Jeremy Hylton ec927348c2 Add Yield() statement handler
Fix Module() handler to avoid including the doc string in the AST
2001-08-18 00:04:31 +00:00
Fred Drake 4e6a3fe0f6 Remove spurious space before a period. 2001-08-15 18:48:10 +00:00
Fred Drake 834a85a235 Use the "howto" document class rather than the "manual" class.
Remove the module index; there aren't enough modules documented yet
for this to make sense.

Add a couple more index entries, fixed a few typos, and adjusted a few
more things for consistency.
2001-08-15 17:01:34 +00:00
Fred Drake 27413a5eda Properly mark attribute names in the table. 2001-08-15 16:47:10 +00:00
Fred Drake 3d05161c83 Change the generated markup so that attribute names are properly marked. 2001-08-15 16:46:22 +00:00
Fred Drake 42caf3f6a3 Fix small markup consistency nits. 2001-08-15 14:35:13 +00:00
Tim Peters ebb7133f4f Fix typo in module docstring. 2001-08-15 06:07:42 +00:00
Jeremy Hylton f5bf77c3f8 update simple explanation of parseFile() 2001-08-14 22:38:03 +00:00
Jeremy Hylton 76f42ac512 First day's progress on documentation 2001-08-14 22:04:44 +00:00
Jeremy Hylton 9272b14d62 Fix typo in astgen script 2001-08-14 21:18:30 +00:00
Jeremy Hylton 7713ac2ff1 Regenerated from new ast.txt and new astgen.py 2001-08-14 18:59:01 +00:00
Jeremy Hylton eef65908a1 Add getChildNodes() method to Node 2001-08-14 18:58:00 +00:00
Jeremy Hylton 34aeeffb62 Add Yield node 2001-08-14 18:57:43 +00:00
Andrew M. Kuchling 392aa1de1d Update e-mail address 2001-08-13 15:10:54 +00:00
Tim Peters 3055ad234a + A msg on c.l.py reminded me that docstrings can be implicitly catenated.
Cater to that.
+ Major speed boost via not reading more of files than necessary.  This
  was no slouch before; now it screams.
+ Improve msg when giving up on a goofy future statement.
2001-08-13 05:33:53 +00:00
Tim Peters 5e824c37d3 SF patch #445412 extract ndiff functionality to difflib, from
David Goodger.
2001-08-12 22:25:01 +00:00
Tim Peters b704238a6c Tool to delete (or just rewrite parts of) obsolete future statements. 2001-08-12 08:41:13 +00:00
Guido van Rossum 38507ae614 Finally fix SF bug #441172, using a variant of patch ##443626:
canceling an edit operation would not revert the value of the field.
The fix takes care to destroy the Entry object, as suggested in the
patch.
2001-08-11 04:37:07 +00:00
Martin v. Löwis f2f8c51ae6 When representing #includes as imports, do from MOD import *. 2001-08-09 12:32:10 +00:00
Martin v. Löwis 4f85bf3311 Patch #437683: Use re instead of regex.
If multiple header files are processed simultaneously which include each
other, the corresponding modules mport each other. Specifically, if h2py
is invoked with sys/types.h first, later header files won't contain the
complete contents of TYPES.py.
2001-08-09 12:24:38 +00:00
Martin v. Löwis 6113d352a6 Patch #422471: Install IDLE Help File 2001-08-08 20:26:14 +00:00
Andrew M. Kuchling 564165e5c5 Added README to this directory 2001-08-08 19:10:11 +00:00
Guido van Rossum 44b1e7d840 Fix for SF bug #448835.
Fix this to work with the new (still undocumented) tabnanny API.

I'm afraid Stephen will have to add this fix to the IDLE fork code
base as well.
2001-08-07 17:15:36 +00:00
Andrew M. Kuchling 5dd064aac3 Tabify the file (pointed out by Thomas Wouters) 2001-08-06 19:33:52 +00:00
Andrew M. Kuchling ce2f4037ba Update listing of subdirectories
Update link to a running instance of the FAQwizard
2001-08-06 18:55:22 +00:00
Jack Jansen 1fbad002d7 Oops, this file was apparently never added to the repository. Now it is. 2001-08-06 10:08:56 +00:00
Tim Peters 45e5e72eb8 Rename pydoc.pyw to pydocgui.pyw: Since we changed Python to allow .pyw
files to satisfy imports, pydoc.pyw was just importing itself!
2001-08-05 05:43:20 +00:00
Barry Warsaw 63ce5af496 Added the -X/--no-docstrings flag which takes a filename containing a
list of files to not extract docstrings from when the -D option is
given.  This isn't optimal, but I didn't want to change the semantics
of -D, and it's bad form to allow optional switch arguments.

Bumping __version__ to 1.4.

TokenEater.__init__(): Initialize __curfile to None.

__waiting(): In order to extract docstrings from the module, both the
    -D flag should be set, and the __curfile should not be named in
    the -X filename (i.e. it isn't in opts.nodocstrings).

set_filename(): Fixed a bug where once the first module docstring is
    extracted, no subsequent module docstrings will be extracted.  The
    bug was that the first extraction set __freshmodule to 0, but that
    flag was never reset back to 1.  set_filename() is always called
    when the next file is being processed, so use it to reset the
    __freshmodule flag.

main(): Add support for -X/--no-docstring.
2001-07-27 16:47:18 +00:00
Fred Drake 79e75e1916 Use string.ascii_letters instead of string.letters (SF bug #226706). 2001-07-20 19:05:50 +00:00
Fred Drake cd694c44a9 Use string.ascii_letters instead of string.letters (SF bug #226706).
Move computation of sets of characters out of the body of the function that
uses them.
2001-07-20 18:58:42 +00:00
Jack Jansen 3d3a91c188 Oops, left in a debug statement. It's gone now. 2001-07-17 20:44:50 +00:00
Jack Jansen b2a1de4679 Allow [] after a parameter name. We currently take this to be the same as * in front, which isn't 100% correct but good enough. 2001-07-13 22:28:36 +00:00
Barry Warsaw 780028e14c Change the way hex type-ins are displayed. The old way was way too
fragile.  Now the leading "0x" on hex numbers are displayed as labels
and the type-in entry fields just accept the hex digits.  Be sure to
strip off the "0x" string when displaying hex values too.

Also, de-string-module-ification, and other Python 2.x improvements.
2001-07-10 21:50:44 +00:00
Barry Warsaw ffa926d77e __init__(), save_views(): Catch ValueError along with IOError and
EOFError so any failures in unmarshalling are just ignored.  Use
print>> instead of sys.stderr.write().
2001-07-10 21:48:51 +00:00
Barry Warsaw 698c14936a Update a comment. 2001-07-10 21:45:27 +00:00
Barry Warsaw 179048fc5d __init__(): Use augmented assignments. 2001-07-10 21:44:59 +00:00
Barry Warsaw 8e4fa072f7 De-string-module-ification. 2001-07-10 21:44:24 +00:00
Barry Warsaw 60e1886e87 __version__: Bump to 1.2
De-string-module-ification.
2001-07-10 21:42:04 +00:00
Barry Warsaw 95cf9d9f4e __populate(): Use augmented assignments. 2001-07-10 21:39:41 +00:00
Barry Warsaw b4d8612f2b __delta(): Use augmented assignments. 2001-07-10 21:39:18 +00:00
Barry Warsaw 6c50ae0801 De-string-module-ification and other Python 2.x improvements. 2001-07-10 21:38:47 +00:00
Barry Warsaw 2803046992 Update a comment. 2001-07-10 21:37:28 +00:00
Barry Warsaw 3e481de337 Updated documentation, and bump the version number to 1.2. 2001-07-10 21:37:04 +00:00
Guido van Rossum 4269601f5c Amazing. A very subtle change in policy in descr-branch actually
found a bug here.  Here's the deal:

Class PyShell derives from class OutputWindow.  Method PyShell.close()
wants to invoke its parent method, but because PyShell long ago was
inherited from class PyShellEditorWindow, it invokes
PyShelEditorWindow.close(self).  Now, class PyShellEditorWindow itself
derives from class OutputWindow, and inherits the close() method from
there without overriding it.  Under the old rules,
PyShellEditorWindow.close would return an unbound method restricted to
the class that defined the implementation of close(), which was
OutputWindow.close.  Under the new rules, the unbound method is
restricted to the class whose method was requested, that is
PyShellEditorWindow, and this was correctly trapped as an error.
2001-07-06 20:26:31 +00:00
Jack Jansen eefac35594 Added WeakLink...Generator classes (should have done that ages ago). These check the c-function pointer for being NULL before calling it and raise UnimplementedError if it is.
This allows system libs to be weak-linked, thereby allowing us to generate functions that are only available on some OS versions without getting a NULL dereference if the function isn't available.
2001-07-01 22:09:29 +00:00
Jack Jansen 1319abf745 Make basechain a class variable in stead of initializing it in __init__. That way it's more easily overridden. 2001-06-28 22:07:30 +00:00
Jack Jansen 4f0f1584fb Added a couple more types that Apple has taken a fancy to. 2001-06-27 21:58:40 +00:00
Jack Jansen ff1cc902fe Added a Parser_OSX class that can parse new-style (C-only) headers,
such as the Core Foundation ones.
2001-06-26 21:53:25 +00:00
Guido van Rossum 9966e2c663 This is a trivial command line utility to print MD5 checksums.
I published it on the web as http://www.python.org/2.1/md5sum.py
so I thought I might as well check it in.

Works with Python 1.5.2 and later.

Works like the Linux tool ``mdfsum file ...'' except it doesn't take
any options or read stdin.
2001-06-22 16:05:48 +00:00
Barry Warsaw 5c94ce58e7 write(): Karl Eichwalder points out that the #, flag comments should
be outputted just before the msgid lines.
2001-06-20 19:41:40 +00:00
Barry Warsaw 8c78d3a5d1 write(): It's been generally agreed on the i18n-sig that the docstring
marker should be output as a #, flag, e.g. "#, docstring".
2001-06-19 19:54:19 +00:00
Tim Peters 82ac8d13ff Taught IDLE's autoident parser that "yield" is a keyword that begins a
stmt.  Along w/ the preceding change to keyword.py, making all this work
w/ a future-stmt just looks harder and harder.
2001-06-19 00:28:47 +00:00
Guido van Rossum ac4797a12e Make copy, cut and paste events case insensitive. Reported by Patrick
K. O'Brien on idle-dev.

(Should other bindings follow suit?)
2001-06-12 00:30:33 +00:00
Tim Peters 2a7f384122 SF bug 430991: wrong co_lnotab
Armin Rigo pointed out that the way the line-# table got built didn't work
for lines generating more than 255 bytes of bytecode.  Fixed as he
suggested, plus corresponding changes to pyassem.py, plus added some
long overdue docs about this subtle table to compile.c.

Bugfix candidate (line numbers may be off in tracebacks under -O).
2001-06-09 09:26:21 +00:00
Martin v. Löwis a4debfffc9 Patch #430754: Makes ftpmirror.py .netrc aware 2001-06-07 17:17:00 +00:00
Guido van Rossum d993c87918 Quick update to the extension mechanism (extend.py is gone, long live
config.txt).

*** This is a bugfix-release candidate (for 2.1.1 and 2.0.1)! ***
2001-06-04 21:21:11 +00:00
Neil Schemenauer 89e90d67aa Separate CFLAGS and CPPFLAGS. CFLAGS should not contain preprocessor
directives, which is the role of CPPFLAGS.  Closes SF patch #414991.
2001-06-02 06:16:02 +00:00
Barry Warsaw 50cf706b5c write(): Aggressively sort all catalog entries, and fix the bug where
there were multiple translatable strings on a single line of source
code.
2001-05-24 23:06:13 +00:00
Barry Warsaw 128c77d03a write(): Do two levels of sorting: first sort the individual location
tuples by filename/lineno, then sort the catalog entries by their
location tuples.
2001-05-23 16:59:45 +00:00
Barry Warsaw 2b63969a5a main(): default-domain argument to getopt.getopt() was missing a = to
indicate it took an argument.  This closes SF patch #402223 by Bastian
Kleineidam.
2001-05-21 19:58:23 +00:00
Barry Warsaw 16b62c1300 __addentry(): add optional keyword arg `isdocstring' which is a flag
indicating whether the entry was extracted from a docstring or not.

write(): If any of the locations of a string appearance came from a
docstring, add a comment such as

#. docstring

before the references (after a suggestion by Martin von Loewis).
2001-05-21 19:51:26 +00:00
Barry Warsaw 6e972414be write(): A patch inspired by Tokio Kikuchi that sorts location entries
first by filename and then by line number.  Closes SF patch #425821.

Also, fixes a problem with duplicate entries.
2001-05-21 19:35:20 +00:00
Jack Jansen 656fe69383 Generate prototype-style function headers in stead of K&R style. Makes life easier with gcc -Wstrict-function-prototypes. 2001-05-19 13:59:18 +00:00
Marc-André Lemburg 716cf91839 Moved the encoding map building logic from the individual mapping
codec files to codecs.py and added logic so that multi mappings
in the decoding maps now result in mappings to None (undefined mapping)
in the encoding maps.
2001-05-16 09:41:45 +00:00
Guido van Rossum e9d7f0779d Refactored, with some future plans in mind.
This now uses the new gotofileline() method defined in FileList.py.
2001-05-12 12:30:04 +00:00
Guido van Rossum 6cb7a21934 Move the action of loading the configuration to the IdleConf module
rather than the idle.py script.  This has advantages and
disadvantages; the biggest advantage being that we can more easily
have an alternative main program.
2001-05-12 12:18:10 +00:00
Guido van Rossum 8451ebb435 Delete goodname() method, which is unused.
Add gotofileline(), a convenience method which I intend to use in a
variant.

Rename test() to _test().
2001-05-12 12:11:36 +00:00
Fred Drake a2133339ff Only catch NameError and TypeError when attempting to subclass an
exception (for compatibility with old versions of Python).
2001-05-11 19:40:10 +00:00
Jeremy Hylton 66a7e57c7e Fix several bugs and add two features.
Assertion error message had typos in arguments to string format.

.cover files for modules in packages are now put in the right place.

The code that generate .cover files seemed to prepend a "./" to many
absolute paths, causing them to fail.  The code now checks explicitly
for absolute paths and leaves them alone.

In trace/coverage code, recover from case where module has no __name__
attribute, when e.g. it is executed by PyRun_String().  In this case,
assign modulename to None and hope for the best.  There isn't anywhere
to write out coverage data for this code anyway.

Also, replace several sys.stderr.writes with print >> sys.stderr.

New features:

-C/--coverdir dir: Generate .cover files in specified directory
instead of in the directory where the .py file is.

-s: Print a short summary of files coverred (# lines, % coverage,
name)
2001-05-08 04:20:52 +00:00
Fred Drake 223ac0a498 Remove BrowserControl module; this had been left in for Python 1.5.2
support.
2001-04-18 18:43:34 +00:00
Fred Drake 6e06531d92 Remove legacy support for the BrowserControl module; the webbrowser
module has been included since Python 2.0, and that is the preferred
interface.
2001-04-18 18:42:48 +00:00
Barry Warsaw 2720d380e9 update_yourself(): Removed unused local variable reported by
PyChecker.
2001-04-18 03:53:29 +00:00
Barry Warsaw 31c2dae39c __init__(): Removed unused local variable reported by PyChecker. 2001-04-18 03:52:54 +00:00
Barry Warsaw 741eae0b31 StripWidget.__init__(), update_yourself(): Removed some unused local
variables reported by PyChecker.

__togglegentype(): PyChecker accurately reported that the variable
__gentypevar was unused -- actually this whole method is currently
unused so comment it out.
2001-04-18 03:51:55 +00:00
Barry Warsaw 6a5522677a Helpwin.__init__(): Removed an unused local variable (via import)
reported by PyChecker.
2001-04-18 03:50:07 +00:00
Barry Warsaw cc8a60cdf6 Bump the version to 1.1 2001-04-18 03:49:00 +00:00
Barry Warsaw 6330b52327 There have been a few new Python releases <wink> in the 2 years since
this tool was last touched!  Update some of the introductory material
and bump the version to 1.1.
2001-04-18 03:48:41 +00:00
Jeremy Hylton bb0bae6da2 Pop loop off the loop stack before handling the loop's else clause.
Otherwise, continue/break will attempt to affect the wrong loop.

A few more fiddles to get the SET_LINENOs consistent across compilers.
2001-04-12 21:54:41 +00:00
Jeremy Hylton 13d70944cb Use new _implicitNameOp() to generate name op code for list comprehensions.
Always emit a SET_LINENO 0 at the beginning of the module.  The
builtin compiler does this, and it's much easier to compare bytecode
generated by the two compilers if they both do.

Move the SET_LINENO inside the FOR_LOOP block for list
comprehensions.  Also for compat. with builtin compiler.
2001-04-12 21:04:43 +00:00
Jeremy Hylton 614e87f286 Add support for visitAssAttr to findOp(). 2001-04-12 20:24:26 +00:00
Jeremy Hylton 542b11acfd pyassem.py:
Fix annoying bugs in flow graph layout code.  In some cases the
    implicit control transfers weren't honored.  In other cases,
    JUMP_FORWARD instructions jumped backwards.

    Remove unused arg from nextBlock().

pycodegen.py

    Add optional force kwarg to set_lineno() that will emit a
    SET_LINENO even if it is the same as the previous lineno.

    Use explicit LOAD_FAST and STORE_FAST to access list comp implicit
    variables.  (The symbol table doesn't know about them.)
2001-04-12 20:21:39 +00:00
Jeremy Hylton bfb0cf822b Revise handling of tuple arguments so that the variables names match
those used by compile.c.  (test_grammar now depends on the names)
2001-04-12 17:33:34 +00:00
Jeremy Hylton 5c9aad6043 Only treat an AugAssign as def if its the target is a Name.
Fixes last bug found with test_scope.py.
2001-04-12 07:06:25 +00:00
Jeremy Hylton 3f76b7e6e4 Fix unpackSequence() to use _nameOp() rather than LOAD_FAST 2001-04-12 06:52:27 +00:00
Jeremy Hylton 660cc77abb Inside a class scope always use LOAD_NAME, STORE_NAME, DEL_NAME 2001-04-12 06:49:00 +00:00
Jeremy Hylton 364f9b9e2f Preliminary support for nested scopes
XXX Still doesn't work right for classes
XXX Still doesn't do sufficient error checking
2001-04-12 06:40:42 +00:00
Jeremy Hylton 53ee2a94c7 Define constants for types of scopes 2001-04-12 06:39:24 +00:00
Jeremy Hylton 84ec1f9159 typo 2001-04-11 16:43:13 +00:00
Jeremy Hylton 01d12937df [finishing fix from earlier checkins]
Call set_lineno() in visitDiscard(), which will generate linenos for
discard statements, e.g. the statement "1/0"

Fixes SF bug #409587
2001-04-11 16:36:25 +00:00
Jeremy Hylton d91bbba89d Add support for extra (*) arguments to preorder.
Change default dispatch to use extended call syntax in place of apply.
2001-04-11 16:26:05 +00:00
Jeremy Hylton 9ab019bee7 Generate docstrings.
Fixes SF buf #217004

Add method fixDocstring() to CodeGenerator.  It converts the Discard
node containing the docstring into an assignment to __doc__.
2001-04-11 16:24:30 +00:00
Jeremy Hylton 4c1f42733c Add lineno attributes to Discard nodes 2001-04-11 16:22:26 +00:00
Jeremy Hylton 5af105eec9 Make sure the docstring is always entered as the first element in the
consts, even if it is None.

Simplify _lookupName() by removing lots of redundant tests.
2001-04-11 16:21:51 +00:00
Guido van Rossum f9e56e117f Append the revision number for each file to the output.
(Yes, this is a new feature right before the 2.1 release.  No, I can't
imagine this would seriously break anybody's code.  In fact, most
users of this script are probably *happy* to see this addition.)
2001-04-10 03:31:27 +00:00
Jeremy Hylton dbdb28e8be Add globals to list of names returned by get_names().
Fix func arg processing to handle args in tuples.
In test code, skip names beginning with '.'.
2001-04-09 20:11:59 +00:00
Jeremy Hylton f870c952f9 Add two arguments to Scope constructor, module scope and class name
Add mangling support
Add get_children() and add_child() methods to Scope
Skip nodes when If test is a false constant
Add test code that checks results against symtable module
2001-04-09 13:57:32 +00:00
Jeremy Hylton 8b966dcf03 Add preliminary module symbol table constructor 2001-04-09 04:35:35 +00:00
Jeremy Hylton 80e29bd139 Add support for future statements 2001-04-09 04:28:48 +00:00
Jeremy Hylton 42a0830713 Fix "import as" (has always skipping the as name)
Fix com_NEWLINE() so that is accepts arguments, which occurs for lines like:
    stmt; # note trailing semicolon
Add XXX about checking for assignment to list comps
2001-04-09 04:27:12 +00:00
Jeremy Hylton a384f737cc typo 2001-04-09 04:23:55 +00:00
Fred Drake d34a9c98a9 Added more link attributes based on additonal information from Chris
McCafferty <christopher.mccafferty@csg.ch>, and a bit of experimentation
with Navigator 4.7.

HTML-as-deployed is evil!
2001-04-05 18:14:50 +00:00
Fred Drake f3186e8242 A number of improvements based on a discussion with Chris McCafferty
<christopher.mccafferty@csg.ch>:

Add javascript: and telnet: to the types of URLs we ignore.

Add support for several additional URL-valued attributes on the BODY,
FRAME, IFRAME, LINK, OBJECT, and SCRIPT elements.
2001-04-04 17:47:25 +00:00
Tim Peters 301ab7f2d0 Initialize new save_warnings_filters data member in ModifiedInterpreter.__init__.
Was getting mystery
    ModifiedInterpreter instance has no attribute 'save_warnings_filters'
errors at odd times (for sure in a fresh IDLE, fresh file, then Run Script).
2001-03-29 03:34:43 +00:00
Guido van Rossum b4ce43011e Turn SyntasWarning into SyntaxError for all code entered
interactively.
2001-03-26 17:41:35 +00:00
Ka-Ping Yee fde8a86a4e Script for starting pydoc with a GUI in Windows. 2001-03-23 14:10:39 +00:00
Guido van Rossum 53f5968f9b Make this IDLE version 0.8. (We have to skip 0.7 because that was a
CNRI release in a corner of the basement of a government building on a
planet circling Aldebaran.)
2001-03-22 17:37:52 +00:00
Guido van Rossum 3cc1250f16 Don't use __debug__ as if it were some module global. Use DEBUG
instead.
2001-03-22 17:27:13 +00:00
Martin v. Löwis 2c91c815d4 Patch #409504: Fix regex problems, consider \-continuation lines in Makefile
and Setup.
2001-03-21 06:58:25 +00:00
Guido van Rossum 6b767ac81a Lawrence Hudson, SF #401702: Modify co_filename in frozen programs
This patch was developed primarily to reduce the size of the
  frozen binary.  It is particularly useful when freezing for 'small'
  platforms, such as Palm OS, where you really want to save that
  last miserable byte.

  A limitation of this patch is that it does not provide any feedback
  about the replacements being made.  As the path matching
  is case-sensitive this may lead to unexpected behaviour for DOS
  and Windows people, eg
      > freeze.py -r C:\Python\Lib\=py\ goats.py
  should probably be:
      > freeze.py -r c:\python\lib\=py\ goats.py
2001-03-20 20:43:34 +00:00
Eric S. Raymond 1bb515b0e5 Teach Tools/freeze/makeconfig.py and Tools/freeze/parsesetup.py to use
the re package rather than the obsolete regex.
2001-03-18 11:27:58 +00:00
Tim Peters 401396fc60 Get rid of hardcoded Python path (can't guess where the user installed
IDLE, and it likely changes across releases anyway).
2001-03-10 21:48:24 +00:00
Barry Warsaw 78d7dc4979 Added -o/--output-file option as per GNU msgfmt to specify the output
file instead of using inputfilename.mo
2001-03-02 16:53:54 +00:00
Martin v. Löwis 0f6b3832b9 Put current date into POT-Creation-Date; leave PO-Revision-Date for
for the translator to update; that is compatible with xgettext 0.10.35.
2001-03-01 22:56:17 +00:00
Ka-Ping Yee 895e8925d6 Call main routine in pydoc module (pydoc.cli). 2001-03-01 00:25:40 +00:00
Andrew M. Kuchling b68ef5081d Add script form of pydoc so that it's present in beta1. Currently
this just copies the __name__=='__main__' logic from pydoc.py.
    ?!ng can decide whether he wants to create a main() in pydoc, or rip
    it out of pydoc.py completely.
2001-02-28 20:55:10 +00:00
Jack Jansen 8a69373664 Dialog and Window objects are (finally) different beasts. 2001-02-27 11:05:00 +00:00
Jack Jansen d67566b0f0 Use the filename, not the pathname, in the definitions file
comment. This way the generated files are identical when generated on
different machines.
2001-02-27 11:04:20 +00:00
Barry Warsaw 75ee8f54fa main(): Slightly more informative error message when TokenError
occurs.  Also, continue processing.
2001-02-26 04:46:53 +00:00
Tim Peters af449638b6 Patch 103928: Correct zlib freeze settings for Win32. 2001-02-23 03:45:13 +00:00
Fred Drake f5d2fdf164 Hack to make this still work with Python 1.5.2. ;-( 2001-02-16 22:13:48 +00:00
Tim Peters 9ae2148ada Moved SequenceMatcher from ndiff into new std library module difflib.py.
Guido told me to do this <wink>.
Greatly expanded docstrings, and fleshed out with examples.
New std test.
Added new get_close_matches() function for ESR.
Needs docs, but LaTeXification of the module docstring is all it needs.
\CVS: ----------------------------------------------------------------------
2001-02-10 08:00:53 +00:00
Tim Peters 670fa52698 Whitespace normalization. 2001-02-09 21:23:21 +00:00
Jeremy Hylton 1eab0028e6 move "from Tkinter import *" to module level 2001-02-02 20:07:46 +00:00
Barry Warsaw 1bbc048310 Special case around some of the nastier annoyances with the type-in
fields.  You can now backspace out the 0 in 0x0, and you can clear the
field when in decimal mode.  There are still some oddities about
typing into these fields, but it should be much less annoying.  The
real solution is to ditch the update-while-typing "feature".
2001-02-01 21:31:58 +00:00
Barry Warsaw 74a7ece9f3 Move the "from Tkinter import *" out of the method and into the module
scope (still inside the __name__=='__main__' guard).  Necessitated by
recent addition of nested scopes.
2001-02-01 20:52:08 +00:00
Martin v. Löwis 646ddec41f Allow installation of IDLE via distutils (patch #103138). 2001-01-28 11:01:50 +00:00
Tim Peters 19f52c2e34 Windows: ucnhash subproject no longer exists (/F merged into unicodedata). 2001-01-24 10:07:22 +00:00
Fredrik Lundh b2dfd73bdc Unicode nits: Don't include unicodedatabase.h no more. And make sure
to build *all* tables in makeunicodedata.py.
2001-01-21 23:31:52 +00:00
Fredrik Lundh 7b7dd107b3 compress unicode decomposition tables (this saves another 55k) 2001-01-21 22:41:08 +00:00
Fredrik Lundh 9e9bcda547 forgot to check in the new makeunicodedata.py script 2001-01-21 17:01:31 +00:00
Tim Peters d5d2cd149f Color all word instances of "as" after "import", & on the same line, as if
keywords.  Cheap approximation to the truth.
2001-01-19 10:41:49 +00:00
Guido van Rossum 9d593a526b This still mentioned IdlePrefs.py as the place to edit color
preferences.  It is now in config.txt or ~/.idle.
2001-01-19 03:30:58 +00:00
Tim Peters 79b334ba55 Hand repair of cases where reindent changed lines of the form
\t\t\t\t\treal code
##\t\t\t\t\tunused code
\t\t\t\t\treal code

via untabifying and shifting the real code left.  Semantically the
same but made the intent of the commented-out-in-column-0 unused code
unclear.  The exact same unused code appears to have gotten copied from
file to file over the years.
2001-01-17 09:13:33 +00:00
Tim Peters 70c4378dbc Whitespace normalization. 2001-01-17 08:48:39 +00:00
Guido van Rossum ecc463a617 New, improved README from Mike Clarkson. Wow! 2001-01-03 23:50:59 +00:00
Marc-André Lemburg a866df806d This patch changes the default behaviour of the builtin charmap
codec to not apply Latin-1 mappings for keys which are not found
in the mapping dictionaries, but instead treat them as undefined
mappings.

The patch was originally written by Martin v. Loewis with some
additional (cosmetic) changes and an updated test script
by Marc-Andre Lemburg.

The standard codecs were recreated from the most current files
available at the Unicode.org site using the Tools/scripts/gencodec.py
tool.

This patch closes the bugs #116285 and #119960.
2001-01-03 21:29:14 +00:00
Guido van Rossum ef92edd903 Make the test program work outside IDLE. 2001-01-02 21:22:03 +00:00
Guido van Rossum b19f1e3701 Add Alt-slash to Unix keydefs (I somehow need it on RH 6.2).
Get rid of assignment to unused self.text.wordlist.
2001-01-02 18:28:52 +00:00
Guido van Rossum 88b5ae0110 Fixed snake logo and minus image by Daniel Calvelo. 2000-12-27 22:26:08 +00:00
Jack Jansen 27489d4c8c Optionally weed out duplicate prototypes for the same function (which
happens because the scanner ignores preprocessor #ifs).
2000-12-12 22:24:35 +00:00
Jack Jansen c1a4a04792 Adapted to new standard for initmodule() routine: don't call
Py_FatalError on errors.
2000-12-12 22:22:59 +00:00
Jack Jansen 7e0c0050a8 Various new standard types. 2000-12-12 22:21:39 +00:00
Jack Jansen b8c68634b3 Added support for generating a single module from multiple .h files.
Allow /* */ comments within function prototypes.
2000-12-12 22:21:11 +00:00
Tim Peters 2f1aeb950d SF bug 124051: ndiff "?" lines can be confusing. Well, they still can, but
after implementing it I liked Gregor's two-"?" line idea a lot.
2000-12-09 05:03:22 +00:00
Jeremy Hylton 4ebf3be407 a few small optimizations that seem to give a 5-10% speedup; the
further optimization of com_node makes the most difference.
2000-11-06 16:03:52 +00:00
Jeremy Hylton eefaeb78b3 move pruneNext method to correct object (doh!) 2000-11-06 03:47:39 +00:00
Jeremy Hylton 314e3fb215 Change the graph structure to contain the code generator object for
embedded code objects (e.g. functions) rather than the generated code
object.  This change means that the compiler generates code for
everything at the end, rather then generating code for each function
as it finds it.  Implementation note: _convert_LOAD_CONST in
pyassem.py must be change to call getCode().

Other changes follow.  Several changes creates extra edges between
basic blocks to reflect control flow for loops and exceptions.  These
missing edges had gone unnoticed because they do not affect the
current compilation process.

pyassem.py:
    Add _enable_debug() and _disable_debug() methods that print
    instructions and blocks to stdout as they are generated.

    Add edges between blocks for instructions like SETUP_LOOP,
    FOR_LOOP, etc.

    Add pruneNext to get rid of bogus edges remaining after
    unconditional transfer ops (e.g. JUMP_FORWARD)

    Change repr of Block to omit block length.

pycodegen.py:
    Make sure a new block is started after FOR_LOOP, etc.

    Change assert implementation to use RAISE_VARARGS 1 when there is
    no user-specified failure output.

misc.py:
    Implement __contains__ and copy for Set.
2000-11-06 03:43:11 +00:00
Jeremy Hylton a59ac0a7df If a function contains a doc string, remove the doc string node from
the function's body.

If assert is used without an error message, make the AST node None
rather than Name('None').
2000-11-06 03:33:52 +00:00
Mark Hammond d3d7bb1c31 Application of [ Patch #102226 ] freeze/modulefinder.py should use _winreg, not win32api 2000-11-06 02:49:27 +00:00
Fredrik Lundh fad27aee11 Added 38,642 missing characters to the Unicode database (first-last
ranges) -- but thanks to the 2.0 compression scheme, this doesn't add
a single byte to the resulting binaries (!)

Closes bug #117524
2000-11-03 20:24:15 +00:00
Tim Peters 0d430e28c0 Hack ndiff to display lines w/ leading tabs more intuitively. This synchs
ndiff w/ a custom version I made for Guido during the pre-2.0 freeze.
2000-11-01 02:51:27 +00:00
Barry Warsaw 08a8a355be Added the -D/--docstrings option for extraction of unmarked module,
class, method, and function docstrings.
2000-10-27 04:56:28 +00:00
Fred Drake 9c6850510c Remove bogus stdout redirection and use of sys.__stdout__; use
augmented print statement instead.
2000-10-26 03:56:46 +00:00
Fred Drake 33e2c3ece3 Remove bogus stdout redirection and use of sys.__stdout__; use
augmented print statement instead.
2000-10-26 03:49:15 +00:00
Guido van Rossum e752baae71 Add IDLE wish: access items of arrays 2000-10-25 21:18:12 +00:00
Jeremy Hylton 7cff7fe21f Many changes.
Reformatting -- long lines, "[ ]" -> "[]", a few indentation nits.

Replace calls to Node function (which constructed ast nodes) with
calls to actual constructors imported from ast module.

Optimize com_node (most frequently used method) for the common case --
the appropriate method is found in _dispatch.

Fix com_augassign to use class object's rather than node names
(rendered invalid by recent changes to ast)

Remove expensive tests for sequence-ness in com_stmt and
com_append_stmt. These tests should never fail; if they do, something
is really broken and exception will be raised elsewhere.

Fix com_stmt and com_append_stmt to use isinstance rather than
testing's type slot of ast node (this slot disappeared with recent
changes to ast).
2000-10-25 18:10:32 +00:00
Jeremy Hylton 628d289d12 Generated from rev 1.1 of ast.txt 2000-10-25 18:02:59 +00:00
Jeremy Hylton 66d2c1f7e5 Small optimizations in dispatch method: 1) lookup node's __class__ once
and store in local; 2) define _preorder to be dispatch (rather than
method that called dispatch).
2000-10-25 18:02:02 +00:00
Jeremy Hylton 821eee3321 Support for generation of ast.py from simple description of node
structure (ast.txt).  Usage is python astgen.py > ast.py.
2000-10-25 17:59:17 +00:00
Jeremy Hylton ac148b5fcd run the std regression test suite using bytecode produced by the compiler 2000-10-13 22:00:13 +00:00
Jeremy Hylton e7f710cc06 add -d option that dumps entire AST before compiling 2000-10-13 21:59:32 +00:00
Jeremy Hylton 9c048f9f65 Now supports entire Python 2.0 language and still supports Python
1.5.2.  The compiler generates code for the version of the interpreter
it is run under.

ast.py:
    Print and Printnl add dest attr for extended print
    new node AugAssign for augmented assignments
    new nodes ListComp, ListCompFor, and ListCompIf for list
        comprehensions

pyassem.py:
    add work around for string-Unicode comparison raising UnicodeError
        on comparison of two objects in code object's const table

pycodegen.py:
    define VERSION, the Python major version number
    get magic number using imp.get_magic() instead of hard coding
    implement list comprehensions, extended print, and augmented
        assignment; augmented assignment uses Delegator classes (see
        doc string)
    fix import and tuple unpacking for 1.5.2

transformer.py:
    various changes to support new 2.0 grammar and old 1.5 grammar
    add debug_tree helper than converts and symbol and token numbers
    to their names
2000-10-13 21:58:13 +00:00
Jeremy Hylton 4e1be72e6b Fix SF bug #116263: support for from .. import *
transformer.py: return '*', None from com_import_as_name
pycodegen.py: special case for name == '*'
pyassem.py: fix stack counting for IMPORT_ opcodes
2000-10-12 20:23:23 +00:00
Jeremy Hylton b769e80056 read in a .pyc file and disassemble the code objects 2000-10-09 14:35:24 +00:00
Tim Peters f2fba87dcc Fix for next iteration of SF bug 115690 (Unicode headaches in IDLE). The
parsing functions in support of auto-indent weren't expecting Unicode
strings, but text.get() can now return them (although it remains muddy as
to exactly when or why that can happen).  Fixed that with a Big Hammer.
2000-10-06 23:09:00 +00:00
Guido van Rossum 70280b859e I'm moving redemo.py here from Demo/tkinter/guido, since it is
somewhat useful to learn regular expressions, and this way it'll be
installed on Windows.

This closes bug report 115609.
2000-10-06 17:37:12 +00:00
Tim Peters ad14720262 New tool for normalizing indentation of .py files. 2000-10-05 03:48:38 +00:00
Fredrik Lundh 375732cd41 - don't set the titlecase flag for uppercase letters (sorry, tim) 2000-09-25 23:03:34 +00:00
Fredrik Lundh 0f8fad4969 unicode database compression, step 3:
- added decimal digit and digit properties to the unidb tables
2000-09-25 21:01:56 +00:00
Fredrik Lundh e9133f7e2e unicode database compression, step 3:
- use unidb compression for the unicodectype module.  smaller,
  faster, and slightly more portable...

- also mention the unicode directory in Tools/README
2000-09-25 17:59:57 +00:00
Fredrik Lundh cfcea49218 unicode database compression, step 2:
- fixed attributions
- moved decomposition data to a separate table, in preparation
  for step 3 (which won't happen before 2.0 final, promise!)
- use relative paths in the generator script

I have a lot more stuff in the works for 2.1, but let's leave
that for another day...
2000-09-25 08:07:06 +00:00
Tim Peters 2101348830 Fiddled w/ /F's cool new splitbins function: documented it, generalized it
a bit, sped it a lot primarily by removing the unused assumption that None was
a legit bin entry (the function doesn't really need to assume that there's
anything special about 0), added an optional "trace" argument, and in __debug__
mode added exhaustive verification that the decomposition is both correct and
doesn't overstep any array bounds (which wasn't obvious to me from staring at the
generated C code -- now I feel safe!).  Did not commit a new unicodedata_db.h, as
the one produced by this version is identical to the one already checked in.
2000-09-25 07:13:41 +00:00
Fredrik Lundh f367cacb98 unicode database compression, step 1:
- use unidb compression for the unicodedata module.  on Windows,
  the new unidatabase module is 120k, down from nearly 600k.
2000-09-24 23:18:31 +00:00
Tim Peters f58a7aafea Implemented new os.startfile function, unique to Windows, exposing a
subset of Win32 ShellExecute's functionality.  Guido wants this because
IDLE's Help -> Docs function currently crashes his machine because of a
conflict between his version of Norton AntiVirus (6.10.20) and MS's
_popen.  Docs for startfile are being mailed to Fred (or just read the
docstring -- it tells the whole story).
Changed webbrowser.py to use os.startfile instead of os.popen on Windows.
Changed IDLE's EditorWindow.py to pass an absolute path for the docs
(hardcoding ShellExecute's "directory" arg to "." as used to be done let
IDLE work, but made the startfile command exceedingly obscure for other
uses -- the MS docs are terrible, of course, & still not sure I
understand it).
Note that Windows Python must link with shell32.lib now!  That's where
ShellExecute lives.
2000-09-22 10:05:54 +00:00
Jeremy Hylton 572bdce4b3 change 2-space indent to 4-space indent 2000-09-20 02:47:28 +00:00
Jeremy Hylton 9c36a41694 distutils setup script 2000-09-20 02:35:19 +00:00
Guido van Rossum bdd901714d Fix typo (newtabwith). 2000-09-20 00:17:39 +00:00
Guido van Rossum f8d071332a Temporary fix for Bug #114821.
The cause was that the replace code necessarily used a PCRE internal
function to to template expansion.

The fix changes the code to use an SRE internal if SRE is used, and a
PCRE internal if SRE is used; in a way that should work with 1.5.2.

The solution can be sped up tremendously under the assumption that the
choice between sre and pre is not changed during the execution of the
program; especially replace-all will be slow.

But I'll leave that to someone else.
2000-09-19 20:51:17 +00:00
Jeremy Hylton 0b7b4b8a22 satisfy the tabnanny 2000-09-18 01:46:01 +00:00
Barry Warsaw 64850efa39 Allow this script to act like a module by only calling main() if
__name__ == '__main__'.  Closes SF bug #110844.
2000-09-16 22:09:51 +00:00
Guido van Rossum 8999053326 Fix for bug #113693: with the changes to the IMPORT_FROM opcodes, this
crashed on an assert.
2000-09-15 16:37:42 +00:00
Guido van Rossum 3634112b40 Include the filename in the errror message for F5 without saving.
This closes bug #110660.
2000-09-15 15:45:57 +00:00
Fred Drake 10515b6483 main(): Move hackery of sys.argv until after the Tk instance has been
created.  This allows the application-specific Tkinter
         initialization to be executed if present.  Also pass an explicit
         className parameter to the Tk() constructor.

This closes SourceForge bug #110618.
2000-09-15 04:32:56 +00:00
Guido van Rossum fa6013cff0 Don't emit 8 lines of (c) information at startup -- use the same text
as main.c.
2000-09-05 13:51:14 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Jeremy Hylton 92f3972090 patch by Neil Schemenauer to improve (fix?) line number generation 2000-09-01 20:47:37 +00:00
Jeremy Hylton 2051608616 Update magic number.
Fix import support to work with import as variant of Python 2.0.  The
grammar for import changed, requiring changes in transformer and code
generator, even to handle compilation of imports with as.
2000-09-01 20:33:26 +00:00
Guido van Rossum 1688f378cb Rob Hooft, Moshe Zadka: converted to 4 space indents and re instead of regex. 2000-09-01 13:41:37 +00:00
Barry Warsaw 72dacb8026 Tool to generate binary GNU .mo file from .po template files. Written
by Martin v. Loewis, proofed by Barry Warsaw for coding standards,
typos, and to make command line options compatible with GNU msgfmt
where they overlap.

Closes patch #101295.
2000-09-01 08:10:08 +00:00
Thomas Wouters 46cc7c0f7b Bring Tools/compiler almost up to date. Specifically:
- fix tab space issues (SF patch #101167 by Neil Schemenauer)
- fix co_flags for classes to include CO_NEWLOCALS (SF patch #101145 by Neil)
- fix for merger of UNPACK_LIST and UNPACK_TUPLE into UNPACK_SEQUENCE,
  (SF patch #101168 by, well, Neil :)
- Adjust bytecode MAGIC to current bytecode.

TODO: teach compile.py about list comprehensions.
2000-08-12 20:32:46 +00:00
Jeremy Hylton 20b2ca9d19 add note about compiler directory
(is bgen still "still under development"?)
2000-08-04 17:03:58 +00:00
Jeremy Hylton 7daf04d9e0 replace most calls to emit 'SET_LINENO' will call to method set_lineno
based on bug report by Neil Schemenauer
2000-08-04 16:56:51 +00:00
Jeremy Hylton 8612f1c152 update my email address
fix com_call_function to cope with trailing comma in "f(a, b,)"
2000-08-04 16:54:54 +00:00
Jeremy Hylton da1ec468b1 Python code coverage tool by Skip Montanaro and Andrew Dalke 2000-08-03 19:26:21 +00:00
Greg Stein fd342bf453 add a bit more legal junk
(too lazy to paste in the whole BSD license tho; included by ref)
2000-08-03 17:39:13 +00:00
Andrew M. Kuchling 7e11170e85 Removed Tools/perfecthash, per python-dev discussion 2000-07-29 13:24:39 +00:00
Guido van Rossum efdf107fb7 Add the exceptions module to the 'never' list -- it is built in. 2000-07-28 10:34:48 +00:00
Jeremy Hylton 4d6381dfee Fix UCNs machine with >= 32bit longs
originally submitted by Bill Tutt

Note: This code is actually going to be replaced in 2.0 by /F's new
database.  Until then, this patch keeps the test suite working.
2000-07-26 03:56:06 +00:00
Jeremy Hylton ffe968b8fe This script demonstrates use of the visitor interface of the compiler
package.
2000-07-25 16:43:23 +00:00
Peter Schneider-Kamp 332c59c4ef change some occurence of python15.dll to python20.dll
closes patch #100956
2000-07-24 16:02:00 +00:00
Thomas Wouters 7889010731 Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
char**) and return an int even on PC platforms. If not, please fix
PC/utils/makesrc.c ;-P
2000-07-22 19:25:51 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Jack Jansen c8081e9bfa Modified the standard mac preamble so we include pymactoolbox.h in
stead of defining lots of function prototypes in each module.
2000-07-15 22:29:30 +00:00
Jack Jansen 629eee0636 ScannerPREUH3.initpatterns() should call Scanner.initpatterns() so the
new comment patterns get included.
2000-07-15 22:27:47 +00:00
Guido van Rossum f67c2383da Patch by Toby Dickenson, mentored by Mark Hammond, to support
automatically finding (most of) the standard PYD extensions, and to
remove the hardcoded Python version.
2000-07-13 15:45:17 +00:00
Peter Schneider-Kamp 7f589fddad add expandtabs command (-e)
change eliminate to delete (-d)
2000-07-11 16:43:16 +00:00
Fred Drake 3637799afe Update to use the new standard webbrowser module if available, otherwise
uses the BrowserControl module.

BrowserControl is not removed to allow IDLE to be distributed separately
and still be used with Python 1.5.2.
2000-07-09 19:10:19 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Marc-André Lemburg bc30b11764 Fix to use Py_UCS4. By Bill Tutt. 2000-07-07 17:53:54 +00:00
Jack Jansen e3889da076 Make a distinction between shorts and unsigned shorts. 2000-07-06 15:17:52 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Marc-André Lemburg a4657f736c Marc-Andre Lemburg <mal@lemburg.com>:
Fixed a quote bug. Thanks to Fredrik Lundh.
2000-06-30 10:30:35 +00:00
Marc-André Lemburg e3f257e681 Marc-Andre Lemburg <mal@lemburg.com>:
Include <> -> "". Removed some left over code at the end of the file.
Patch by Bill Tutt.
2000-06-30 09:56:00 +00:00
Marc-André Lemburg 90321ec314 Marc-Andre Lemburg <mal@lemburg.com>:
Include <> -> "". Patch by Bill Tutt.
2000-06-30 09:53:22 +00:00
Guido van Rossum a04ff0fb53 Running the program through itself reveals that one end tag was
mislabeled.

(Using -c and then -e rearranges some comments, so I won't check that
in -- but it's a good test anyway.

Note that pindent is not perfect -- e.g. it doesn't know about
triple-quoted strings!)
2000-06-28 22:55:20 +00:00
Guido van Rossum 59811b189d Peter Schneider-Kamp:
Problem:
A Python program can be completed and reformatted using
Tools/scripts/pindent.py. Unfortunately there is no option for removal
of the generated "# end"-tags.  Although a few Python commands or a
"grep -v '# end '" can do wonders here, there are two drawbacks:
- not everyone has grep/time to write a Python script
- it is not checked whether the "# end"-tags were used validly

Solution:
add extra option "-e" (eliminate) to pindent.py
2000-06-28 22:47:22 +00:00
Guido van Rossum b7c298f806 Jack Jansen: Support for conditional inclusion of methods and functions 2000-06-28 20:53:33 +00:00
Marc-André Lemburg 4e5302a27e Marc-Andre Lemburg <mal@lemburg.com>:
Perfect hash table generator. Outputs a Python extension module
which provides access to the hash table (which is stored in static
C data) using custom code.

This module can currently only generates code for the ucnhash
module, but can easily be adapted to produce perfect hash tables
for other tasks where fast lookup in large tables is needed.

By Bill Tutt.
2000-06-28 16:53:16 +00:00
Marc-André Lemburg c5bb9c21fe Marc-Andre Lemburg <mal@lemburg.com>:
Generator for the new ucnhash module (ucnhash.h|c). Uses perfect_hash.py
to create the ucnhash module.
2000-06-28 16:49:29 +00:00
Marc-André Lemburg 93c409a590 Marc-Andre Lemburg <mal@lemburg.com>:
Utility extension module needed by perfect_hash.py

By Bill Tutt.
2000-06-28 16:48:05 +00:00
Fred Drake 6cd948ebd8 Rename the "browser" module to "BrowserControl", since Guido did not
like the short, ambiguous name.
2000-05-10 17:28:42 +00:00
Fred Drake 8638ace511 EditorWindow.python_docs():
Instead of using Netscape through os.system(), use the new
        browser.open() function to load the documentation on the
        default browser.  On Windows, this will use the installed
        documentation if it exists, instead of hitting python.org.
2000-05-10 16:50:07 +00:00
Fred Drake 95a40001e6 Collection of classes and convenience functions to control external
Web browsers.
2000-05-10 16:47:27 +00:00
Fred Drake bd7b8b3310 Minor edit of leading comments: 'the the' --> 'the', quoted 'enable'
option name for clarity.
2000-05-09 14:28:03 +00:00
Guido van Rossum 4b1235cdac Toby Dickenson:
Fix for problem with freeze when both "-m" and "-s service" options
are used.

(Blessed by MarkH)
2000-05-06 03:18:08 +00:00
Jeremy Hylton be317e615e patches from Mark Hammond
Attached is a set of diffs for the .py compiler that adds support
for the new extended call syntax.

compiler/ast.py:
CallFunc node gets 2 new children to support extended call syntax -
"star_args" (for "*args") and "dstar_args" (for "**args")

compiler/pyassem.py
It appear that self.lnotab is supposed to be responsible for
tracking line numbers, but self.firstlineno was still hanging
around.  Removed self.firstlineno completely.  NOTE - I didnt
actually test that the generated code has the correct line numbers!!

Stack depth tracking appeared a little broken - the checks never
made it beyond the "self.patterns" check - thus, the custom methods
were never called!  Fixed this.

(XXX Jeremy notes: I think this code is still broken because it
doesn't track stack effects across block bounaries.)

Added support for the new extended call syntax opcodes for depth
calculations.

compiler/pycodegen.py

Added support for the new extended call syntax opcodes.

compiler/transformer.py

Added support for the new extended call syntax.
2000-05-02 22:32:59 +00:00
Jeremy Hylton 0a4f1ff64e patches from Mark Hammond
compile.py:
On Windows, use 'nul' instead of '/dev/null'.

test.py:
Use double-quotes for the command-line, as Windows doesnt recognise
singles.
2000-05-02 22:29:46 +00:00
Barry Warsaw 75a6e67e69 Added an unused Unicode string for testing. 2000-05-02 19:28:30 +00:00
Guido van Rossum ce33eb3ee8 Sjoerd Mullender:
Bad % formatting.
2000-05-02 13:49:13 +00:00
Guido van Rossum 6664bb87dc Sjoerd Mullender: cmp.py is obsolete... 2000-04-28 13:31:52 +00:00
Guido van Rossum f3335e193b Patch inspired by Just van Rossum: on the Mac, in savefilename(), make
the path to save a relative path by prefixing it with os.sep (':').
Also fix an indent inconsistency in the same function.
2000-04-25 21:13:24 +00:00
Guido van Rossum e56b4cf804 Jack Jansen: A few new types needed by new API calls. 2000-04-24 14:56:00 +00:00
Guido van Rossum e39a88fd58 Two more items. 2000-04-11 15:30:19 +00:00
Fred Drake d6904ea5a0 Use a better approach to locating IDLE's default configuration,
allowing it to be run from anywhere, including through a symlink to
the actual idle.py script.
2000-04-10 16:27:47 +00:00
Guido van Rossum fa9ef1864f Just in case someone wants to use this, let's fix the pathname. 2000-04-06 20:09:17 +00:00
Guido van Rossum 2b6004a07f New version 1.0.4. I'm sure someone mailed me these patches but I
can't remember who. :-)  Changes:

- Support for Windows NT (different locking behavior)
- Added a logging mechanism
2000-03-31 00:58:00 +00:00
Guido van Rossum 8daef3791e New version 1.0.4. I'm sure someone mailed me these patches but I
can't remember who. :-)  Changes:

- Owner name+email made generic instead of GvR
- Support for Windows NT (running from a .bat file)
- DOcument <HTML>...</HTML> tags
2000-03-31 00:55:54 +00:00
Guido van Rossum e0dd3010ce Removed two files that were added temporarily. 2000-03-30 20:34:56 +00:00
Guido van Rossum b8f512bfa4 Bump version to 0.6 for the event of the Python 1.6 alpha 1 release. 2000-03-30 20:30:34 +00:00
Barry Warsaw bc9476ebe5 __pushtodev(): Ignore transient sunaudiodev.errors when setting the
device info.  I don't know why these occur, but they seem to be
shortlived and harmless.
2000-03-29 21:05:53 +00:00
Guido van Rossum 918429b3b2 Moved robotparser.py to the Lib directory.
If you do a "cvs update" in the Lib directory, it will pop up there.
2000-03-29 16:02:45 +00:00
Guido van Rossum 84306246f1 Fix suggested by Magnus Kessler: in class Page, it is possible for
self.parser to be None; in that case don't dereference it in
getnames().
2000-03-28 20:10:39 +00:00
Guido van Rossum dc8b7980e0 Skip Montanaro:
The robotparser.py module currently lives in Tools/webchecker.  In
preparation for its migration to Lib, I made the following changes:

    * renamed the test() function _test
    * corrected the URLs in _test() so they refer to actual documents
    * added an "if __name__ == '__main__'" catcher to invoke _test()
      when run as a main program
    * added doc strings for the two main methods, parse and can_fetch
    * replaced usage of regsub and regex with corresponding re code
2000-03-27 19:29:31 +00:00
Fred Drake 70b5d47f71 From Sjoerd Mullender <sjoerd@oratrix.nl>:
cmp is not used in freeze, but is imported anyway.  What's worse, cmp
is no longer in the library, so freeze won't work like this.
2000-03-23 18:13:10 +00:00
Fred Drake bae57a88a6 Of course, I forget how to type long ago...
Typo noted by /F.
2000-03-17 16:56:23 +00:00
Fred Drake 1966004986 "write marshalled" --> "writes marshalled" (in docstring); noted by
Detlef Lannert <lannert@lannert.rz.uni-duesseldorf.de>.
2000-03-17 15:43:37 +00:00
Jeremy Hylton 36cc6a2197 complete rewrite
code generator uses flowgraph as intermediate representation.  the old
    rep uses a list with explicit "StackRefs" to indicate the target
    of jumps.

pyassem converts flowgraph to bytecode, breaks up individual steps of
    generating bytecode
2000-03-16 20:06:59 +00:00
Jeremy Hylton f635abee3a simplify visitor walker class
- remove postorder
- remove protocol for automatically walking children based on visitor
  method return value; now only walks if there is no method
2000-03-16 20:04:16 +00:00
Jeremy Hylton b631b8ede5 fix list.append problems 2000-03-16 20:03:04 +00:00
Jeremy Hylton e4d6293383 change name of Set method: items -> elements (avoids confusion with
dict)
2000-03-16 20:02:38 +00:00
Guido van Rossum 7f1cd296c6 Tim Peters writes:
Fix bad auto-indent I recently introduced when replacing the regexp that
could cause re to blow up:

    if or_any_other_block_opener:
        # one indenting comment line
            ^ cursor ended up at the caret (the bug)
        ^ but belongs here (the post-patch behavior)
2000-03-13 14:50:24 +00:00
Guido van Rossum 34a79115c5 Marc-Andre Lemburg: added
gencodec.py - Create Python codecs from Unicode mapping files
2000-03-10 22:36:57 +00:00
Jeremy Hylton 329e4be05a a simple client-server framework for executing code in a different
process

not yet connected with IDLE
2000-03-09 19:56:50 +00:00
Barry Warsaw a17e0f1b61 A bunch of changes, primarily to command line argument parsing
(inspired by Detlef Lannert).  Specifically,

    -k/--keyword no longer takes an optional argument to clear the
    default keywords.  Instead, use -K/--no-default-keywords to clear
    them.

    -n/--add-location also no longer takes an optional argument to set
    the comment style.  Instead, use -S/--style to set the comment
    style to GNU or Solaris.

    -o/--output can take `-' as the filename, meaning write to
    standard output.

    The inputfile name can also be `-' meaning read from standard in.

A few other changes include

    Kludge to mark the file docstring as translatable.  Since the
    marking is to place _() around the docstring, and because we
    actually have to define the _() function before we use it, this
    means that we have to manually assign to __doc__ the output of
    _().  This doesn't seem too bad because you'll only use this idiom
    when translating a script's docstring (you really don't need to
    translate most module docstrings).

    Convert everything to string methods and do not import the string
    module.

    Bump the version number to 1.1
2000-03-08 15:18:35 +00:00
Guido van Rossum 9de988315a Override the Undo delegator to forbid any changes before the I/O mark.
It beeps if you try to insert or delete before the "iomark" mark.
This makes the shell less confusing for newbies.
2000-03-07 18:51:49 +00:00
Jeremy Hylton 6fbd1f85d9 replace : with = 2000-03-07 17:56:47 +00:00
Jeremy Hylton ae1f3bd7bd rename the global IdleConfParser object from IdleConf to idleconf
standard usage is now from IdleConf import idleconf
2000-03-07 17:56:27 +00:00
Jeremy Hylton 6b3edf0510 rename the global IdleConfParser object from IdleConf to idleconf
standard usage is now from IdleConf import idleconf

replace : with = in config.txt
2000-03-07 17:55:32 +00:00
Guido van Rossum ba23bed340 Tweak the goto file/line command (in the right button menu in PyShell
and output windows) so that it if it doesn't succeed with the line
at the cursor, it tries the line before that.  This is handy with
tracebacks, where my natural tendency is to click in the displayed
source line rather than in the file/line indicator just above it.
Now I can indulge this tendency.

I factored out a helper and changed the error handling so that a
non-existing file is treated as if the line didn't match -- this is
handy because some function calls (e.g. "foo.bar(1)") match the grep
pattern.
2000-03-07 16:25:11 +00:00
Guido van Rossum 801296c3b9 Added a bunch of TODO items that recently came up in the idle-dev list.
Also removed a bunch of items
2000-03-07 15:17:53 +00:00
Guido van Rossum fd6315ec7f If we're in the current input and there's only whitespace beyond the
cursor, erase that whitespace first.  This avoids a particularly
confusing case where hitting Return at the end of the command didn't
do what it was expected to do -- because it wasn't considered to be at
the end of the command.  Now it is.
2000-03-07 15:05:50 +00:00
Jeremy Hylton 0c3208aa62 compiler command-line interface moved here from compiler.pycodegen 2000-03-06 19:13:21 +00:00
Jeremy Hylton f728f9a13e import compile function form pycodegen 2000-03-06 19:12:33 +00:00
Jeremy Hylton 7fab23e9cb rename compile.py to pycodegen.py
fix imports
remove parse functions and visitor code
track name change: Classdef to Class

add some comments and tweak order of visitXXX methods

get rid of if __name__ == "__main__ section
2000-03-06 19:10:54 +00:00
Jeremy Hylton 8c78341f45 add a doc string
import some useful functions from contained modules
2000-03-06 19:04:14 +00:00
Jeremy Hylton 9812e7bc6a fix import to refer to compiler package 2000-03-06 18:54:30 +00:00
Jeremy Hylton abd7ebf70b revise arguments for addCode method on lnotab. take several numbers
that are internally converted to chars, rather than taking a string.
2000-03-06 18:53:14 +00:00
Jeremy Hylton fa974a9d06 change node Classdef to Class
add doc string to transformer module
add two helper functions:
    parse(buf) -> AST
    parseFile(path) -> AST
2000-03-06 18:50:48 +00:00
Jeremy Hylton ed9586174d factor out the tree walking/visitor code that was in compile.py 2000-03-06 18:49:31 +00:00
Guido van Rossum 9cb083b957 Defer all the work to idle.py, which has recently become too
complicated to copy in-line here.
2000-03-06 17:16:05 +00:00
Guido van Rossum 7f3cfd50fa In getdef(), don't die when the section doesn't exist. 2000-03-06 14:43:20 +00:00
Guido van Rossum 074d6e1f56 Don't use 1.6-isms (s.startswith()) -- we want to distribute this
before 1.6 is out so it has to be compatible with 1.5.2.
2000-03-06 14:16:41 +00:00
Jeremy Hylton 272cbb4974 superceded by IdleConf/config.txt 2000-03-03 23:08:09 +00:00
Jeremy Hylton e81f28b630 migrate to use of IdleConf and config files to set options
idle.py:
    Load the config files before anything else happens
    XXX Need to define standard way to get files relative to the
       IDLE install dir

PyShell.py:
ColorDelegator.py:
    Get color defns out of IdleConf instead of IdlePrefs

EditorWindow.py:
    Replace hard-coded font & window size with config options
    Get extension names via IdleConf.getextensions

extend.py:
   Obsolete.  Extensions defined in config file.

ParenMatch.py:
   Use config file for extension options.
   Revise comment about parser requirements.
   Simplify logic on find returning None.
2000-03-03 23:06:45 +00:00
Jeremy Hylton 583abb8027 default to cwd if os.environ['HOME'] does not exist 2000-03-03 23:00:41 +00:00
Jeremy Hylton daca630e40 a ConfigParser for idle and three configuration files 2000-03-03 22:57:42 +00:00
Guido van Rossum 9428fa607b Patch by Tim Peters:
Changes the one regexp in PyParse capable of making the re module blow the C
stack when passed unreasonable <0.9 wink> program text.  Jeremy Hylton
provoked this with a program of the form:

x = (1,
     2,
... # 9997 lines deleted here
     10000,
)

Programs "like this" will no longer (no matter how many lines they contain)
trigger re death.  OTOH, you can now make another class of unreasonable
program that will take much longer to parse.
2000-03-03 14:51:11 +00:00
Jeremy Hylton 63c2b250ef paren matching extension. warning: in current version of IDLE, can
not run this extension and CallTips extension at the same time.
2000-03-02 19:06:57 +00:00
Guido van Rossum 1b6d21bb3e Correct type error in getopt.error handling code. 2000-02-29 13:08:44 +00:00
Guido van Rossum aacf5ce1ad Script by Tim Peters to discover illegal append() calls. 2000-02-29 13:05:49 +00:00
Guido van Rossum 67dd17f730 Fix multi-arg append(). 2000-02-29 13:00:16 +00:00
Barry Warsaw 7733e12c9c Two buglet fixes. Peter Funk caught the bug in make_escapes:
This will fold all ISO 8859 chars from the upper half of the
    charset into the lower half, which is ...ummm.... unintened.

The second is a typo in the reference to options.escape in main().
2000-02-27 14:30:48 +00:00
Barry Warsaw c8f0892d12 Changes submitted by Peter Funk (some fixes/additions by B.Warsaw) to
make pygettext more compatible with GNU xgettext, specifically:

Added -E/--escape for allowing pass-thru of iso8859-1 characters above
7 bits.

Added -o/--output option for renaming the output file from
messages.pot (there's overlap with -d/--default-domain, but GNU
xgettext has them both).

Added -p/--output-dir for specifying the output directory for
messages.pot.

Added -V/--version for printing the version number.

Added -w/--width for specifying the output page width (this is because
now pygettext, like GNU xgettext will put several locations on the
same line to cut down on vertical space).

Added -x/--exclude-file for specifying a list of strings that are not
to be extracted from the input files.

Bumped version number to 1.0

Try to import fintl and use fintl.gettext as _ if available.  Fall
back is to use identity definition of _().

Moved the escape creation to a function make_escapes() so that its
behavior can be controlled by the -E option.

__openseen(): Support the -x option.

write(): Support -w option and vertical space preserving feature.

main(): Support new options.
2000-02-26 20:56:47 +00:00
Guido van Rossum 6e0a28f6cf Deleting tabpolice.py; it was superceded by tabnanny.py long ago. 2000-02-23 15:34:43 +00:00
Guido van Rossum a02c898e69 Moved tabnanny.py to standard library status. 2000-02-23 15:33:52 +00:00
Guido van Rossum dc6883365b Added tabnanny.py, by Tim Peters, formerly from Tools/scripts, to the
standard library.  Added some comments:

# XXX Note: this is now a standard library module.
# XXX The API needs to undergo changes however; the current code is too
# XXX script-like.  This will be addressed later.
2000-02-23 15:32:19 +00:00
Guido van Rossum 8c95c27c4c Added a new command: Check module (Alt-F5) It does a full syntax check
of the current module.  It also runs the tabnanny to catch any
inconsistent tabs.

Also did a little bit of refactoring: added an errorbox() method to
simplify the display of error dialogs.
2000-02-22 00:19:58 +00:00
Jeremy Hylton 772dd417f7 satisfy the tabnanny (thanks to MH for noticing the problem) 2000-02-21 22:46:00 +00:00
Jeremy Hylton efd0694a2d changes to _lookupName
- removed now (happily) unused second arg
- need to verify results of [].index are correct; for building consts,
  need to have same value and same type, e.g. 2 not the same as 2L
2000-02-17 22:58:54 +00:00
Jeremy Hylton 3ec7e2c4be the previous quick hack to fix def foo((x,y)) failed on some cases
(big surprise).  new solution is a little less hackish.

Code gen adds a TupleArg instance in the argument slot. The tuple arg
includes a copy of the names that it is responsble for binding.  The
PyAssembler uses this information to calculate the correct argcount.

all fix this wacky case: del (a, ((b,), c)), d
which is the same as: del a, b, c, d
(Can't wait for Guido to tell me why.)

solution uses findOp which walks a tree to find out whether it
contains OP_ASSIGN or OP_DELETE or ...
2000-02-17 22:09:35 +00:00
Jeremy Hylton 7708d697ee add varargs and kwargs flags to Lambda nodes 2000-02-17 22:06:20 +00:00
Jeremy Hylton 873bdc18e4 satisfy the tabnanny
fix broken references to filename var in generateXXX methods
2000-02-17 17:56:29 +00:00
Guido van Rossum 99aabe30ce Add primitive customization of window size and font.
A few alternative selections can be made by changing "if 0" to "if 1".
2000-02-17 16:14:16 +00:00
Guido van Rossum 44cf8ef521 The 0.5 release happened on 2/15, not on 2/14. :-) 2000-02-16 01:22:35 +00:00
Jeremy Hylton ad9a86fb1c support for arglists with implicit tuple unpacks
- added a number of support methods to generate code just before the
  body
- hack protocol for communicating number of args to PyAssembler

fix TryExcept generation for case where exception handler has no body
fix visitAssAttr
add comment about incomplete visitAssName

stop using the ExampleASTVisitor

change script invocation to accept a list of .py files (e.g. Lib/*.py)
2000-02-16 00:55:44 +00:00
Jeremy Hylton 3d9f5e4de2 more robust assignment of lineno for keyword args
get the lineno from the name of the keyword arg

example of case that didn't work--
def foo(x, y, a = None,
	b = None):
2000-02-16 00:51:37 +00:00
Jeremy Hylton 2ce27b223b fix argcount generation for arg lists containing tuple unpacks
this is sort of a hack
2000-02-16 00:50:29 +00:00
Jeremy Hylton 65d4ea05d2 add flatten helper function 2000-02-16 00:49:47 +00:00
Jeremy Hylton 4f6bcd80fc finish first impl of code generator
add support for nodes TryExcept, TryFinally, Sliceobj
fix visitSubscript to properly handle x[a,b,c]
2000-02-15 23:45:26 +00:00
Jeremy Hylton 1ebba96871 fix creation of Ellipsis node 2000-02-15 23:43:19 +00:00
Jeremy Hylton 410e840c85 add a little debugging support when new.code raises SystemError 2000-02-15 21:59:50 +00:00
Jeremy Hylton d603dee4a3 add line numbers to nodes in the except clause (when possible) 2000-02-15 21:30:48 +00:00
Jeremy Hylton ca1ad182f2 tidy up tryexcept and tryfinally nodes 2000-02-15 21:30:00 +00:00
Guido van Rossum 6e83cacb18 A bit restructured. 2000-02-15 19:11:26 +00:00
Guido van Rossum dec0b68d68 Oops, somehow the initial checkin was botched. :-( 2000-02-15 18:30:58 +00:00
Guido van Rossum 83d4657a06 Added some clarifications. 2000-02-15 18:20:28 +00:00
Guido van Rossum 90ad8589b1 Temporarily add a copy here for easy distribution. 2000-02-15 18:20:01 +00:00
Guido van Rossum 17ae233edc More changes. 2000-02-15 18:11:21 +00:00
Guido van Rossum 1d841fec12 Notice status back and stack viewer. 2000-02-15 18:08:19 +00:00
Guido van Rossum ec73dc6700 Support for Moshe's status bar. 2000-02-15 18:05:15 +00:00
Guido van Rossum 17752f7c4b Status bar code -- by Moshe Zadka. 2000-02-15 18:04:52 +00:00
Guido van Rossum 2bb8e72046 Adding the old stack viewer implementation back, for the debugger. 2000-02-15 18:04:09 +00:00
Guido van Rossum b658469873 New stack viewer, uses a tree widget.
(XXX: the debugger doesn't yet use this.)
2000-02-15 18:03:40 +00:00
Guido van Rossum 553fa4432a Correct a typo and remove an unqualified except that was hiding the error. 2000-02-15 18:03:01 +00:00
Guido van Rossum f801f3b05c Add an XXX comment about the ClassBrowser AIP. 2000-02-15 18:02:11 +00:00
Guido van Rossum 0b5b2c89d7 Updated change log. 2000-02-15 17:19:25 +00:00
Guido van Rossum 46ffbecf94 News update. Probably incomplete; what else is new? 2000-02-15 17:17:58 +00:00
Guido van Rossum 6d3be50653 Updated for pending IDLE 0.5 release (still very rough -- just getting
it out in a more convenient format than CVS).
2000-02-15 17:16:40 +00:00
Guido van Rossum b4b8381f4f Tiny addition. 2000-02-15 17:15:36 +00:00
Jeremy Hylton 9e1cd688b5 edit a doc string
(real intent is to test out rsync install)
2000-02-14 23:57:56 +00:00
Jeremy Hylton a46fb3841b get rid of spurious print 2000-02-14 21:54:57 +00:00
Guido van Rossum 967e509a81 Patch by Gerrit Holl:
* In crlf.py and lfcr.py: regsub -> re
2000-02-14 21:42:14 +00:00
Guido van Rossum d962878309 Patch by Gerrit Holl:
* In logmerge.py: added '-r' flag to show the oldest checkin
      first instead of the newest, and getopt.getopt was used
      wrong.
2000-02-14 21:41:50 +00:00
Jeremy Hylton 126960b744 looks like everything is working except for try/except (pystone
compiles correctly)
2000-02-14 21:33:10 +00:00
Jeremy Hylton 17988d2a17 LeftShift & RightShift: fix reprs, change attr names to left and right
(so they are common with other binary ops)
2000-02-14 21:32:42 +00:00
Jeremy Hylton bf6267e6f8 rename several of the generic attribute names for nodes. new node attrs are:
Exec: expr, locals, globals
Dict: items
Assert: test, fail
2000-02-14 18:34:11 +00:00
Jeremy Hylton 42907790b6 (), [], and {} should not be represented as constant expressions, they
should be calls to BUILD_ ops for these types with no arguments
2000-02-14 18:32:46 +00:00
Jeremy Hylton a50581228e split compile.py into two files
add StackDepthFinder (and remove push/pop from CodeGen)
add several nodes, including Ellipsis, Bit&|^, Exec
2000-02-14 14:14:29 +00:00
Jeremy Hylton 3050d51571 change MODULE_NAMESPACE/FUNCTION_NAMESPACE stuff to have a single flag
named OPTIMIZED, which matches compile.c and makes more sense for
classes

revamp call signature for PythonVMCode.__init__; doesn't really matter
'cuz this code is going to be refactored out of existence

add generateClassCode and modify Func & Lambda generation

add support for nodes Classdef, Keyword,

fix CallFunc to generate right op arg when calling w/ keywords

add ugly hack to properly compute offsets when the same stack ref is
used multiple times
2000-02-12 00:12:38 +00:00
Jeremy Hylton 76d01b820c add support for Lambda nodes
change resolution of local name ops (LOAD_FAST).  i think it makes
sense now.  if it is an argument or a local var name that it used, it
must be in varnames.  if it is a local var name that is used, it must
also be in names
2000-02-11 20:27:07 +00:00
Jeremy Hylton 4eb504c2af add loop handling via
Loop object to handle StackRegs
loops stack attr on CodeGenreeator to hold the current loop object

add support for nodes While, Break, Continue
2000-02-10 20:55:50 +00:00
Jeremy Hylton 95b8614353 add an __len__ to Set and Stack 2000-02-10 20:54:27 +00:00
Jeremy Hylton 3e0910c10c add namespace attr to CodeGenerator, can be either MODULE_NAMESPACE or
FUNCTION_NAMESPACE.  initialize in __init__ and reset in
generateFunctionCode.

replace direct issue of STORE_FAST, STORE_GLOBAL, etc. with call to
storeName; same for loadName and deleteName

the new {store,load,delete}Name methods use the namespace attr and the
local variable stack to determine the correct bytecode to issue
2000-02-10 17:20:39 +00:00
Jeremy Hylton 5e0ce53e0e add ExampleASTVisitor:
* prints out examples of nodes that are handled by visitor.  simply a
  development convenience

remove NestedCodeGenerator -- it was bogus after all
replace with generateFunctionCode, a method to call to generate code
  for a function instead of a top-level module

fix impl of visitDiscard (most pop stack)
emit lineno for pass

handle the following new node types: Import, From, Getattr, Subscript,
Slice, AssAttr, AssTuple, Mod, Not, And, Or, List

LocalNameFinder: remove names declared as globals for locals

PythonVMCode: pass arg names to constructor, force varnames to contain
them all (even if they aren't referenced)

add -q option on command line to disable stdout
2000-02-10 00:47:08 +00:00
Jeremy Hylton 69926eaee0 add remove method to set 2000-02-10 00:43:22 +00:00
Jeremy Hylton 402456020b add optional verbose arg to walk function. it overrides the global
VERBOSE setting for the ASTVisitor

add getopt handling for one or more -v args

rename ForwardRef to StackRef, because it isn't necessarily directional

CodeGenerator:
* add assertStackEmpty method.  prints warning if stack is not empty
  when it should be
* define methods for AssName, UNARY_*, For

PythonVMCode:
* fix mix up between hasjrel and hasjabs for address calculation
2000-02-08 21:15:48 +00:00
Jeremy Hylton 156a975476 make all unary operators have a single child node called expr 2000-02-08 21:06:19 +00:00
Jeremy Hylton 1851901a05 add spaces to comparison names is not and not in to match dis 2000-02-08 19:58:33 +00:00
Jeremy Hylton 53187f32eb now produces valid pyc files for a least a trivial subset of the
language.

CodeGenerator:
* modify to track stack depth
* add emit method that call's PythonVMCode's makeCodeObject
* thread filenames through in hackish way
* set flags for code objects for modules and functions
  XXX the docs for the flags seem out of date and/or incomplete

PythonVMCode:
* add doc string describing the elements of a real code object

LineAddrTable:
* creates an lnotab (no quite correctly though)
2000-02-08 19:01:29 +00:00
Jeremy Hylton aa9d2d6123 constants from transformer 2000-02-08 18:57:51 +00:00
Jeremy Hylton 9605c11c4c move constants out of transformer so that they can be shared with ast
add varargs and kwargs attributes to Function nodes
2000-02-08 18:57:32 +00:00
Jeremy Hylton 0fdffcf916 rapid evolution towards producing real .pyc files (even though I don't
handle most of the language syntax yet)

create NestedCodeGenerator used to generator the separate code object
that needs to be passed as an argument to MAKE_FUNCTION when a def
stmt is found (probably useful for class too)

change CodeGenerator.visitFunction to use the NestedCG

add CompiledModule class to handle creation of .pyc (pretty minimal
for now)

add makeCodeObject method to PythonVMCode that replaces symbolic names
with indexes into slots of the code code.  the design of this
class will probably need to be revised.
2000-02-04 19:37:35 +00:00
Jeremy Hylton 8b6323d3ef checking in initial weekend's work
compile.py: ASTVisitor framework plus bits of a code generator that
    should be bug-for-buf compatible with compile.c

misc.py: Set and Stack helpers

test.py: a bit of simple sample code that compile.py will work on
2000-02-04 00:28:21 +00:00