mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Tools: param_parse.py: allow whitespace between vehicles
Also add sanity check that the vehicles you're limitting to we know about
This commit is contained in:
parent
205b32b57c
commit
355c1c3a23
@ -21,12 +21,12 @@ parser.add_option("--vehicle", default='*', help="Vehicle type to generate for"
|
||||
|
||||
# Regular expressions for parsing the parameter metadata
|
||||
|
||||
prog_param = re.compile(r"@Param: (\w+).*((?:\n[ \t]*// @(\w+)(?:{([,\w]+)})?: (.*))+)(?:\n\n|\n[ \t]+[A-Z])", re.MULTILINE)
|
||||
prog_param = re.compile(r"@Param: (\w+).*((?:\n[ \t]*// @(\w+)(?:{([^}]+)})?: (.*))+)(?:\n\n|\n[ \t]+[A-Z])", re.MULTILINE)
|
||||
|
||||
# match e.g @Value: 0=Unity, 1=Koala, 17=Liability
|
||||
prog_param_fields = re.compile(r"[ \t]*// @(\w+): (.*)")
|
||||
# match e.g @Value{ArduCopter}: 0=Volcano, 1=Peppermint
|
||||
prog_param_tagged_fields = re.compile(r"[ \t]*// @(\w+){([\w,]+)}: (.*)")
|
||||
prog_param_tagged_fields = re.compile(r"[ \t]*// @(\w+){([^}]+)}: (.*)")
|
||||
|
||||
prog_groups = re.compile(r"@Group: *(\w+).*((?:\n[ \t]*// @(Path): (\S+))+)", re.MULTILINE)
|
||||
|
||||
@ -160,6 +160,10 @@ def process_library(vehicle, library, pathprefix=None):
|
||||
fields = prog_param_tagged_fields.findall(field_text)
|
||||
for field in fields:
|
||||
only_for_vehicles = field[1].split(",")
|
||||
only_for_vehicles = [ x.rstrip().lstrip() for x in only_for_vehicles ]
|
||||
delta = set(only_for_vehicles) - set(truename_map.values())
|
||||
if len(delta):
|
||||
error("Unknown vehicles (%s)" % delta)
|
||||
debug("field[0]=%s vehicle=%s truename=%s field[1]=%s only_for_vehicles=%s\n" % (field[0], vehicle.name,vehicle.truename,field[1], str(only_for_vehicles)))
|
||||
if vehicle.truename not in only_for_vehicles:
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user