MCPcopy
hub / github.com/jquery/esprima / getIdentifier

Method getIdentifier

src/scanner.ts:425–446  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

423 }
424
425 private getIdentifier(): string {
426 const start = this.index++;
427 while (!this.eof()) {
428 const ch = this.source.charCodeAt(this.index);
429 if (ch === 0x5C) {
430 // Blackslash (U+005C) marks Unicode escape sequence.
431 this.index = start;
432 return this.getComplexIdentifier();
433 } else if (ch >= 0xD800 && ch < 0xDFFF) {
434 // Need to handle surrogate pairs.
435 this.index = start;
436 return this.getComplexIdentifier();
437 }
438 if (Character.isIdentifierPart(ch)) {
439 ++this.index;
440 } else {
441 break;
442 }
443 }
444
445 return this.source.slice(start, this.index);
446 }
447
448 private getComplexIdentifier(): string {
449 let cp = this.codePointAt(this.index);

Callers 1

scanIdentifierMethod · 0.95

Calls 2

eofMethod · 0.95
getComplexIdentifierMethod · 0.95

Tested by

no test coverage detected