Skip to content

feat!: add form grouping, labels, and named references (CDL v1.3)#1

Merged
Bissbert merged 1 commit intomainfrom
feature/cdl-v1.3
Feb 14, 2026
Merged

feat!: add form grouping, labels, and named references (CDL v1.3)#1
Bissbert merged 1 commit intomainfrom
feature/cdl-v1.3

Conversation

@Bissbert
Copy link
Contributor

Summary

  • Add FormGroup for parenthesized form grouping with shared features (e.g., ({111} + {100})|striation)
  • Add form labels and @name/$name definition and reference syntax
  • Add flat_forms() method for backwards-compatible flat list access
  • 43 new tests (163 total), including fixture-based test cases in tests/fixtures/v1.3-test-cases.json

BREAKING CHANGE: CrystalDescription.forms type changed from list[CrystalForm] to list[FormNode]. Use flat_forms() for backwards-compatible flat list access.

Files changed

  • pyproject.toml - version 1.2.0 -> 1.3.0
  • src/cdl_parser/__init__.py - version bump, new exports: FormGroup, Definition, FormNode
  • src/cdl_parser/constants.py - FEATURE_NAMES, PHENOMENON_TYPES added
  • src/cdl_parser/models.py - FormGroup, Definition, FormNode, flat_forms(), label field
  • src/cdl_parser/parser.py - grouping, labels, definitions, references, DOLLAR/EQUALS tokens
  • tests/test_parser.py - 43 new tests
  • tests/fixtures/v1.3-test-cases.json - new fixture data

Test plan

  • pytest passes all 163 tests
  • flat_forms() returns identical results to old .forms for non-grouped CDL
  • Grouped CDL ({111} + {100})|striation parses correctly
  • Definition @diamond = ... and reference $diamond round-trip
  • Verify no regressions in downstream packages (crystal-geometry, gemmology-plugin)

Phase 3 of CDL v2 implementation. Adds FormGroup for parenthesized form
grouping with shared features, form labels, @name/$name definitions and
references, flat_forms() backwards-compatible flattening, and 43 new
tests (163 total).

BREAKING CHANGE: CrystalDescription.forms type changed from
list[CrystalForm] to list[FormNode]. Use flat_forms() for
backwards-compatible flat list access.
@Bissbert Bissbert merged commit 319f65e into main Feb 14, 2026
4 of 6 checks passed
@Bissbert Bissbert deleted the feature/cdl-v1.3 branch February 14, 2026 16:59
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.

1 participant