diff options
author | jaseg <git@jaseg.de> | 2022-05-21 15:28:41 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2022-05-21 15:28:41 +0200 |
commit | 45cd00387e3e3538b80610cf1140b9271ba29d49 (patch) | |
tree | c42832bdaa56bc9176b05685244ac7851852b0a9 /gerbonara/aperture_macros | |
parent | a1de37d83f22a883f5e4605e59b82aea69b4a563 (diff) | |
download | gerbonara-45cd00387e3e3538b80610cf1140b9271ba29d49.tar.gz gerbonara-45cd00387e3e3538b80610cf1140b9271ba29d49.tar.bz2 gerbonara-45cd00387e3e3538b80610cf1140b9271ba29d49.zip |
Fix parsing of aperture macro comments
Diffstat (limited to 'gerbonara/aperture_macros')
-rw-r--r-- | gerbonara/aperture_macros/parse.py | 9 |
1 files changed, 6 insertions, 3 deletions
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:]) |