MCPcopy
hub / github.com/webpack/webpack / tokenize

Function tokenize

lib/html/syntax.js:7558–7674  ·  view source on GitHub ↗

* @returns {void}

()

Source from the content-addressed store, hash-verified

7556 * @returns {void}
7557 */
7558 function tokenize() {
7559 // 8.1. Descriptor tokenizer: Skip whitespace
7560 collectCharacters(LEADING_SPACES_REGEXP);
7561
7562 // 8.2. Let current descriptor be the empty string.
7563 currentDescriptor = "";
7564
7565 // 8.3. Let state be in descriptor.
7566 state = "in descriptor";
7567
7568 while (true) {
7569 // 8.4. Let charCode be the character at position.
7570 charCode = input.charCodeAt(position);
7571
7572 // Do the following depending on the value of state.
7573 // For the purpose of this step, "EOF" is a special character representing
7574 // that position is past the end of input.
7575
7576 // In descriptor
7577 if (state === "in descriptor") {
7578 // Do the following, depending on the value of charCode:
7579
7580 // Space character
7581 // If current descriptor is not empty, append current descriptor to
7582 // descriptors and let current descriptor be the empty string.
7583 // Set state to after descriptor.
7584 if (isSpace(charCode)) {
7585 if (currentDescriptor) {
7586 descriptors.push(currentDescriptor);
7587 currentDescriptor = "";
7588 state = "after descriptor";
7589 }
7590 }
7591 // U+002C COMMA (,)
7592 // Advance position to the next character in input. If current descriptor
7593 // is not empty, append current descriptor to descriptors. Jump to the step
7594 // labeled descriptor parser.
7595 else if (charCode === COMMA) {
7596 position += 1;
7597
7598 if (currentDescriptor) {
7599 descriptors.push(currentDescriptor);
7600 }
7601
7602 parseDescriptors();
7603
7604 return;
7605 }
7606 // U+0028 LEFT PARENTHESIS (()
7607 // Append charCode to current descriptor. Set state to in parens.
7608 else if (charCode === LEFT_PARENTHESIS) {
7609 currentDescriptor += input.charAt(position);
7610 state = "in parens";
7611 }
7612 // EOF
7613 // If current descriptor is not empty, append current descriptor to
7614 // descriptors. Jump to the step labeled descriptor parser.
7615 else if (Number.isNaN(charCode)) {

Callers 1

parseSrcsetFunction · 0.85

Calls 4

collectCharactersFunction · 0.85
isSpaceFunction · 0.85
parseDescriptorsFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected