diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-14 22:04:44 +0000 |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-14 22:04:44 +0000 |
commit | 76f42ac51229e9a1f09f6dd72f9c1da00cb32c72 (patch) | |
tree | 0ba6eeb26179224210aaee2bbe86da1367d850db /Tools/compiler/doc/astdocgen.py | |
parent | ce575bac5e5972177b642d9a434e63ed1657de34 (diff) | |
download | cpython-git-76f42ac51229e9a1f09f6dd72f9c1da00cb32c72.tar.gz |
First day's progress on documentation
Diffstat (limited to 'Tools/compiler/doc/astdocgen.py')
-rw-r--r-- | Tools/compiler/doc/astdocgen.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Tools/compiler/doc/astdocgen.py b/Tools/compiler/doc/astdocgen.py new file mode 100644 index 0000000000..c593ce10c5 --- /dev/null +++ b/Tools/compiler/doc/astdocgen.py @@ -0,0 +1,30 @@ +# Lame substitute for a fine script to generate the table from ast.txt + +from compiler import astgen + +AST_DEF = '../compiler/ast.txt' + +def sort(l): + l = l[:] + l.sort(lambda a, b: cmp(a.name, b.name)) + return l + +def main(): + nodes = astgen.parse_spec(AST_DEF) + print "\\begin{longtableiii}{lll}{class}{Node type}{Attribute}{Value}" + print + for node in sort(nodes): + if node.argnames: + print "\\lineiii{%s}{%s}{}" % (node.name, node.argnames[0]) + else: + print "\\lineiii{%s}{}{}" % node.name + + for arg in node.argnames[1:]: + print "\\lineiii{}{%s}{}" % arg + print "\\hline", "\n" + print "\\end{longtableiii}" + + +if __name__ == "__main__": + main() + |