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

Function parseExpected

test/fixtures/snapshot/typescript.js:32108–32124  ·  view source on GitHub ↗
(kind, diagnosticMessage, shouldAdvance)

Source from the content-addressed store, hash-verified

32106 return token() > 116 /* SyntaxKind.LastReservedWord */;
32107 }
32108 function parseExpected(kind, diagnosticMessage, shouldAdvance) {
32109 if (shouldAdvance === void 0) { shouldAdvance = true; }
32110 if (token() === kind) {
32111 if (shouldAdvance) {
32112 nextToken();
32113 }
32114 return true;
32115 }
32116 // Report specific message if provided with one. Otherwise, report generic fallback message.
32117 if (diagnosticMessage) {
32118 parseErrorAtCurrentToken(diagnosticMessage);
32119 }
32120 else {
32121 parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
32122 }
32123 return false;
32124 }
32125 var viableKeywordSuggestions = Object.keys(ts.textToKeywordObj).filter(function (keyword) { return keyword.length > 2; });
32126 /**
32127 * Provides a better error message than the generic "';' expected" if possible for

Callers 15

parseSemicolonFunction · 0.85
parseDelimitedListFunction · 0.85
parseBracketedListFunction · 0.85
parseJSDocParameterFunction · 0.85
parseTypeQueryFunction · 0.85
shouldParseReturnTypeFunction · 0.85
parseParametersFunction · 0.85
parseSignatureMemberFunction · 0.85
parseObjectTypeMembersFunction · 0.85
parseMappedTypeParameterFunction · 0.85
parseMappedTypeFunction · 0.85

Calls 3

nextTokenFunction · 0.85
parseErrorAtCurrentTokenFunction · 0.85
tokenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…