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

Function scanUnicodeCodePointEscape

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

Source from the content-addressed store, hash-verified

143555 return String.fromCharCode(code);
143556}
143557function scanUnicodeCodePointEscape() {
143558 var ch, code, cu1, cu2;
143559 ch = source[index];
143560 code = 0; // At least, one hex digit is required.
143561 if (ch === "}") throwError({}, MessageUnexpectedToken, ILLEGAL);
143562 while(index < length){
143563 ch = source[index++];
143564 if (!isHexDigit(ch)) break;
143565 code = code * 16 + "0123456789abcdef".indexOf(ch.toLowerCase());
143566 }
143567 if (code > 0x10FFFF || ch !== "}") throwError({}, MessageUnexpectedToken, ILLEGAL);
143568 // UTF-16 Encoding
143569 if (code <= 0xFFFF) return String.fromCharCode(code);
143570 cu1 = (code - 0x10000 >> 10) + 0xD800;
143571 cu2 = (code - 0x10000 & 1023) + 0xDC00;
143572 return String.fromCharCode(cu1, cu2);
143573}
143574function getEscapedIdentifier() {
143575 var ch, id;
143576 ch = source.charCodeAt(index++);

Callers 1

scanStringLiteralFunction · 0.70

Calls 2

throwErrorFunction · 0.70
isHexDigitFunction · 0.70

Tested by

no test coverage detected