You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid syntax in assign tag should throw syntax error #229
Basically there is no uniformity whatsoever when it comes to parsing. Every tag just throws regexes at it.
So some tags have robust parsers with error messages, and others like variable tags don't throw syntax errors ever.
It is actually impossible to make a variable tag throw a syntax error:
Arbitrary text in variables without quotes ({{http://disney.com/logo.gif}})
Empty Filters ({{hi|||}})
Bad filter separators ({{number_of_comments | pluralize: 'comment': 'comments'}})
Breaking these would probably need a major version bump, but I think it is worth it since they are all pretty wtf.
@fw42 I have an idea for how to implement the deprecation warnings so they catch all cases.
We can include the new parser in Liquid 2.6 but just have all syntax errors be output as deprecation warnings and then fall back on the old parser.
It will take the performance hit of parsing twice but only for tags with broken syntax.
Activity
trishume commentedon Jul 23, 2013
This occurs anywhere that
Liquid::Variableis used.trishume commentedon Jul 24, 2013
In related news:
fw42 commentedon Jul 24, 2013
💩
fw42 commentedon Jul 24, 2013
Is this only happening when parsing variables?
trishume commentedon Jul 24, 2013
Basically there is no uniformity whatsoever when it comes to parsing. Every tag just throws regexes at it.
So some tags have robust parsers with error messages, and others like variable tags don't throw syntax errors ever.
It is actually impossible to make a variable tag throw a syntax error:
trishume commentedon Jul 25, 2013
Darn it. I wanted not to modify the existing test suite but the suite has tests that assert that the parsing is crap.
Like the stupid argument separators here:
and the not using quotation marks here:
fw42 commentedon Jul 25, 2013
imho, we should just break them and fix the shitty templates afterwards instead of forcing ourselves to keep this crappy parsing.
trishume commentedon Jul 25, 2013
What should we break:
{{http://disney.com/logo.gif}}){{hi|||}}){{number_of_comments | pluralize: 'comment': 'comments'}})Breaking these would probably need a major version bump, but I think it is worth it since they are all pretty wtf.
fw42 commentedon Jul 25, 2013
Yeah we can do that for Liquid 3.0, and add some logging in Shopify for 2.6 to find out what we will need to fix.
trishume commentedon Jul 25, 2013
Deprecation warnings ftw!
trishume commentedon Jul 25, 2013
Darn, my new parser has a negative effect on the benchmark. Time to get out the profiler!
Old:
New:
trishume commentedon Jul 25, 2013
@fw42 I have an idea for how to implement the deprecation warnings so they catch all cases.
We can include the new parser in Liquid 2.6 but just have all syntax errors be output as deprecation warnings and then fall back on the old parser.
It will take the performance hit of parsing twice but only for tags with broken syntax.