diff --git a/lib/parse/tokenize.js b/lib/parse/tokenize.js index 40d88ae..ae6d517 100644 --- a/lib/parse/tokenize.js +++ b/lib/parse/tokenize.js @@ -318,6 +318,7 @@ function consumeNumber(chars) { ['types', ['']], ] let number = '' + let type = 'integer' if (chars.next() === '+' || chars.next() === '-') { entries.push(['sign', number += chars.consume()]) } @@ -328,8 +329,9 @@ function consumeNumber(chars) { || startsWithExponent(...chars.next(3)) ) { number += chars.consume(2) + chars.consumeRunOf(isDigit) + type = 'number' } - entries.push(['end', chars.index + 1], ['value', convertStringToNumber(number)]) + entries.push(['end', chars.index + 1], ['value', convertStringToNumber(number)], ['type', type]) return Object.fromEntries(entries) } @@ -340,10 +342,10 @@ function consumeNumber(chars) { */ function consumeNumeric(chars) { const number = consumeNumber(chars) - const { start, value } = number + const { start, value, type } = number if (startsWithIdentifier(...chars.next(3))) { const unit = consumeIdentifier(chars) - return { end: chars.index + 1, start, types: [''], unit: unit.value.toLowerCase(), value } + return { end: chars.index + 1, start, type, types: [''], unit: unit.value.toLowerCase(), value } } if (chars.consume('%')) { return { end: chars.index + 1, start, types: [''], unit: '%', value }