MCPcopy
hub / github.com/webpack/webpack / consumeNumberSign

Function consumeNumberSign

lib/css/syntax.js:664–684  ·  view source on GitHub ↗

* `#` — hash or delim. * @param {string} input input * @param {number} pos position just past `#` * @param {MutableToken} out token to populate * @returns {MutableToken | undefined} the resulting token, or undefined at EOF

(input, pos, out)

Source from the content-addressed store, hash-verified

662 * @returns {MutableToken | undefined} the resulting token, or undefined at EOF
663 */
664function consumeNumberSign(input, pos, out) {
665 const start = pos - 1;
666 const first = input.charCodeAt(pos);
667 const second = input.charCodeAt(pos + 1);
668 if (
669 _isIdentCodePoint(first) ||
670 _ifTwoCodePointsAreValidEscape(input, pos, first, second)
671 ) {
672 const third = input.charCodeAt(pos + 2);
673 out.isId = _ifThreeCodePointsWouldStartAnIdentSequence(
674 input,
675 pos,
676 first,
677 second,
678 third
679 );
680 pos = _consumeAnIdentSequence(input, pos);
681 return fill(out, TT_HASH, start, pos);
682 }
683 return fill(out, TT_DELIM, start, pos);
684}
685
686/**
687 * `-` — number / cdc / ident / delim.

Callers 1

consumeATokenFunction · 0.85

Calls 5

_isIdentCodePointFunction · 0.85
_consumeAnIdentSequenceFunction · 0.85
fillFunction · 0.85

Tested by

no test coverage detected