From 45cd00387e3e3538b80610cf1140b9271ba29d49 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 21 May 2022 15:28:41 +0200 Subject: Fix parsing of aperture macro comments --- gerbonara/aperture_macros/parse.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gerbonara') diff --git a/gerbonara/aperture_macros/parse.py b/gerbonara/aperture_macros/parse.py index a679247..1eaa317 100644 --- a/gerbonara/aperture_macros/parse.py +++ b/gerbonara/aperture_macros/parse.py @@ -56,14 +56,17 @@ class ApertureMacro: def parse_macro(cls, name, body, unit): macro = cls(name) - blocks = re.sub(r'\s', '', body).split('*') + blocks = body.split('*') for block in blocks: if not (block := block.strip()): # empty block continue - if block[0:1] == '0 ': # comment - macro.comments.append(Comment(block[2:])) + if block.startswith('0 '): # comment + macro.comments.append(block[2:]) + continue + block = re.sub(r'\s', '', block) + if block[0] == '$': # variable definition name, expr = block.partition('=') number = int(name[1:]) -- cgit