fix: correct enum value rewriting and parser quoted-string handling #16
No reviewers
Labels
No labels
blocked
bug
design
docs
engineering
feature
infra
priority:high
priority:low
priority:medium
question
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: sscoble/speckl#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/compiler-enum-rewrite-parser-quotes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes: marcus/engineering#9
Two bugs fixed in the SpeckDL TypeScript generator:
Bug 1: Enum value rewriting uses wrong enum name
rewriteExprandreplaceStateWithEnumtook a singlestateEnumNameparameter and replaced ALL capitalized words with it.ArtifactKind.ProvenancebecameCompilerPhase.Provenance.Fix: Build a
value → enumNamemap fromenumMapand pass it torewriteExpr. Each enum value now gets its correct prefix.Bug 2: Parser splits emit fields on commas inside quoted strings
fieldsStr.split(",")brokejoin(outputDir, ".prov.jsonld")into two fields.Fix: Parse-aware splitting that respects quotes and parentheses.
Bonus:
join()now generatespath.join()join(a, b)was rewritten asa.join(b)(Array.join). Now correctly generatespath.join(a, b)with proper import.Verification
speckl-compile.speckdlcompiles cleanlySpecklCompilerArtifactKind.Provenance)SpecklCompilerCompilerPhase.*for statesSpecklCompilerArtifactKind.*for artifact kindspath.join(this.outputDir, ".prov.jsonld")instead of brokenthis.outputDir.join(".prov.jsonld")3 bugs fixed: (1) join() -> path.join(), (2) emit field parser now parse-aware (respects quotes/parens), (3) enum rewriting uses value->enumName map from enumMap.
Pull request closed