fix(eval): accept multiplier-suffix numbers like 64x

The strict word-boundary rule rejected the multiplier form. A single
trailing x with no word character after it now counts as a valid
number. Hex literals and identifiers stay rejected.
This commit is contained in:
2026-08-17 01:57:58 +01:00
parent 1b29019325
commit 586700758f
2 changed files with 11 additions and 1 deletions
+8 -1
View File
@@ -74,7 +74,14 @@ func classifyMatch(text string, start, end int) (numberCandidate, bool) {
return numberCandidate{}, false // e.g. the "64" in "LP64"
}
if end < len(text) && isWordByte(text[end]) {
return numberCandidate{}, false // e.g. "24bytes" with no separator
// Permit a multiplier suffix ("64x" = 64 times): a single trailing
// x/X with nothing word-like after it. Hex ("0x2A") and identifiers
// ("float64x2") keep a word byte after the x and stay rejected.
isMultiplier := (text[end] == 'x' || text[end] == 'X') &&
(end+1 >= len(text) || !isWordByte(text[end+1]))
if !isMultiplier {
return numberCandidate{}, false // e.g. "24bytes" with no separator
}
}
compound := start > 0 && text[start-1] == '-' && start-2 >= 0 && isWordByte(text[start-2])