Add map.child option to parse bare colon as child$ property on maps#45
Merged
Add map.child option to parse bare colon as child$ property on maps#45
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.