Skip to content

Parser: Allow inline in expressions outside of case statements#1821

Merged
marcoroth merged 3 commits into
marcoroth:mainfrom
ttilberg:1758-allow-pattern-match-expressions-outside-of-case
Jun 28, 2026
Merged

Parser: Allow inline in expressions outside of case statements#1821
marcoroth merged 3 commits into
marcoroth:mainfrom
ttilberg:1758-allow-pattern-match-expressions-outside-of-case

Conversation

@ttilberg

@ttilberg ttilberg commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Currently using value in pattern without an accompanied case statement raises ERBControlFlowScopeError.

<% if value in pattern %>
  True
<% end %>
`<% in %>` appears outside its control flow block. Keep ERB control flow statements together within the same HTML scope (tag, attribute, or content). (Herb Parser [ERB_CONTROL_FLOW_SCOPE_ERROR])

Now a pattern match predicate only increments in_node_count when it's accompanied by a case statement.

I used Claude to help me understand how to make this change -- so please look it over and determine if this is the correct type of fix.

Fixes #1758

@marcoroth marcoroth changed the title Allow inline pattern match expressions outside of case statements Parser: Allow inline in expressions outside of case statements Jun 28, 2026

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome catch, thank you so much @ttilberg! 🙏🏼

@marcoroth marcoroth merged commit d492146 into marcoroth:main Jun 28, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser: ERB_CONTROL_FLOW_SCOPE_ERROR when using pattern matching for conditional display

2 participants