Skip to content

Merge two-pass parser into single pass with array-based output and specific error messages#2

Merged
otar merged 1 commit into
mainfrom
claude/improve-implementation-fN2FN
Apr 16, 2026
Merged

Merge two-pass parser into single pass with array-based output and specific error messages#2
otar merged 1 commit into
mainfrom
claude/improve-implementation-fN2FN

Conversation

@otar

@otar otar commented Apr 16, 2026

Copy link
Copy Markdown
Owner
  • Replace removeComments() + removeTrailingCommas() with a single processInput()
    that handles comments and trailing commas in one iteration over the input
  • The trailing-comma lookahead is now comment-aware: it skips // and /* */
    regions when scanning forward for } or ], enabling correct handling of
    patterns like {"a": 1, // comment\n}
  • Switch string accumulation from $result .= $char to $result[] = $char with
    a final implode(), avoiding O(n²) realloc behavior on large inputs
  • Distinguish unclosed string vs unclosed block comment in error sentinels:
    "unclosed string literal" vs "unclosed block comment"
  • Remove isWhitespace() helper (inlined into processInput() lookahead)

All 100 existing tests pass.

https://claude.ai/code/session_01KABhJ1aojwpPmJ3fGhVxsZ

…ecific error messages

- Replace removeComments() + removeTrailingCommas() with a single processInput()
  that handles comments and trailing commas in one iteration over the input
- The trailing-comma lookahead is now comment-aware: it skips // and /* */
  regions when scanning forward for } or ], enabling correct handling of
  patterns like {"a": 1, // comment\n}
- Switch string accumulation from $result .= $char to $result[] = $char with
  a final implode(), avoiding O(n²) realloc behavior on large inputs
- Distinguish unclosed string vs unclosed block comment in error sentinels:
  "unclosed string literal" vs "unclosed block comment"
- Remove isWhitespace() helper (inlined into processInput() lookahead)

All 100 existing tests pass.

https://claude.ai/code/session_01KABhJ1aojwpPmJ3fGhVxsZ
@otar otar merged commit db7ee28 into main Apr 16, 2026
4 checks passed
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@otar otar deleted the claude/improve-implementation-fN2FN branch April 17, 2026 07:45
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.

3 participants