MCPcopy Create free account
hub / github.com/denoland/std / readAlias

Method readAlias

yaml/_loader_state.ts:1485–1514  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1483 return this.#scanner.source.slice(position, this.#scanner.position);
1484 }
1485 readAlias(): string | void {
1486 if (this.#scanner.peek() !== ASTERISK) return;
1487
1488 this.#scanner.next();
1489 let ch = this.#scanner.peek();
1490
1491 const position = this.#scanner.position;
1492
1493 while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
1494 this.#scanner.next();
1495 ch = this.#scanner.peek();
1496 }
1497
1498 if (this.#scanner.position === position) {
1499 throw this.#createError(
1500 "Cannot read alias: alias name must contain at least one character",
1501 );
1502 }
1503
1504 const alias = this.#scanner.source.slice(position, this.#scanner.position);
1505 if (!this.anchorMap.has(alias)) {
1506 throw this.#createError(
1507 `Cannot read alias: unidentified alias "${alias}"`,
1508 );
1509 }
1510
1511 this.skipSeparationSpace(true, -1);
1512
1513 return this.anchorMap.get(alias);
1514 }
1515 resolveTag(state: State) {
1516 switch (state.tag) {
1517 case null:

Callers 1

composeNodeMethod · 0.95

Calls 9

#createErrorMethod · 0.95
skipSeparationSpaceMethod · 0.95
isWhiteSpaceOrEOLFunction · 0.90
isFlowIndicatorFunction · 0.90
hasMethod · 0.65
getMethod · 0.65
peekMethod · 0.45
nextMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected