Add for_loop? to Include tag for AST-based keyword detection - #2064
Merged
Conversation
aswamy
force-pushed
the
strict2-include-tablerow
branch
from
March 23, 2026 21:34
19568df to
55f3a37
Compare
aswamy
marked this pull request as ready for review
March 23, 2026 21:38
charlespwd
reviewed
Mar 24, 2026
| assert_match(/Unexpected character =/, error.message) | ||
| end | ||
| end | ||
| # -- for_loop? AST-based keyword detection -- |
Contributor
There was a problem hiding this comment.
Looks good but let's remove that comment. IDK why claude loves these so much. I struggle with em too.
charlespwd
approved these changes
Mar 24, 2026
aswamy
force-pushed
the
strict2-include-tablerow
branch
2 times, most recently
from
March 24, 2026 14:30
b9745e5 to
7253e3e
Compare
graygilmore
approved these changes
Mar 24, 2026
EvilGenius13
approved these changes
Mar 24, 2026
Store @is_for_loop during parsing so consumers can determine the with/for keyword from the AST instead of re-parsing raw markup. Matches the existing pattern in the Render tag. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aswamy
force-pushed
the
strict2-include-tablerow
branch
from
March 24, 2026 18:52
7253e3e to
346166b
Compare
graygilmore
approved these changes
Mar 24, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Stores
@is_for_loopduring parsing in theIncludetag, matching the existing pattern in theRendertag. This allows consumers (like the liquid-rewriter) to determine thewith/forkeyword from the parsed AST instead of re-parsing raw markup with regex.Changes:
FOR = 'for'constantfor_loop?public methodstrict2_parse: captures thewith/fortoken fromp.id?and stores@is_for_looplax_parse: updatedSYNTAXregex to capture the keyword in its own group (group 3), stores@is_for_loopNo runtime behavior change —
Include#render_to_output_bufferstill usesvariable.is_a?(Array)for iteration, not@is_for_loop.Depends on: Shopify/liquid-rewriter-private#214
Tophat
bundle install bundle exec irb -r liquid🤖 Generated with Claude Code