Repository navigation
recover missing-then if clause AST recovery - #798
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 194c704742
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf51384872
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccc5ddac8c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Recover
IfClausenodes underRecoverErrorswhenthenis omitted beforefi,else, orelif.What Changed
if/elifheads againstthen,fi,else, andelifso missing-thenforms can still build a structured*syntax.IfClauseThenPosand split the parsed statements intoCondandThenwhen the first body statement appears before the missingthenThenPosas a realif/elifmarker in AST consumers and printingif <cond>\n<body>\nfiif <cond>\n<body>\nelse ...elifchains with a missingthenWhy
The parser previously recovered the missing
thentoken position but did not preserve the surrounding clause structure. In missing-thenforms, that left the body unavailable asIfClause.Thenand forced downstream fallback logic to infer the shape from less structured parser output.Impact
Recovered
IfClausetrees now expose the missing-thenbody andelse/elifstructure directly, which should remove the need for the fallback handling behind SH-175 and SH-176.Validation
go test ./shell/syntax -count=1make lint