Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d4c7e636
Commit
d4c7e636
authored
Jul 23, 2008
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move opcode handling to Python's extension.
parent
f9efabb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
Doc/tools/sphinxext/pyspecific.py
Doc/tools/sphinxext/pyspecific.py
+22
-0
No files found.
Doc/tools/sphinxext/pyspecific.py
View file @
d4c7e636
...
...
@@ -85,6 +85,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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment