Migrate if, while, and for header errors to structured diagnostics
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
Tracked by #346.
## Why
Malformed control-flow headers in `front/parser/src/parser/control.rs` still emit ad-hoc `println!` messages for missing parentheses, semicolons, and braces.
## Scope
- Convert the `if`, `else if`, `else`, `while`, and `for` header failure paths to structured parser errors.
- Preserve the nearest useful line and token.
- Include expected/found/context information consistent with existing E2001 diagnostics.
- Add focused negative tests for one missing delimiter per construct.
- Do not change control-flow syntax or truthy semantics.
## Completion criteria
- [ ] Changed paths do not print directly.
- [ ] Each construct has at least one location-aware regression.
- [ ] Existing valid control-flow tests continue to pass.
- [ ] Human and JSON diagnostic modes both receive the same parser failure.
Contributor guide
Research direction
Start in front/parser/src/parser/control.rs and inspect the existing E2001 diagnostics to understand their expected/found/context format. Locate the control-flow tests, then add focused negative cases for missing delimiters in if, else if, else, while, and for headers. Done means no direct printing in the changed paths, location-aware regressions for each construct, unchanged valid syntax and truthy semantics, and matching human and JSON diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100