summaryrefslogtreecommitdiffstats
path: root/Doc/library/parser.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-07-23 15:07:12 (GMT)
committerGeorg Brandl <georg@python.org>2008-07-23 15:07:12 (GMT)
commit30704ea0db31e48f115f85c2e61acee0edbce0c6 (patch)
tree312e85735a082a65699bfa74b523895585f56d3f /Doc/library/parser.rst
parent4dcce175e2844db556db4b32c5035e5d942bec6f (diff)
downloadcpython-30704ea0db31e48f115f85c2e61acee0edbce0c6.zip
cpython-30704ea0db31e48f115f85c2e61acee0edbce0c6.tar.gz
cpython-30704ea0db31e48f115f85c2e61acee0edbce0c6.tar.bz2
Remove "ast" aliases from the parser module.
Diffstat (limited to 'Doc/library/parser.rst')
-rw-r--r--Doc/library/parser.rst25
1 files changed, 10 insertions, 15 deletions
diff --git a/Doc/library/parser.rst b/Doc/library/parser.rst
index 5df8feb..f5cd877 100644
--- a/Doc/library/parser.rst
+++ b/Doc/library/parser.rst
@@ -30,11 +30,6 @@ the code forming the application. It is also faster.
Syntax Tree (AST) generation and compilation stage, using the :mod:`ast`
module.
- The :mod:`parser` module exports the names documented here also with "st"
- replaced by "ast"; this is a legacy from the time when there was no other
- AST and has nothing to do with the AST found in Python 2.5. This is also the
- reason for the functions' keyword arguments being called *ast*, not *st*.
-
There are a few things to note about this module which are important to making
use of the data structures created. This is not a tutorial on editing the parse
trees for Python code, but some examples of using the :mod:`parser` module are
@@ -170,9 +165,9 @@ executable code objects. Parse trees may be extracted with or without line
numbering information.
-.. function:: st2list(ast[, line_info])
+.. function:: st2list(st[, line_info])
- This function accepts an ST object from the caller in *ast* and returns a
+ This function accepts an ST object from the caller in *st* and returns a
Python list representing the equivalent parse tree. The resulting list
representation can be used for inspection or the creation of a new parse tree in
list form. This function does not fail so long as memory is available to build
@@ -188,9 +183,9 @@ numbering information.
This information is omitted if the flag is false or omitted.
-.. function:: st2tuple(ast[, line_info])
+.. function:: st2tuple(st[, line_info])
- This function accepts an ST object from the caller in *ast* and returns a
+ This function accepts an ST object from the caller in *st* and returns a
Python tuple representing the equivalent parse tree. Other than returning a
tuple instead of a list, this function is identical to :func:`st2list`.
@@ -199,7 +194,7 @@ numbering information.
information is omitted if the flag is false or omitted.
-.. function:: compilest(ast[, filename='<syntax-tree>'])
+.. function:: compilest(st[, filename='<syntax-tree>'])
.. index::
builtin: exec
@@ -208,7 +203,7 @@ numbering information.
The Python byte compiler can be invoked on an ST object to produce code objects
which can be used as part of a call to the built-in :func:`exec` or :func:`eval`
functions. This function provides the interface to the compiler, passing the
- internal parse tree from *ast* to the parser, using the source file name
+ internal parse tree from *st* to the parser, using the source file name
specified by the *filename* parameter. The default value supplied for *filename*
indicates that the source was an ST object.
@@ -233,22 +228,22 @@ determine if an ST was created from source code via :func:`expr` or
:func:`suite` or from a parse tree via :func:`sequence2st`.
-.. function:: isexpr(ast)
+.. function:: isexpr(st)
.. index:: builtin: compile
- When *ast* represents an ``'eval'`` form, this function returns true, otherwise
+ When *st* represents an ``'eval'`` form, this function returns true, otherwise
it returns false. This is useful, since code objects normally cannot be queried
for this information using existing built-in functions. Note that the code
objects created by :func:`compilest` cannot be queried like this either, and
are identical to those created by the built-in :func:`compile` function.
-.. function:: issuite(ast)
+.. function:: issuite(st)
This function mirrors :func:`isexpr` in that it reports whether an ST object
represents an ``'exec'`` form, commonly known as a "suite." It is not safe to
- assume that this function is equivalent to ``not isexpr(ast)``, as additional
+ assume that this function is equivalent to ``not isexpr(st)``, as additional
syntactic fragments may be supported in the future.