MCPcopy
hub / github.com/webpack/webpack / _consumeAnIdentSequence

Function _consumeAnIdentSequence

lib/css/syntax.js:471–488  ·  view source on GitHub ↗
(input, pos)

Source from the content-addressed store, hash-verified

469 * @returns {number} position just past the last ident-sequence code point
470 */
471const _consumeAnIdentSequence = (input, pos) => {
472 // Hot loop (every ident, at-keyword, hash, function name, unit). Both checks
473 // are inlined from `_isIdentCodePoint` / `_ifTwoCodePointsAreValidEscape`: the
474 // ASCII ident test is a single table load, and the escape test reads the
475 // following code point only when `cc` is a `\` (rare) instead of eagerly.
476 for (;;) {
477 const cc = input.charCodeAt(pos);
478 pos++;
479 if (cc < 128 ? _identCharTable[cc] === 1 : _isIdentStartCodePointCC(cc)) {
480 continue;
481 }
482 if (cc === CC_REVERSE_SOLIDUS && !_isNewline(input.charCodeAt(pos))) {
483 pos = _consumeAnEscapedCodePoint(input, pos);
484 continue;
485 }
486 return pos - 1;
487 }
488};
489
490/**
491 * @param {number} cc char code

Callers 4

consumeNumberSignFunction · 0.85
consumeANumericTokenFunction · 0.85
consumeAnIdentLikeTokenFunction · 0.85
consumeCommercialAtFunction · 0.85

Calls 3

_isIdentStartCodePointCCFunction · 0.85
_isNewlineFunction · 0.85

Tested by

no test coverage detected