Cleanup and bugfixes: remove dead IR, fix lexer and args parsing#9
Cleanup and bugfixes: remove dead IR, fix lexer and args parsing#9arismoko wants to merge 4 commits into
Conversation
…ontalRule Remove unused IR types that were never produced by the parser: - Inline: Bold, Italic, Underline, Strikethrough, Highlight, Code, Link, Image - Block: HorizontalRule Also remove corresponding emission code in nodes.ts and update inline-text.ts walker to only handle Styled wrapper nodes.
Add paragraphDepth tracking to lexer. Only recognize // as a comment when outside paragraph blocks [...]. Inside [...], // is literal text.
parseFloat silently truncates at first invalid character, so '1-2' would parse as 1 without error. Added regex validation to ensure the scanned string is a valid JSON5 number format before accepting it.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e26445f12
ℹ️ 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".
| // Line comment | ||
| if (char === "/" && this.peek(1) === "/") { | ||
| // Line comment (only outside paragraph context - Spec §3.2) | ||
| if (char === "/" && this.peek(1) === "/" && this.paragraphDepth === 0) { |
There was a problem hiding this comment.
Decouple line-comment lexing from bracket depth
Restricting // comments to paragraphDepth === 0 causes recovery regressions after malformed args that contain an unmatched [ (e.g. @d(a:[1,2)\n// note\n@x): the lexer never returns to depth 0, so subsequent structural comments are tokenized as plain text instead of COMMENT, producing cascaded UNEXPECTED_TOKEN warnings and violating the spec’s structural-comment and recovery guarantees (§3.2, §17.2/§17.3).
Useful? React with 👍 / 👎.
Summary
This PR addresses P0 and P1 issues found during codebase review:
P0 (Dead Code)
Bold,Italic,Underline,Strikethrough,Highlight,Code,Link,Imagefrom IR and emitter. These were defined and had emission code but no producer in the evaluator.HorizontalRule: Same issue — defined but never produced.P1 (Spec Violations / Correctness Bugs)
//inside paragraph blocks[...]should be literal text, not a comment. The lexer was incorrectly producing COMMENT tokens inside paragraphs.1-2whichparseFloatsilently truncated to1. Now properly validates and emits diagnostics for malformed numbers.Spec Cleanup
@if/@forfrom deferred section: Control flow directives are deferred indefinitely per discussion — removed from spec to avoid tracking features that won't be implemented.Test plan
1-2,1..2,-+1patterns🤖 Managed by Pip (Ari's AI assistant)