mirror of https://github.com/ArduPilot/ardupilot
Tools: param_parse.py: use single regex for params everywhere
This commit is contained in:
parent
a45ab6b84c
commit
e0125a68e7
|
@ -23,7 +23,7 @@ parser.add_option("--no-emit", dest='emit_params', action='store_false', default
|
||||||
|
|
||||||
# Regular expressions for parsing the parameter metadata
|
# Regular expressions for parsing the parameter metadata
|
||||||
|
|
||||||
prog_param = re.compile(r"@Param: *(\w+).*((?:\n[ \t]*// @(\w+): (.*))+)(?:\n\n|\n[ \t]+[A-Z])", re.MULTILINE)
|
prog_param = re.compile(r"@Param: (\w+).*((?:\n[ \t]*// @(\w+)(?:{([,\w]+)})?: (.*))+)(?:\n\n|\n[ \t]+[A-Z])", re.MULTILINE)
|
||||||
|
|
||||||
# match e.g @Value: 0=Unity, 1=Koala, 17=Liability
|
# match e.g @Value: 0=Unity, 1=Koala, 17=Liability
|
||||||
prog_param_fields = re.compile(r"[ \t]*// @(\w+): (.*)")
|
prog_param_fields = re.compile(r"[ \t]*// @(\w+): (.*)")
|
||||||
|
@ -32,9 +32,6 @@ prog_param_tagged_fields = re.compile(r"[ \t]*// @(\w+){([\w,]+)}: (.*)")
|
||||||
|
|
||||||
prog_groups = re.compile(r"@Group: *(\w+).*((?:\n[ \t]*// @(Path): (\S+))+)", re.MULTILINE)
|
prog_groups = re.compile(r"@Group: *(\w+).*((?:\n[ \t]*// @(Path): (\S+))+)", re.MULTILINE)
|
||||||
|
|
||||||
# prog_group_param = re.compile(r"@Param: (\w+).*((?:\n[ \t]*// @(\w+): (.*))+)(?:\n\n|\n[ \t]+[A-Z])", re.MULTILINE)
|
|
||||||
prog_group_param = re.compile(r"@Param: (\w+).*((?:\n[ \t]*// @(\w+)(?:{([,\w]+)})?: (.*))+)(?:\n\n|\n[ \t]+[A-Z])", re.MULTILINE)
|
|
||||||
|
|
||||||
apm_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../')
|
apm_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../')
|
||||||
vehicle_paths = glob.glob(apm_path + "%s/Parameters.cpp" % opts.vehicle)
|
vehicle_paths = glob.glob(apm_path + "%s/Parameters.cpp" % opts.vehicle)
|
||||||
extension = 'cpp'
|
extension = 'cpp'
|
||||||
|
@ -142,7 +139,7 @@ def process_library(vehicle, library, pathprefix=None):
|
||||||
error("Path %s not found for library %s" % (path, library.name))
|
error("Path %s not found for library %s" % (path, library.name))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
param_matches = prog_group_param.findall(p_text)
|
param_matches = prog_param.findall(p_text)
|
||||||
debug("Found %u documented parameters" % len(param_matches))
|
debug("Found %u documented parameters" % len(param_matches))
|
||||||
for param_match in param_matches:
|
for param_match in param_matches:
|
||||||
p = Parameter(library.name+param_match[0])
|
p = Parameter(library.name+param_match[0])
|
||||||
|
|
Loading…
Reference in New Issue