diff options
author | Georg Brandl <georg@python.org> | 2008-07-23 15:19:11 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-07-23 15:19:11 (GMT) |
commit | f0dd6a672d91259b9e56b714c2435f8ce3722c51 (patch) | |
tree | 2f51d231804997ca5ea33b149f7982c5c148a01b /Doc | |
parent | 0e9463c4c9190befe7ceb5c455811fbf18e2783e (diff) | |
download | cpython-f0dd6a672d91259b9e56b714c2435f8ce3722c51.zip cpython-f0dd6a672d91259b9e56b714c2435f8ce3722c51.tar.gz cpython-f0dd6a672d91259b9e56b714c2435f8ce3722c51.tar.bz2 |
Merged revisions 65199 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65199 | georg.brandl | 2008-07-23 17:17:09 +0200 (Wed, 23 Jul 2008) | 2 lines
Move opcode handling to Python's extension.
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/tools/sphinxext/pyspecific.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py index 6ca4805..42bb1bf 100644 --- a/Doc/tools/sphinxext/pyspecific.py +++ b/Doc/tools/sphinxext/pyspecific.py @@ -83,6 +83,28 @@ class PydocTopicsBuilder(Builder): f.close() +# Support for documenting Opcodes + +import re +from sphinx import addnodes + +opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)\s*\((.*)\)') + +def parse_opcode_signature(env, sig, signode): + """Transform an opcode signature into RST nodes.""" + m = opcode_sig_re.match(sig) + if m is None: + raise ValueError + opname, arglist = m.groups() + signode += addnodes.desc_name(opname, opname) + paramlist = addnodes.desc_parameterlist() + signode += paramlist + paramlist += addnodes.desc_parameter(arglist, arglist) + return opname.strip() + + def setup(app): app.add_role('issue', issue_role) app.add_builder(PydocTopicsBuilder) + app.add_description_unit('opcode', 'opcode', '%s (opcode)', + parse_opcode_signature) |