Skip to content

case-pattern position must lex compound keywords as words: case x in case) ... still parse-errors (issue308 residue, 2 reds) #372

Closed

Description

@caomengxuan666

Found by ecosweep4-B triage lane (wt23/bats364, 2026-10-01). The two remaining issue308_regressions reds (every_compound_keyword_in_pattern_is_inert, harden_mm_reserved_word_pattern_continuation_parses) — #308's main fix landed; these residual assertions have never been green since the ecosweep4 zero point (not a regression of this window).

Reproducer

The tests drive a generated case.sh where a case PATTERN contains a compound keyword (e.g. case / esac as pattern text). rubash reports:

case.sh: line 3: syntax error: unexpected end of file from `case' command on line 2
case.sh: line 11: syntax error: unexpected end of file from `(' command on line 3

GNU 5.3.0 accepts the file (patterns are read as WORDS; the parser only recognizes reserved words in command position — parse.y read_token / case production consumes patterns via read_token_word).

Evidence

Test failure output captured in the lane run; test bodies at tests/issue308_regressions.rs (the two names above). This is a parser admission issue (pattern position keyword handling), same family as the #360/#361 over-lax/over-strict admissions.

Activity

  1. added
    bug
    on Oct 1, 2026
  2. added 2 commits that reference this issue on Oct 1, 2026
  3. caomengxuan666 commented on Oct 1, 2026

    @caomengxuan666
    MemberAuthor

    Landed as 50cd08c (wt25/semix lane commit 34492264). The parser sentinels were innocent — the lexer close-char scanner's case-word machine lacked pattern-region state (GNU parse.y:3177-3186 CHECK_FOR_RESERVED_WORD + parser.h:29 PST_CASEPAT: reserved words are not recognized inside pattern lists). Fix converges to the real parser (#117 move 2): a command-position '(' unclosed verdict is disproved by a full tokenize+parse producing no parse-error nodes; other verdict shapes (quotes/${/$(/array/[) are read-time matched-pair verdicts the tokenizer owns and are never overridden (scope verified: unclosed-quote diagnostics unchanged). issue308 residue 2 reds now green; issue372 suite 8/8; issue376 family intact. CI green on 50cd08c. Residues filed: comsub-executor same-family blind spot + empty-case newline divergence.

  4. added a commit that references this issue on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions