Skip to content

fix: bare integer tokens are aliases to numeric endings, not prices - #21

Merged
ralyodio merged 1 commit into
moshcoder:mainfrom
nivokvo:fix/numeric-alias-swallowed-by-price
Aug 28, 2026
Merged

fix: bare integer tokens are aliases to numeric endings, not prices#21
ralyodio merged 1 commit into
moshcoder:mainfrom
nivokvo:fix/numeric-alias-swallowed-by-price

Conversation

@nivokvo

@nivokvo nivokvo commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #20

Problem

parseTldList("eggs 420") returned priceUsd: 420 instead of aliasOf: "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

parsePriceToken now 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 in parseTldList that claimed all-numeric endings are rejected.

Tests

  • New: bare integer becomes an alias (eggs 420aliasOf: "420"), mixed lines still work (eggs 911 $2), names under numeric endings alias (eggs blue.420)
  • New: all documented price forms still parse as prices
  • Full suite: 55 pass, 0 fail

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.
@ralyodio
ralyodio merged commit 80f7458 into moshcoder:main Aug 28, 2026
4 checks passed
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.

Bug: bare integer in a pasted line becomes a price, making aliases to numeric endings impossible

2 participants