Skip to content

Configurable per-depth separators for nested array cells#12

Merged
0x5143 merged 1 commit into
masterfrom
copilot/update-nested-array-separators
May 18, 2026
Merged

Configurable per-depth separators for nested array cells#12
0x5143 merged 1 commit into
masterfrom
copilot/update-nested-array-separators

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

The plain-text array parser preferred | and otherwise fell back to #, making id#count|id#count and a single 801000#2 parse with different rules — the latter being silently split into [[801000],[2]] instead of [[801000, 2]]. There was no way to model nested arrays unambiguously.

Changes

  • ParseOptions.ArrayNestedSeparators: new string option where the N-th character is the delimiter for the N-th array nesting level (e.g. "|#-" → depth-1 |, depth-2 #, depth-3 -). Empty preserves legacy |/# priority behavior.
  • ArrayDataProcessor: WriteDelimitedToStream now picks the separator by current depth and recurses with a [ThreadStatic] depth counter incremented around inner-array element writes. When the configured string is shorter than the current depth, the last character is reused.
  • CLI (DataTables.Generator): adds --arrayNestedSeparators to both ExportAll and ExportOne, plumbed through ParseOptions.
  • DataTableProcessor: applies ParseOptions.ArrayNestedSeparators to the static config at construction; empty/null normalizes to legacy mode.
  • Tests: ArrayNestedSeparatorsTests covers the singleton case, multi-entry, triple-nested, separator overflow reuse, and the empty-config fallback.
  • README: documents the new flag.

Example

# id#count|id#count  →  depth-1 '|', depth-2 '#'
dotnet dtgen -i ./Tables -co ./Generated -do ./Data \
  --arrayNestedSeparators "|#"

With array<array<int>>:

Cell value Before After
1#2|3#4 [[1,2],[3,4]] (by accident) [[1,2],[3,4]]
801000#2 [[801000],[2]] [[801000,2]]

@0x5143 0x5143 marked this pull request as ready for review May 18, 2026 11:59
@0x5143 0x5143 merged commit da56b5a into master May 18, 2026
4 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