This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
charlespwd
force-pushed
the
feature/40-liquid-variable-expression
branch
from
August 3, 2022 13:09
b591d8c
to
afc4caa
Compare
This kicks off the "proper" parsing of Liquid. Herein, we start extending the ohm grammar to support Liquid constructs inside the markup of `LiquidDrop`s. It goes: ``` LiquidDrop { markup: LiquidVariable { expression: LiquidString filters: LiquidFilter[] } } ``` And if we can't parse the string, we fallback to the old implementation that didn't parse anything. This means `{{ 'string' }}` will get replaced to `{{ "string" }}` unless `prettierOptions.singleQuote`
true, false, empty, blank, nil, null
```liquid {{ (0..5) }} {{ (true..false) }} etc... ```
charlespwd
force-pushed
the
feature/40-liquid-variable-expression
branch
from
August 3, 2022 19:29
1e19895
to
72d344d
Compare
charlespwd
commented
Aug 3, 2022
charlespwd
commented
Aug 3, 2022
e.g. ```liquid {{ x }} {{ x.y }} {{ x.y.z }} {{ x[y].z }} ``` Look at test/liquid-drop-variable-lookup for more examples
charlespwd
force-pushed
the
feature/40-liquid-variable-expression
branch
from
August 3, 2022 19:42
72d344d
to
6bdfef0
Compare
This was referenced Aug 3, 2022
Closed
pdubroy
reviewed
Aug 5, 2022
As @pdubroy graciously pointed out in [1], we would have eagerly matched on variables with keywords in them. e.g. `true_thing` would have eagerly matched on the literal rule instead of the variable lookup rule. This commit prevents this from happening for all our literals. [1]: #41 (comment)
karreiro
approved these changes
Aug 8, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @charlespwd! LGTM, I've left only one minor/optional comment :)
charlespwd
force-pushed
the
feature/40-liquid-variable-expression
branch
from
August 8, 2022 14:33
c2f0349
to
e7b7e61
Compare
It looks like we prefer single quotes inside Liquid. In a similar fashion to jsxSingleQuote, this PR adds liquidSingleQuote and makes it so we prefer single quotes inside liquid tags and drops.
charlespwd
force-pushed
the
feature/40-liquid-variable-expression
branch
from
August 8, 2022 14:33
e7b7e61
to
79a00f7
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is about "proper" parsing and printing of the following Liquid in Liquid Drops:
It exists as ground work for everything else, because we'll use those.
Fixes #40