Skip to content

Add map.child option to parse bare colon as child$ property on maps#45

Merged
rjrodger merged 5 commits intomasterfrom
claude/add-list-pair-option-QQMxH
Mar 2, 2026
Merged

Add map.child option to parse bare colon as child$ property on maps#45
rjrodger merged 5 commits intomasterfrom
claude/add-list-pair-option-QQMxH

Conversation

@rjrodger
Copy link
Collaborator

@rjrodger rjrodger commented Mar 2, 2026

No description provided.

claude added 5 commits March 2, 2026 18:33
…ists

When list.pair is true (default false), [a:1] parses as [{"a":1}] instead
of setting "a" as a property on the array. list.pair takes precedence over
list.property when both are true. Uses the same grammar rules as
list.property (KEY CL pattern, path dives, etc.).

Examples:
  [a:1]       -> [{"a":1}]
  [a:1,2,b:3] -> [{"a":1},2,{"b":3}]
  [a:b:1]     -> [{"a":{"b":1}}]

https://claude.ai/code/session_01243eqnwQ2sKcfwQgdtqV7A
- Create feature-list-pair.tsv with 51 test cases covering basic pairs,
  mixed pairs/values, braces, brackets, path dives, nulls, strings,
  trailing commas, space separation, and nested list.pair behavior
- Add tsvTestWith helper for running TSV tests with custom options
- Add list-pair-interaction test covering all four option combinations:
  pair=F/prop=T (default), pair=F/prop=F (error), pair=T/prop=T
  (pair precedence), pair=T/prop=F (pair precedence)
- Test explicit maps and nested lists inside list.pair contexts
- Verify maps outside lists are unaffected by list.pair

https://claude.ai/code/session_01243eqnwQ2sKcfwQgdtqV7A
When list.child is true (default false), [:value] syntax stores the
value on the array as the child$ property. Multiple child values merge
using the same logic as map.extend (deep merge by default, last-wins
when extend is false).

Examples:
  [:1]           -> [] with child$=1
  [1,:2,3]       -> [1,3] with child$=2
  [:{a:1},:{b:2}]-> [] with child$={a:1,b:2}

Works independently with list.property and list.pair. Maps outside
lists are unaffected.

TSV tests: feature-list-child.tsv (44 cases),
feature-list-child-pair.tsv (17 cases), plus JS interaction tests.

https://claude.ai/code/session_01243eqnwQ2sKcfwQgdtqV7A
- TSV tests for outermost child$ with nested lists (feature-list-child-deep.tsv)
- TSV tests for pair+child deep nesting (feature-list-child-pair-deep.tsv)
- JS tests verifying child$ at every nesting depth: 2-level, 3-level,
  child-as-value chaining, sibling lists, maps containing lists with child$,
  and pair+child combinations at multiple levels

https://claude.ai/code/session_01243eqnwQ2sKcfwQgdtqV7A
When map.child is true (default false), {:1,a:2} parses as
{"child$":1,"a":2}. Multiple child values merge using the same
deep-merge logic as duplicate keys (map.extend/map.merge).

- Grammar: add CL alternate in pair rule open, with bc handler
  for child$ assignment and merge
- Works in explicit maps ({:1}), implicit maps (a:1,:2), and
  nested maps at any depth
- TSV tests: feature-map-child.tsv (31 cases), feature-map-child-deep.tsv
  (10 cases for deep structures with both map.child and list.child)
- JS tests: map-child-interaction covering disabled default, merge
  semantics, extend=false, independence from list.child, nested maps
  with child$ at multiple levels, and cross-feature interactions

https://claude.ai/code/session_01243eqnwQ2sKcfwQgdtqV7A
@rjrodger rjrodger merged commit cbdac59 into master Mar 2, 2026
5 of 7 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