Skip to content

Commit 9b6eb2a

Browse files
encukouAA-Turner
andauthored
Apply suggestions from code review
Co-authored-by: Adam Turner <[email protected]>
1 parent 02fff75 commit 9b6eb2a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Tools/build/generate_token.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,10 @@ def make_rst(infile, outfile='Doc/library/token-list.inc',
234234

235235
has_handwritten_doc = set()
236236
with open(rstfile) as fileobj:
237-
tokendef_re = re.compile(r'.. data:: (\w+)')
237+
tokendef_re = re.compile(r'.. data:: ([0-9A-Z_]+)\s*')
238238
for line in fileobj:
239-
if match := tokendef_re.fullmatch(line.strip()):
240-
if match[1].isupper():
241-
has_handwritten_doc.add(match[1])
239+
if match := tokendef_re.fullmatch(line):
240+
has_handwritten_doc.add(match[1])
242241

243242
# Exclude non-token constants in token.py
244243
has_handwritten_doc -= {'N_TOKENS', 'NT_OFFSET', 'EXACT_TOKEN_TYPES'}

0 commit comments

Comments
 (0)