* Spec type flag. For number / dimension tokens it's "integer" / "number" * (derived from `value`); for hash tokens it's "id" / "unrestricted" (re-derived * from the source). The two senses share the name in the spec; both are computed * on read so every leaf token keeps the same object shape
()
| 1371 | * @returns {"integer" | "number" | "id" | "unrestricted"} the spec type flag |
| 1372 | */ |
| 1373 | get typeFlag() { |
| 1374 | if (this.type === T_HASH) { |
| 1375 | // Re-derive id-ness from the source (whether the name after `#` starts an |
| 1376 | // ident sequence) rather than storing an `_isId` slot — keeps hash tokens |
| 1377 | // the same shape as every other leaf token. Matches the lexer's |
| 1378 | // `consumeNumberSign`, which sets `isId` from the same check. |
| 1379 | const input = this._locConverter._input; |
| 1380 | const p = this.start + 1; |
| 1381 | return _ifThreeCodePointsWouldStartAnIdentSequence( |
| 1382 | input, |
| 1383 | p, |
| 1384 | input.charCodeAt(p), |
| 1385 | input.charCodeAt(p + 1), |
| 1386 | input.charCodeAt(p + 2) |
| 1387 | ) |
| 1388 | ? "id" |
| 1389 | : "unrestricted"; |
| 1390 | } |
| 1391 | const v = this.value; |
| 1392 | return _typeFlagOf( |
| 1393 | this.type === T_DIMENSION ? v.slice(0, _consumeANumber(v, 0)) : v |
| 1394 | ); |
| 1395 | } |
| 1396 | |
| 1397 | /** |
| 1398 | * @returns {"+" | "-" | ""} the spec sign (number / percentage / dimension tokens) |
no test coverage detected