MCPcopy
hub / github.com/webpack/webpack / declarationStartLikely

Function declarationStartLikely

lib/css/syntax.js:2473–2505  ·  view source on GitHub ↗
(ts)

Source from the content-addressed store, hash-verified

2471 * @returns {boolean} true if consume-a-declaration's step 1 + step 3 would both succeed on the current input
2472 */
2473const declarationStartLikely = (ts) => {
2474 const t = ts.next();
2475 if (t.type !== TT_IDENTIFIER) return false;
2476 const input = ts.input;
2477 const len = input.length;
2478 let pos = t.end;
2479 for (;;) {
2480 if (pos >= len) return false;
2481 const cc = input.charCodeAt(pos);
2482 if (_isWhiteSpace(cc)) {
2483 pos++;
2484 continue;
2485 }
2486 // Skip a `/* … */` comment (the tokenizer filters comments between tokens).
2487 if (cc === CC_SOLIDUS && input.charCodeAt(pos + 1) === CC_ASTERISK) {
2488 pos += 2;
2489 while (
2490 pos < len &&
2491 !(
2492 input.charCodeAt(pos) === CC_ASTERISK &&
2493 input.charCodeAt(pos + 1) === CC_SOLIDUS
2494 )
2495 ) {
2496 pos++;
2497 }
2498 pos += 2;
2499 continue;
2500 }
2501 // `:` is always a standalone <colon-token>, so the next significant char
2502 // being `:` is equivalent to the next token being a <colon-token>.
2503 return cc === CC_COLON;
2504 }
2505};
2506
2507/**
2508 * Consume a block's contents, CSS Syntax Level 3 [§5.4.5](https://drafts.csswg.org/css-syntax/#consume-block-contents). Per tabatkins/parse-css.js reference impl: returns separate `decls` and `rules` flat lists, both preserved on EOF / `}` (the spec text's "Return rules" single-list model drops trailing decls because there's no implicit flush before EOF / `}`).

Callers 1

consumeABlocksContentsFunction · 0.85

Calls 2

_isWhiteSpaceFunction · 0.85
nextMethod · 0.45

Tested by

no test coverage detected