MCPcopy Create free account
hub / github.com/microsoft/SandDance / scanIdentifier

Function scanIdentifier

docs/app/js/sanddance-app.js:143616–143633  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143614 return source.slice(start, index);
143615}
143616function scanIdentifier() {
143617 var start, id, type;
143618 start = index; // Backslash (U+005C) starts an escaped character.
143619 id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character.
143620 // Thus, it must be an identifier.
143621 if (id.length === 1) type = TokenIdentifier;
143622 else if (keywords.hasOwnProperty(id)) // eslint-disable-line no-prototype-builtins
143623 type = TokenKeyword;
143624 else if (id === "null") type = TokenNullLiteral;
143625 else if (id === "true" || id === "false") type = TokenBooleanLiteral;
143626 else type = TokenIdentifier;
143627 return {
143628 type: type,
143629 value: id,
143630 start: start,
143631 end: index
143632 };
143633} // 7.7 Punctuators
143634function scanPunctuator() {
143635 var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4;
143636 switch(code){

Callers 1

advanceFunction · 0.70

Calls 2

getEscapedIdentifierFunction · 0.70
getIdentifierFunction · 0.70

Tested by

no test coverage detected