summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2024-07-18 16:39:38 +0200
committerjaseg <git@jaseg.de>2024-07-18 16:39:38 +0200
commit1ecb7be6f9ccabf9ae50af5ad20ce1cc79a01973 (patch)
treec58ef3eb2dd0a109d3866bf04cbf61da62abac3f
parentef9d61ffd50eddd3f08288ae6d682dd01cb5191b (diff)
downloadgerbonara-1ecb7be6f9ccabf9ae50af5ad20ce1cc79a01973.tar.gz
gerbonara-1ecb7be6f9ccabf9ae50af5ad20ce1cc79a01973.tar.bz2
gerbonara-1ecb7be6f9ccabf9ae50af5ad20ce1cc79a01973.zip
Improve aperture macros doc
-rw-r--r--gerbonara/aperture_macros/expression.py4
-rw-r--r--gerbonara/aperture_macros/parse.py2
2 files changed, 5 insertions, 1 deletions
diff --git a/gerbonara/aperture_macros/expression.py b/gerbonara/aperture_macros/expression.py
index 7c291cb..2926aa7 100644
--- a/gerbonara/aperture_macros/expression.py
+++ b/gerbonara/aperture_macros/expression.py
@@ -180,6 +180,9 @@ class ConstantExpression(Expression):
@dataclass(frozen=True, slots=True)
class VariableExpression(Expression):
+ ''' An expression that encapsulates some other complex expression and will replace all occurences of it with a newly
+ allocated variable at export time.
+ '''
expr: Expression
def optimized(self, variable_binding={}):
@@ -201,6 +204,7 @@ class VariableExpression(Expression):
@dataclass(frozen=True, slots=True)
class ParameterExpression(Expression):
+ ''' An expression that refers to a macro variable or parameter '''
number: int
def optimized(self, variable_binding={}):
diff --git a/gerbonara/aperture_macros/parse.py b/gerbonara/aperture_macros/parse.py
index 3887d98..9f6375f 100644
--- a/gerbonara/aperture_macros/parse.py
+++ b/gerbonara/aperture_macros/parse.py
@@ -93,7 +93,7 @@ class ApertureMacro:
name, _, expr = block.partition('=')
number = int(name[1:])
if number in variables:
- warnings.warn(f'Re-definition of aperture macro variable ${number} inside macro. Previous definition of ${number} was ${variables[number]}.')
+ warnings.warn(f'Re-definition of aperture macro variable ${number} inside aperture macro "{macro_name}". Previous definition of ${number} was ${variables[number]}.')
variables[number] = _parse_expression(expr, variables, parameters)
except Exception as e:
raise SyntaxError(f'Error parsing variable definition {block!r}') from e