aboutsummaryrefslogtreecommitdiff
path: root/contrib/check-params-in-docs.py
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-07-11 12:43:49 -0700
committerIan Lance Taylor <iant@golang.org>2020-07-11 12:43:49 -0700
commit4854d721be78358e59367982bdd94461b4be3c5a (patch)
tree8ead189e618f8ef1456c8b02c81de0cc1585d8a6 /contrib/check-params-in-docs.py
parent3cdc95b9f8d6c90c4a279783fd3da961c5afb22c (diff)
parente109f6e438b72ef3e403162971068d28d09b82f5 (diff)
downloadgcc-4854d721be78358e59367982bdd94461b4be3c5a.zip
gcc-4854d721be78358e59367982bdd94461b4be3c5a.tar.gz
gcc-4854d721be78358e59367982bdd94461b4be3c5a.tar.bz2
Merge from trunk revision e109f6e438b72ef3e403162971068d28d09b82f5
Diffstat (limited to 'contrib/check-params-in-docs.py')
-rwxr-xr-xcontrib/check-params-in-docs.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/contrib/check-params-in-docs.py b/contrib/check-params-in-docs.py
index 6cff090..dfbfa3d 100755
--- a/contrib/check-params-in-docs.py
+++ b/contrib/check-params-in-docs.py
@@ -22,16 +22,19 @@
#
#
-import sys
-import json
import argparse
+from itertools import dropwhile, takewhile
-from itertools import *
def get_param_tuple(line):
- line = line.strip()
+ line = line.strip().replace('--param=', '')
i = line.find(' ')
- return (line[:i], line[i:].strip())
+ name = line[:i]
+ if '=' in name:
+ name = name[:name.find('=')]
+ description = line[i:].strip()
+ return (name, description)
+
parser = argparse.ArgumentParser()
parser.add_argument('texi_file')
@@ -49,8 +52,8 @@ for line in open(args.params_output).readlines():
# Find section in .texi manual with parameters
texi = ([x.strip() for x in open(args.texi_file).readlines()])
-texi = dropwhile(lambda x: not 'item --param' in x, texi)
-texi = takewhile(lambda x: not '@node Instrumentation Options' in x, texi)
+texi = dropwhile(lambda x: 'item --param' not in x, texi)
+texi = takewhile(lambda x: '@node Instrumentation Options' not in x, texi)
texi = list(texi)[1:]
token = '@item '