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

Method _endToken

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

Source from the content-addressed store, hash-verified

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