fix(parser): accept dotted unit abbreviations and reject malformed quantities #36
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!36
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/parser-unit-abbreviations"
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?
Closes #24
Problem
{1/2 c.à.s}and{1 c.à.c}(the examples in the French reference) did not parse. The failure was silent: the quantity was dropped, the name was truncated to its first word, and distinct ingredients merged into one shopping-list entry.Changes
c.à.s,c. à s.,fl. oz.) but never at its start.{...}glued to an ingredient, composite parent, cookware, reference or timer that is not a valid quantity is now aGramParseErrorpointing at the brace, instead of silently falling back to the bare form. Temperature text quantities are unchanged.normalizeUnitfalls back to a spelling-insensitive key (case, accents, dots, apostrophes, spaces), soc.à.s,c.a.sandcàsall resolve totbsp. Unknown units are still returned as written. A test guards against alias collisions.031,err-012,err-013. No existing golden changed.Behavior change
Quantities that were silently ignored before are now errors, hence a
minorchangeset. All tracked.gramfiles in the repo still parse.Verification
bun run build,bun test,bun run conformance,bun run lint,bun run typecheckall pass. Checked the error ingram check, the language server diagnostic and the playground.{1 c.à.s}and{1 c.à.c}from the French docs silently drop the quantity and merge distinct ingredients #24