C++: Change opcode QLDocs to refer to instruction QLDocs

As discussed in today's C++ analysis team meeting. `Opcode` is rarely used directly, so we'll just refer to the documentation for the corresponding `Instruction` class.

I've preserved the script in case we want to do a bulk change of all of the `Opcode` comments, but I don't expect it will be needed if we just add a new `Opcode` or two.
This commit is contained in:
Dave Bartolomeo
2020-06-29 12:41:36 -04:00
parent 4dcdd8a0ee
commit 6de3d5bc3d
3 changed files with 627 additions and 271 deletions

View File

@@ -4,6 +4,7 @@ import os
import re
path = os.path
needs_an_re = re.compile(r'^(?!Unary)[AEIOU]') # Name requiring "an" instead of "a".
start_qldoc_re = re.compile(r'^\s*/\*\*') # Start of a QLDoc comment
end_qldoc_re = re.compile(r'\*/\s*$') # End of a QLDoc comment
blank_qldoc_line_re = re.compile(r'^\s*\*\s*$') # A line in a QLDoc comment with only the '*'
@@ -84,9 +85,14 @@ with open(opcode_path, 'r', encoding='utf-8') as opcode:
# Found an `Opcode` that matches a known `Instruction`. Replace the QLDoc with
# a copy of the one from the `Instruction`.
if instruction_comments.get(name_without_suffix):
# Rename `instruction` to `operation`.
qldoc_lines = [(indent + qldoc_line.replace(' An instruction ', ' An operation '))
for qldoc_line in instruction_comments[name_without_suffix]]
article = 'an' if needs_an_re.search(name_without_suffix) else 'a'
qldoc_lines = [
indent + '/**\n',
indent + ' * The `Opcode` for ' + article + ' `' + name_without_suffix + 'Instruction`.\n',
indent + ' *\n',
indent + ' * See the `' + name_without_suffix + 'Instruction` documentation for more details.\n',
indent + ' */\n'
]
output_lines.extend(qldoc_lines)
qldoc_lines = []
output_lines.append(line)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff