Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assign tag syntax errors #103

Closed
jg-rp opened this issue Jan 11, 2023 · 0 comments
Closed

assign tag syntax errors #103

jg-rp opened this issue Jan 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jg-rp
Copy link
Owner

jg-rp commented Jan 11, 2023

The {% assign %} tag does not currently catch Liquid syntax errors from trailing garbage, after a valid filtered expression. In this example, the erroneous offset: 2 is silently ignored.

{% assign foo = 'bar' offset:2 %}

In other words, we don't check for EOF after parsing the left hand side of the assignment expression.

match = RE_ASSIGNMENT.match(stream.current.value)
if match:
name, expression = match.groups()
else:
raise LiquidSyntaxError(
f'invalid assignment expression "{stream.current.value}"',
linenum=stream.current.linenum,
)
return AssignNode(
tok,
AssignmentExpression(name, self._parse_expression(expression)),
)

@jg-rp jg-rp added the bug Something isn't working label Jan 11, 2023
@jg-rp jg-rp closed this as completed in 87cace9 Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant