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

Method readAlias

yaml/_loader_state.ts:1496–1525  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1494 return this.#scanner.source.slice(position, this.#scanner.position);
1495 }
1496 readAlias(): string | void {
1497 if (this.#scanner.peek() !== ASTERISK) return;
1498
1499 this.#scanner.next();
1500 let ch = this.#scanner.peek();
1501
1502 const position = this.#scanner.position;
1503
1504 while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
1505 this.#scanner.next();
1506 ch = this.#scanner.peek();
1507 }
1508
1509 if (this.#scanner.position === position) {
1510 throw this.#createError(
1511 "Cannot read alias: alias name must contain at least one character",
1512 );
1513 }
1514
1515 const alias = this.#scanner.source.slice(position, this.#scanner.position);
1516 if (!this.anchorMap.has(alias)) {
1517 throw this.#createError(
1518 `Cannot read alias: unidentified alias "${alias}"`,
1519 );
1520 }
1521
1522 this.skipSeparationSpace(true, -1);
1523
1524 return this.anchorMap.get(alias);
1525 }
1526 resolveTag(state: State) {
1527 switch (state.tag) {
1528 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