fix: bare integer tokens are aliases to numeric endings, not prices - #21
Merged
ralyodio merged 1 commit intoAug 28, 2026
Merged
Conversation
A pasted line like 'eggs 420' — meaning 'eggs aliases to the ending .420' — was parsed as a $420 price. All-numeric endings are legal here (.420, .911), so an unmarked number names the ending a line points at, and reading it as a price both silently minted four-figure prices on what were meant to be aliases and made an alias to a numeric ending impossible to write at all. A price must now say it is money: a '$', a decimal point, or a USD affix. The documented forms ($2, 2.00, USD 2) are unchanged; only the bare-integer reading moves from price to alias.
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.
Fixes #20
Problem
parseTldList("eggs 420")returnedpriceUsd: 420instead ofaliasOf: "420". All-numeric endings are legal (.420,.911), so an unmarked number names the ending a line points at — but the price parser swallowed it, silently minting four-figure prices on what were meant to be aliases and making an alias to a numeric ending impossible to write.Change
parsePriceTokennow requires a money marker:$, a decimal point, or a USD affix. The documented forms ($2,2.00,$2.00USD,USD 2) are unchanged; only the bare-integer reading moves from price to alias. Also corrects the stale comment inparseTldListthat claimed all-numeric endings are rejected.Tests
eggs 420→aliasOf: "420"), mixed lines still work (eggs 911 $2), names under numeric endings alias (eggs blue.420)