Improve aperture macros doc

This commit is contained in:
jaseg 2024-07-18 16:39:38 +02:00
parent ef9d61ffd5
commit 1ecb7be6f9
2 changed files with 5 additions and 1 deletions

View file

@ -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={}):

View file

@ -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