##// END OF EJS Templates
check-config: use named groups in regexp...
Gregory Szorc -
r32848:485b8e87 default
parent child Browse files
Show More
@@ -16,12 +16,12 b' documented = {}'
16
16
17 configre = re.compile(r'''
17 configre = re.compile(r'''
18 # Function call
18 # Function call
19 ui\.config(|int|bool|list)\(
19 ui\.config(?P<ctype>|int|bool|list)\(
20 # First argument.
20 # First argument.
21 ['"](\S+)['"],\s*
21 ['"](?P<section>\S+)['"],\s*
22 # Second argument
22 # Second argument
23 ['"](\S+)['"](,\s+
23 ['"](?P<option>\S+)['"](,\s+
24 (?:default=)?(\S+?))?
24 (?:default=)?(?P<default>\S+?))?
25 \)''', re.VERBOSE | re.MULTILINE)
25 \)''', re.VERBOSE | re.MULTILINE)
26
26
27 configpartialre = (r"""ui\.config""")
27 configpartialre = (r"""ui\.config""")
@@ -81,11 +81,11 b' def main(args):'
81 line = carryover + l
81 line = carryover + l
82 m = configre.search(line)
82 m = configre.search(line)
83 if m:
83 if m:
84 ctype = m.group(1)
84 ctype = m.group('ctype')
85 if not ctype:
85 if not ctype:
86 ctype = 'str'
86 ctype = 'str'
87 name = m.group(2) + "." + m.group(3)
87 name = m.group('section') + "." + m.group('option')
88 default = m.group(5)
88 default = m.group('default')
89 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
89 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
90 default = ''
90 default = ''
91 if re.match('[a-z.]+$', default):
91 if re.match('[a-z.]+$', default):
General Comments 0
You need to be logged in to leave comments. Login now