feat!: add form grouping, labels, and named references (CDL v1.3)#1
Merged
feat!: add form grouping, labels, and named references (CDL v1.3)#1
Conversation
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.
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.
Summary
FormGroupfor parenthesized form grouping with shared features (e.g.,({111} + {100})|striation)@name/$namedefinition and reference syntaxflat_forms()method for backwards-compatible flat list accesstests/fixtures/v1.3-test-cases.jsonBREAKING CHANGE:
CrystalDescription.formstype changed fromlist[CrystalForm]tolist[FormNode]. Useflat_forms()for backwards-compatible flat list access.Files changed
pyproject.toml- version 1.2.0 -> 1.3.0src/cdl_parser/__init__.py- version bump, new exports:FormGroup,Definition,FormNodesrc/cdl_parser/constants.py-FEATURE_NAMES,PHENOMENON_TYPESaddedsrc/cdl_parser/models.py-FormGroup,Definition,FormNode,flat_forms(),labelfieldsrc/cdl_parser/parser.py- grouping, labels, definitions, references,DOLLAR/EQUALStokenstests/test_parser.py- 43 new teststests/fixtures/v1.3-test-cases.json- new fixture dataTest plan
pytestpasses all 163 testsflat_forms()returns identical results to old.formsfor non-grouped CDL({111} + {100})|striationparses correctly@diamond = ...and reference$diamondround-tripcrystal-geometry,gemmology-plugin)