Skip to content

Rewrite Go CSV to use jsonic grammar rules matching TypeScript implem…#2

Merged
rjrodger merged 5 commits intomainfrom
claude/go-jsonic-implementation-ScdZ4
Mar 5, 2026
Merged

Rewrite Go CSV to use jsonic grammar rules matching TypeScript implem…#2
rjrodger merged 5 commits intomainfrom
claude/go-jsonic-implementation-ScdZ4

Conversation

@rjrodger
Copy link
Contributor

@rjrodger rjrodger commented Mar 5, 2026

…entation

The previous implementation bypassed jsonic's grammar system entirely, using a standalone parser. This rewrite mirrors the TypeScript CSV plugin architecture with proper jsonic grammar rules (csv, newline, record, list, elem, val, text) and a custom CSV string matcher for RFC 4180 double-quote escaping.

Key changes:

  • csv.go: Options and types only (removed standalone parser)
  • plugin.go: Full grammar-based implementation using jsonic Rule/AltSpec
  • Custom #RL/#RS token types to work around jsonic's global IGNORE set
  • Single-newline lexing for proper empty record handling
  • Comment starter cleanup when comments are disabled

https://claude.ai/code/session_01Ehie1ims4jJtda9A6MmD1x

claude added 5 commits March 5, 2026 15:22
…entation

The previous implementation bypassed jsonic's grammar system entirely,
using a standalone parser. This rewrite mirrors the TypeScript CSV plugin
architecture with proper jsonic grammar rules (csv, newline, record,
list, elem, val, text) and a custom CSV string matcher for RFC 4180
double-quote escaping.

Key changes:
- csv.go: Options and types only (removed standalone parser)
- plugin.go: Full grammar-based implementation using jsonic Rule/AltSpec
- Custom #RL/#RS token types to work around jsonic's global IGNORE set
- Single-newline lexing for proper empty record handling
- Comment starter cleanup when comments are disabled

https://claude.ai/code/session_01Ehie1ims4jJtda9A6MmD1x
The trim.json fixture had unresolved git merge conflict markers from
the merge of main, causing the TS fixtures test to fail with a JSON
parse error.

https://claude.ai/code/session_01Ehie1ims4jJtda9A6MmD1x
On Windows, git's core.autocrlf converts \n to \r\n on checkout,
which breaks CSV fixture tests that depend on specific line endings
inside quoted fields (e.g. papa-quoted-field-with-line-break).
Mark fixture files as binary to prevent line ending conversion.

https://claude.ai/code/session_01Ehie1ims4jJtda9A6MmD1x
@rjrodger rjrodger merged commit 75fce8b into main Mar 5, 2026
5 checks passed
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.

2 participants