MCPcopy Create free account
hub / github.com/angular/angular / _endToken

Method _endToken

packages/compiler/src/ml_parser/lexer.ts:515–540  ·  view source on GitHub ↗
(parts: string[], end?: CharacterCursor)

Source from the content-addressed store, hash-verified

513 }
514
515 private _endToken(parts: string[], end?: CharacterCursor): Token {
516 if (this._currentTokenStart === null) {
517 throw new ParseError(
518 this._cursor.getSpan(end),
519 'Programming error - attempted to end a token when there was no start to the token',
520 );
521 }
522 if (this._currentTokenType === null) {
523 throw new ParseError(
524 this._cursor.getSpan(this._currentTokenStart),
525 'Programming error - attempted to end a token which has no token type',
526 );
527 }
528 const token = {
529 type: this._currentTokenType,
530 parts,
531 sourceSpan: (end ?? this._cursor).getSpan(
532 this._currentTokenStart,
533 this._leadingTriviaCodePoints,
534 ),
535 } as Token;
536 this.tokens.push(token);
537 this._currentTokenStart = null;
538 this._currentTokenType = null;
539 return token;
540 }
541
542 private _createError(msg: string, span: ParseSourceSpan): ParseError {
543 if (this._isInExpansionForm()) {

Callers 15

tokenizeMethod · 0.95
_consumeBlockStartMethod · 0.95
_consumeBlockEndMethod · 0.95
_consumeEntityMethod · 0.95
_consumeRawTextMethod · 0.95
_consumeCommentMethod · 0.95
_consumeCdataMethod · 0.95
_consumeDocTypeMethod · 0.95

Calls 2

getSpanMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected