MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / tag

Method tag

src/resolution/jsx-code.ts:421–487  ·  view source on GitHub ↗

One step in an element's opening tag. False when the file is given up.

(top: Frame, c: number)

Source from the content-addressed store, hash-verified

419
420 /** One step in an element's opening tag. False when the file is given up. */
421 private tag(top: Frame, c: number): boolean {
422 const src = this.src;
423 const i = this.i;
424 if (isSpace(c)) {
425 this.i = i + 1;
426 return true;
427 }
428 if (c === 62) {
429 top.mode = 'children';
430 this.i = i + 1;
431 return true;
432 }
433 if (c === 47) {
434 const d = src.charCodeAt(i + 1);
435 if (d === 62) {
436 this.i = i + 2;
437 this.closeElement();
438 return true;
439 }
440 if (d === 47) {
441 const end = lineEnd(src, i);
442 this.blank(i, end);
443 this.i = end;
444 return true;
445 }
446 if (d === 42) {
447 const end = src.indexOf('*/', i + 2);
448 if (end !== -1) {
449 this.blank(i, end + 2);
450 this.i = end + 2;
451 return true;
452 }
453 }
454 return this.reread();
455 }
456 if (c === 123) {
457 this.codeFrame();
458 this.i = i + 1;
459 return true;
460 }
461 if (isIdStart(c)) {
462 const end = nameEnd(src, i + 1);
463 const eq = skipSpace(src, end);
464 if (src.charCodeAt(eq) !== 61) {
465 this.i = end;
466 return true;
467 }
468 const value = skipSpace(src, eq + 1);
469 const q = src.charCodeAt(value);
470 if (q === 34 || q === 39) {
471 // JSX strings have no escapes and may span lines.
472 const close = src.indexOf(q === 34 ? '"' : "'", value + 1);
473 if (close === -1) return this.reread();
474 this.blank(value + 1, close);
475 this.i = close + 1;
476 return true;
477 }
478 if (q === 123) {

Callers 1

readMethod · 0.95

Calls 10

closeElementMethod · 0.95
blankMethod · 0.95
rereadMethod · 0.95
codeFrameMethod · 0.95
openElementMethod · 0.95
isIdStartFunction · 0.85
nameEndFunction · 0.85
isSpaceFunction · 0.70
lineEndFunction · 0.70
skipSpaceFunction · 0.70

Tested by

no test coverage detected