Skip to content

syntax: fix pattern parser regressions - #809

Merged
ewhauser merged 2 commits into
mainfrom
ewhauser/fix-pattern-parser-regressions
Mar 30, 2026
Merged

ewhauser merged 2 commits into
mainfrom
ewhauser/fix-pattern-parser-regressions

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

  • make raw pattern reparsing honor the parser's extglob setting in [[ ... ]], case, and extglob arms
  • stop invalid bare ( in pattern scanners from consuming the rest of the conditional or file during recovery
  • add regression tests for disabled extglob parsing and recoverable invalid bare-paren patterns

Root Cause

The new raw-pattern parsing path only carried LangVariant, so it ignored ParseExtGlob(false) and still materialized ExtGlob nodes in pattern contexts. The pattern scanner also treated every bare ( as structural depth, which prevented it from recognizing normal pattern boundaries like ]] after invalid input.

Impact

This restores the documented ParseExtGlob(false) behavior in pattern contexts and keeps RecoverErrors from dropping later statements after invalid bare-paren patterns.

Validation

  • go test ./shell/syntax ./internal/shell/...

@ewhauser
ewhauser merged commit 74992d9 into main Mar 30, 2026
16 checks passed
@ewhauser
ewhauser deleted the ewhauser/fix-pattern-parser-regressions branch March 30, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant