Commit Graph

840 Commits

Author SHA1 Message Date
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
Jeremy Hylton 106a02da94 make p2c a package 2000-02-04 00:25:34 +00:00
Jeremy Hylton f968e8545d three files from the p2c cvs tree. the message here indicates the
revision number the p2c cvs tree.

COPYRIGHT: 1.1
ast.py: 1.3
transformer.py: 1.11
2000-02-04 00:25:23 +00:00
Guido van Rossum f158887505 Two patches from Jack Jansen:
Three bgen mods:
- support for FSSpecs passed-by-value and points-passed-by-reference added.
- strip single-line comments when parsing header files
- if a definition is blacklisted _do_ output it, but in comment
2000-01-20 20:49:28 +00:00
Barry Warsaw 8f35681843 Added \" to escapes so embedded escaped double quotes are handled
correctly.  Patch suggested by Mads Kiilerich <mk@solit.dk>.
1999-12-06 02:46:49 +00:00
Guido van Rossum 4755ee567d Complete the integration of Sam Bayer's fixes. 1999-11-17 15:41:47 +00:00
Guido van Rossum 497a19879d Changed fron importing wcnew back to webchecker. 1999-11-17 15:40:48 +00:00
Guido van Rossum e284b21457 Integrated Sam Bayer's wcnew.py code. It seems silly to keep two
files.  Removed Sam's "SLB" change comments; otherwise this is the
same as wcnew.py.
1999-11-17 15:40:08 +00:00
Guido van Rossum 61b95db389 # *NOT* by Sam Bayer: reindented to use 4 spaces like the rest here,
# and removed trailing whitespace.
1999-11-17 15:13:21 +00:00
Guido van Rossum 64acb5ce93 Samuel L. Bayer:
- same trick with "import wcnew; webchecker = wcnew" as above
- updated readhtml() method to handle pair representation; used
  new name suppression infrastructure from wcnew.py to suppress
  processing name anchors

[And untabified --GvR]
1999-11-17 15:04:26 +00:00
Guido van Rossum a8946406df Samuel L. Bayer:
- added -t and -a arguments
- added "import wcnew; webchecker = wcnew" in place of "import
  webchecker" (I assume that if you're happy with the changes, you'll
  just replace webchecker.py with wcnew.py, but if I were to do that,
  the diffs would be incomprehensible)
- fixed buggy -v argument (I think you got out of sync with the
  way verbosity was handled in webchecker vs. wcgui between 1.5 and
  1.5.2)
- made -v actually do something by adding a call to c.setflags()
  (probably the same problem as above)
- updated references to URLs to accommodate wcnew.py's pair
  representation; added appropriate calls to format_url() to handle
  display; added argument to ListPanel() initialization to provide
  access to format_url()

[And untabified --GvR]
1999-11-17 15:03:52 +00:00
Guido van Rossum f97eecccb7 Samuel L. Bayer:
- same fixes from webchecker.py
- incorporated small diff between current webchecker.py and 1.5.2
- fixed bug where "extra roots" added with the -t argument were being
  checked as real roots, not just as possible continuations
- added -a argument to suppress checking of name anchors

[And untabified --GvR]
1999-11-17 15:02:53 +00:00
Guido van Rossum dbd5c3e63b Samuel L. Bayer:
- forced new done origins to set errors if they're in self.bad (fixes
  bug where only the first of a number of errorful references to a
  link is reported under some circumstances)
- suppressed adding duplicates to self.todo list (cleans up printout
  in wcgui details)
1999-11-17 15:00:14 +00:00
Barry Warsaw 5dbf526e8e Several improvements, some of where were contributed by Bernhard
Herzog <herzog@online.de>.  Specifically,

--verbose/-v flag added

pot_header added to make msgmerge and Emacs po-mode work better

normalize(), escape(), safe_eval(): Improved normalization of strings
for more .po file compatibility (e.g. C style).  Handles emmbedded
newlines better.

Also added an identity function called _() and use it in the file
where messages are printed.  This allows us to selftest pygettext.py
with itself as input.
1999-11-03 18:47:52 +00:00
Barry Warsaw a507c32991 Python equivalent of xgettext(1). This was originally released
separately but now is included in the standard Python distribution.
1999-11-03 16:46:05 +00:00
Guido van Rossum 8b4b46e4f3 Fix a bug reported by Toby Dickenson (on 18 May 1999).
Sometimes there's no parent, so don't try to get its __name__.
1999-11-02 15:46:44 +00:00
Guido van Rossum cfd76a202b Sjoerd Mullender:
Added some declarations to shut up compiler.
1999-11-02 15:44:40 +00:00
Barry Warsaw c4eb6a6afd main(): Arg! I wasn't properly ignoring EINVAL; now only re-raise the
exception if code <> errno.EINVAL.  Jeremy this should fix your
problem.
1999-10-07 20:00:01 +00:00
Guido van Rossum fa968ac35b Patches by Jack Jansen: new type OptionalInBuffer allows
passing either a string/input buffer or None.
1999-09-30 14:15:14 +00:00
Guido van Rossum 8bd738278e Patch by Jack Jansen to add with_ifdef option, which places #ifndef
around external decls.
1999-09-30 14:12:44 +00:00
Barry Warsaw d8d179d69d main(): wrap the device.setinfo() call around an exception handler.
It's possible to get a sunaudiodev.error (errno == EINVAL), although
I'm not exactly sure why, this at least won't crash the application.
1999-09-22 15:45:51 +00:00
Guido van Rossum 7f2c9d3890 A few new TODO entries. 1999-09-09 14:16:02 +00:00
Guido van Rossum 7f1fdfcdaf Add Python Documentation entry to Help menu. 1999-08-26 23:06:22 +00:00
Guido van Rossum 416b961be8 Find the help.txt file relative to __file__ or ".", not in sys.path.
(Suggested by Moshe Zadka, but implemented differently.)

Add <<python-docs>> event which, on Unix, brings up Netscape pointing
to http://www.python.doc/current/ (a local copy would be nice but its
location can't be predicted).  Windows solution TBD.
1999-08-26 23:06:05 +00:00
Guido van Rossum a8b37ad9ff Scrit by Marc-Andre Lemburg to generate htmlentitydefs.py. 1999-08-19 16:00:41 +00:00
Barry Warsaw 8a07baef80 Bump to version 1.1 1999-08-18 20:18:20 +00:00
Barry Warsaw 772d69676e __update(): Jeremy Hylton reports occurances of sunaudiodev.error
(interrupted system call) when getting the device information.  I've
never seen it, but this patch should take care of the problem.

If we get that exception and we're polling, just return since we'll
wake up again soon and get the right information.  If we're not
polling, try 4 times and then give up.
1999-08-18 20:17:42 +00:00
Barry Warsaw e27db5a393 Initial implementation 1999-08-13 20:59:48 +00:00
Barry Warsaw af5725104b Initial revision 1999-08-11 21:40:38 +00:00
Guido van Rossum aa6ed0c341 Moshe noticed an inconsistency in his comment, so I'm rephrasing it to
be clearer.
1999-08-11 14:55:43 +00:00
Guido van Rossum 292f2c53da Patch inspired by Moshe Zadka to search for the Icons directory in the
same directory as __file__, rather than searching for it along sys.path.
This works better when idle is a package.
1999-08-11 02:01:00 +00:00
Guido van Rossum a74c55662f Mark Hammond writes:
"""
If the filename being complained about contains a space, enclose the
file-name in quotes.

The reason is simply that when I try and parse tabnanny's output, filenames
with spaces make it very difficult to determine where the filename stops
and the linenumber begins!
"""

Tim approves.

I slightly changed the patch (use 'in' instead of string.find()) and
arbitrarily bumped the __version__ variable up to 6.
1999-07-30 17:48:20 +00:00
Guido van Rossum aba953eceb New wishes. 1999-07-15 13:11:02 +00:00
Guido van Rossum 0d6bac67be Make the color for stderr red (i.e. the standard warning/danger/stop
color) rather than green.  Suggested by Sam Schulenburg.
1999-07-10 13:17:35 +00:00
Barry Warsaw 17a8b5d473 make_view_popups(): Catch import error which can occur if a viewer is
dynamically imported when Pynche is running via askcolor out of a
package.  If the ImportError occurs, try again, prepending the package
name and digging out the module.
1999-07-06 22:00:52 +00:00
Guido van Rossum 16e0bab4ab Close debugger when closing. This may break a cycle. 1999-06-25 17:26:34 +00:00
Guido van Rossum ba5a59c834 Break cycle on close. 1999-06-25 17:25:22 +00:00
Guido van Rossum 5af0df528d Destroy the tree when closing. 1999-06-25 17:08:19 +00:00
Guido van Rossum 30455f3050 Add destroy() method to recursively destroy a tree. 1999-06-25 17:07:57 +00:00
Guido van Rossum fed9b914b5 Extend _close() to break cycles.
Break some other cycles too (and destroy the root when done).
1999-06-25 16:09:27 +00:00
Guido van Rossum 205afb487a Add _close() method that does the actual cleanup (close() asks the
user what they want first if there's unsaved stuff, and may cancel).
It closes more than before.

Add unload_extensions() method to unload all extensions; called from
_close().  It calls an extension's close() method if it has one.
1999-06-25 16:06:29 +00:00