MCPcopy Index your code
hub / github.com/nodejs/node / parseLiteralLikeNode

Function parseLiteralLikeNode

test/fixtures/snapshot/typescript.js:33249–33270  ·  view source on GitHub ↗
(kind)

Source from the content-addressed store, hash-verified

33247 return tokenText.substring(1, tokenText.length - (scanner.isUnterminated() ? 0 : isLast ? 1 : 2));
33248 }
33249 function parseLiteralLikeNode(kind) {
33250 var pos = getNodePos();
33251 var node = ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, scanner.getTokenValue(), getTemplateLiteralRawText(kind), scanner.getTokenFlags() & 2048 /* TokenFlags.TemplateLiteralLikeFlags */) :
33252 // Octal literals are not allowed in strict mode or ES5
33253 // Note that theoretically the following condition would hold true literals like 009,
33254 // which is not octal. But because of how the scanner separates the tokens, we would
33255 // never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
33256 // We also do not need to check for negatives because any prefix operator would be part of a
33257 // parent unary expression.
33258 kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) :
33259 kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral(scanner.getTokenValue(), /*isSingleQuote*/ undefined, scanner.hasExtendedUnicodeEscape()) :
33260 ts.isLiteralKind(kind) ? factory.createLiteralLikeNode(kind, scanner.getTokenValue()) :
33261 ts.Debug.fail();
33262 if (scanner.hasExtendedUnicodeEscape()) {
33263 node.hasExtendedUnicodeEscape = true;
33264 }
33265 if (scanner.isUnterminated()) {
33266 node.isUnterminated = true;
33267 }
33268 nextToken();
33269 return finishNode(node, pos);
33270 }
33271 // TYPES
33272 function parseEntityNameOfTypeReference() {
33273 return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);

Callers 5

parseLiteralNodeFunction · 0.85
parseTemplateHeadFunction · 0.85
parseLiteralTypeNodeFunction · 0.85
parseAssertEntryFunction · 0.85

Calls 5

getNodePosFunction · 0.85
nextTokenFunction · 0.85
finishNodeFunction · 0.85
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…