Skip to content

Add map.child, list.pair options and TSV-driven tests for all 7 feature files#46

Merged
rjrodger merged 4 commits intomasterfrom
claude/add-mapref-option-bJI6D
Mar 2, 2026
Merged

Add map.child, list.pair options and TSV-driven tests for all 7 feature files#46
rjrodger merged 4 commits intomasterfrom
claude/add-mapref-option-bJI6D

Conversation

@rjrodger
Copy link
Collaborator

@rjrodger rjrodger commented Mar 2, 2026

No description provided.

claude added 4 commits March 2, 2026 22:55
Similar to ListRef, when MapRef is enabled maps are returned as MapRef
instances with Val (map[string]any) and Implicit (bool) fields. Implicit
is true when the map was created without braces, false when braces were
used explicitly. Deep merge and clone handle MapRef correctly.

https://claude.ai/code/session_01D5CGemFCpBTz79UDLSMjVf
Tests cover: explicit/implicit wrapping combinations, empty structures,
triple/quad nesting (MapRef>ListRef>MapRef>ListRef), path dive, deep
merge preserving both Ref wrappers, mixed content types, pair-in-list,
strict JSON compat, all three options combined (MapRef+ListRef+TextInfo),
null values in combined structures, and scalar passthrough.

https://claude.ai/code/session_01D5CGemFCpBTz79UDLSMjVf
Implements the list.child option from the TypeScript codebase. When
List.Child is enabled, bare colon syntax in lists (e.g. `[:1, a, b]`)
stores the colon-prefixed value in ListRef.Child instead of as a list
element. Multiple child values are deep-merged (or last-wins when
Map.Extend is false).

Changes:
- ListRef struct: add Child field for optional child value
- ListOptions: add Child *bool option (default: false)
- LexConfig: add ListChild bool
- Grammar: add elem Open alt matching bare CL token, elem BC handler
  to accumulate child values on parent list rule, list BC handler to
  transfer child$ to ListRef.Child
- Utility: deepClone and deepMerge handle ListRef.Child
- list.child auto-enables ListRef (required to store Child in Go)
- 48 tests covering all TS spec cases: scalars, maps, lists, deep
  merge, path dive, trailing/leading commas, interleaved children,
  MapRef+TextInfo interaction, extend disabled

https://claude.ai/code/session_01D5CGemFCpBTz79UDLSMjVf
…re files

Implements map.child: bare colon `:value` in maps stores as `child$` key.
Implements list.pair: pairs in lists become `{key:val}` object elements.

Adds TSV-driven tests that validate against all 7 previously uncovered
test spec files, ensuring feature parity with the TypeScript version:
- feature-list-child.tsv (45 cases)
- feature-list-child-deep.tsv (20 cases)
- feature-list-child-pair.tsv (18 cases)
- feature-list-child-pair-deep.tsv (8 cases)
- feature-list-pair.tsv (52 cases)
- feature-map-child.tsv (32 cases)
- feature-map-child-deep.tsv (11 cases)

All 37 TSV spec files are now covered by Go tests.

https://claude.ai/code/session_01D5CGemFCpBTz79UDLSMjVf
@rjrodger rjrodger merged commit 4182c47 into master Mar 2, 2026
1 check was pending
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