cpython/Tools/compiler
Jeremy Hylton 566d934745 compiler.transformer: correct lineno attribute when possible
SF patch #1015989

The basic idea of this patch is to compute lineno attributes for all AST nodes.  The actual
implementation lead to a lot of restructing and code cleanup.

The generated AST nodes now have an optional lineno argument to constructor.  Remove the
top-level asList(), since it didn't seem to serve any purpose.  Add an __iter__ to ast nodes.
Use isinstance() instead of explicit type tests.

Change transformer to use the new lineno attribute, which replaces three lines of code with one.
Use universal newlines so that we can get rid of special-case code for line endings.  Use
lookup_node() in a few more frequently called, but simple com_xxx methods().  Change string
exception to class exception.
2004-09-07 15:28:01 +00:00
..
ACKS Why didn't I think of Fred off the top of my head? 2001-08-27 20:44:20 +00:00
README Remove setup.py, unnecessary since compiler package is the std 2001-09-20 15:02:27 +00:00
ast.txt PEP-0318, @decorator-style. In Guido's words: 2004-08-02 06:10:11 +00:00
astgen.py compiler.transformer: correct lineno attribute when possible 2004-09-07 15:28:01 +00:00
compile.py Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
demo.py Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
dumppyc.py Only print attributes that start with co_. 2001-09-17 18:08:20 +00:00
regrtest.py PEP-0318, @decorator-style. In Guido's words: 2004-08-02 06:10:11 +00:00
stacktest.py Test utility to look for bad stacksize calculations. 2001-10-17 13:39:06 +00:00

README

This directory contains support tools for the Python compiler package,
which is now part of the standard library.

compile.py	Demo that compiles a Python module into a .pyc file
		using the pure-Python compiler code.

demo.py		Prints the names of all the methods defined in a module,
		as a demonstration of walking through the abstract syntax
		tree produced by the parser.

dumppyc.py	Dumps the contents of a .pyc file, printing 
		the attributes of the code object followed by a 
		code disassembly.

regrtest.py	Runs the Python test suite using bytecode generated 
		by the pure-Python compiler code instead of the
		builtin compiler.