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

Method _endToken

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

Source from the content-addressed store, hash-verified

497 }
498
499 private _endToken(parts: string[], end?: CharacterCursor): Token {
500 if (this._currentTokenStart === null) {
501 throw new ParseError(
502 this._cursor.getSpan(end),
503 'Programming error - attempted to end a token when there was no start to the token',
504 );
505 }
506 if (this._currentTokenType === null) {
507 throw new ParseError(
508 this._cursor.getSpan(this._currentTokenStart),
509 'Programming error - attempted to end a token which has no token type',
510 );
511 }
512 const token = {
513 type: this._currentTokenType,
514 parts,
515 sourceSpan: (end ?? this._cursor).getSpan(
516 this._currentTokenStart,
517 this._leadingTriviaCodePoints,
518 ),
519 } as Token;
520 this.tokens.push(token);
521 this._currentTokenStart = null;
522 this._currentTokenType = null;
523 return token;
524 }
525
526 private _createError(msg: string, span: ParseSourceSpan): ParseError {
527 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