def register_options(self):
# type: () -> None
"""Parse options from text like this:
# Uncrustify 0.63
#
# General options
#
newlines { Auto, LF, CR, CRLF }
The type of line endings
input_tab_size Number
The original size of tabs in the input
indent_align_string { False, True }
Whether to indent strings broken by '\' so that they line up
"""
exeresult = run_executable(self.exe, ['--show-config'], cache=self.cache)
options = []
text = unistr(exeresult.stdout)
for m in re.finditer(r'^(\w+)\s+(.*?)\s*$', text, re.MULTILINE):
optionname, optiondesc = m.group(1), m.group(2)
if optiondesc.startswith('{'):
optiontype = 'Enum'
configs = optiondesc[1:-1].strip().split(', ')
configs = [c.lower() for c in configs]
else:
optiontype = optiondesc
configs = []
options.append(option_make(optionname, optiontype, configs))
self.styledefinition = styledef_make(options)
评论列表
文章目录