MCPcopy
hub / github.com/angular/angular / _endToken

Method _endToken

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

Source from the content-addressed store, hash-verified

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