index.js.map
21.1 KB
{"version":3,"names":["isDigit","code","forbiddenNumericSeparatorSiblings","decBinOct","Set","hex","isAllowedNumericSeparatorSibling","bin","ch","oct","dec","readStringContents","type","input","pos","lineStart","curLine","errors","initialPos","initialLineStart","initialCurLine","out","firstInvalidLoc","chunkStart","length","unterminated","slice","charCodeAt","isStringEnd","res","readEscapedChar","str","containsInvalid","inTemplate","throwOnInvalid","readHexChar","String","fromCharCode","readCodePoint","fromCodePoint","strictNumericEscape","startPos","match","octalStr","octal","parseInt","next","len","forceLen","n","readInt","invalidEscapeSequence","radix","allowNumSeparator","bailOnError","start","forbiddenSiblings","isAllowedSibling","invalid","total","i","e","Infinity","val","prev","numericSeparatorInEscapeSequence","Number","isNaN","has","unexpectedNumericSeparator","invalidDigit","indexOf","invalidCodePoint"],"sources":["../src/index.ts"],"sourcesContent":["import * as charCodes from \"charcodes\";\n\n// The following character codes are forbidden from being\n// an immediate sibling of NumericLiteralSeparator _\nconst forbiddenNumericSeparatorSiblings = {\n decBinOct: new Set<number>([\n charCodes.dot,\n charCodes.uppercaseB,\n charCodes.uppercaseE,\n charCodes.uppercaseO,\n charCodes.underscore, // multiple separators are not allowed\n charCodes.lowercaseB,\n charCodes.lowercaseE,\n charCodes.lowercaseO,\n ]),\n hex: new Set<number>([\n charCodes.dot,\n charCodes.uppercaseX,\n charCodes.underscore, // multiple separators are not allowed\n charCodes.lowercaseX,\n ]),\n};\n\nconst isAllowedNumericSeparatorSibling = {\n // 0 - 1\n bin: (ch: number) => ch === charCodes.digit0 || ch === charCodes.digit1,\n\n // 0 - 7\n oct: (ch: number) => ch >= charCodes.digit0 && ch <= charCodes.digit7,\n\n // 0 - 9\n dec: (ch: number) => ch >= charCodes.digit0 && ch <= charCodes.digit9,\n\n // 0 - 9, A - F, a - f,\n hex: (ch: number) =>\n (ch >= charCodes.digit0 && ch <= charCodes.digit9) ||\n (ch >= charCodes.uppercaseA && ch <= charCodes.uppercaseF) ||\n (ch >= charCodes.lowercaseA && ch <= charCodes.lowercaseF),\n};\n\nexport type StringContentsErrorHandlers = EscapedCharErrorHandlers & {\n unterminated(\n initialPos: number,\n initialLineStart: number,\n initialCurLine: number,\n ): void;\n};\n\nexport function readStringContents(\n type: \"single\" | \"double\" | \"template\",\n input: string,\n pos: number,\n lineStart: number,\n curLine: number,\n errors: StringContentsErrorHandlers,\n) {\n const initialPos = pos;\n const initialLineStart = lineStart;\n const initialCurLine = curLine;\n\n let out = \"\";\n let firstInvalidLoc = null;\n let chunkStart = pos;\n const { length } = input;\n for (;;) {\n if (pos >= length) {\n errors.unterminated(initialPos, initialLineStart, initialCurLine);\n out += input.slice(chunkStart, pos);\n break;\n }\n const ch = input.charCodeAt(pos);\n if (isStringEnd(type, ch, input, pos)) {\n out += input.slice(chunkStart, pos);\n break;\n }\n if (ch === charCodes.backslash) {\n out += input.slice(chunkStart, pos);\n const res = readEscapedChar(\n input,\n pos,\n lineStart,\n curLine,\n type === \"template\",\n errors,\n );\n if (res.ch === null && !firstInvalidLoc) {\n firstInvalidLoc = { pos, lineStart, curLine };\n } else {\n out += res.ch;\n }\n ({ pos, lineStart, curLine } = res);\n chunkStart = pos;\n } else if (\n ch === charCodes.lineSeparator ||\n ch === charCodes.paragraphSeparator\n ) {\n ++pos;\n ++curLine;\n lineStart = pos;\n } else if (ch === charCodes.lineFeed || ch === charCodes.carriageReturn) {\n if (type === \"template\") {\n out += input.slice(chunkStart, pos) + \"\\n\";\n ++pos;\n if (\n ch === charCodes.carriageReturn &&\n input.charCodeAt(pos) === charCodes.lineFeed\n ) {\n ++pos;\n }\n ++curLine;\n chunkStart = lineStart = pos;\n } else {\n errors.unterminated(initialPos, initialLineStart, initialCurLine);\n }\n } else {\n ++pos;\n }\n }\n return {\n pos,\n str: out,\n firstInvalidLoc,\n lineStart,\n curLine,\n\n // TODO(Babel 8): This is only needed for backwards compatibility,\n // we can remove it.\n containsInvalid: !!firstInvalidLoc,\n };\n}\n\nfunction isStringEnd(\n type: \"single\" | \"double\" | \"template\",\n ch: number,\n input: string,\n pos: number,\n) {\n if (type === \"template\") {\n return (\n ch === charCodes.graveAccent ||\n (ch === charCodes.dollarSign &&\n input.charCodeAt(pos + 1) === charCodes.leftCurlyBrace)\n );\n }\n return (\n ch === (type === \"double\" ? charCodes.quotationMark : charCodes.apostrophe)\n );\n}\n\ntype EscapedCharErrorHandlers = HexCharErrorHandlers &\n CodePointErrorHandlers & {\n strictNumericEscape(pos: number, lineStart: number, curLine: number): void;\n };\n\nfunction readEscapedChar(\n input: string,\n pos: number,\n lineStart: number,\n curLine: number,\n inTemplate: boolean,\n errors: EscapedCharErrorHandlers,\n) {\n const throwOnInvalid = !inTemplate;\n pos++; // skip '\\'\n\n const res = (ch: string | null) => ({ pos, ch, lineStart, curLine });\n\n const ch = input.charCodeAt(pos++);\n switch (ch) {\n case charCodes.lowercaseN:\n return res(\"\\n\");\n case charCodes.lowercaseR:\n return res(\"\\r\");\n case charCodes.lowercaseX: {\n let code;\n ({ code, pos } = readHexChar(\n input,\n pos,\n lineStart,\n curLine,\n 2,\n false,\n throwOnInvalid,\n errors,\n ));\n return res(code === null ? null : String.fromCharCode(code));\n }\n case charCodes.lowercaseU: {\n let code;\n ({ code, pos } = readCodePoint(\n input,\n pos,\n lineStart,\n curLine,\n throwOnInvalid,\n errors,\n ));\n return res(code === null ? null : String.fromCodePoint(code));\n }\n case charCodes.lowercaseT:\n return res(\"\\t\");\n case charCodes.lowercaseB:\n return res(\"\\b\");\n case charCodes.lowercaseV:\n return res(\"\\u000b\");\n case charCodes.lowercaseF:\n return res(\"\\f\");\n case charCodes.carriageReturn:\n if (input.charCodeAt(pos) === charCodes.lineFeed) {\n ++pos;\n }\n // fall through\n case charCodes.lineFeed:\n lineStart = pos;\n ++curLine;\n // fall through\n case charCodes.lineSeparator:\n case charCodes.paragraphSeparator:\n return res(\"\");\n case charCodes.digit8:\n case charCodes.digit9:\n if (inTemplate) {\n return res(null);\n } else {\n errors.strictNumericEscape(pos - 1, lineStart, curLine);\n }\n // fall through\n default:\n if (ch >= charCodes.digit0 && ch <= charCodes.digit7) {\n const startPos = pos - 1;\n const match = input.slice(startPos, pos + 2).match(/^[0-7]+/)!;\n\n let octalStr = match[0];\n\n let octal = parseInt(octalStr, 8);\n if (octal > 255) {\n octalStr = octalStr.slice(0, -1);\n octal = parseInt(octalStr, 8);\n }\n pos += octalStr.length - 1;\n const next = input.charCodeAt(pos);\n if (\n octalStr !== \"0\" ||\n next === charCodes.digit8 ||\n next === charCodes.digit9\n ) {\n if (inTemplate) {\n return res(null);\n } else {\n errors.strictNumericEscape(startPos, lineStart, curLine);\n }\n }\n\n return res(String.fromCharCode(octal));\n }\n\n return res(String.fromCharCode(ch));\n }\n}\n\ntype HexCharErrorHandlers = IntErrorHandlers & {\n invalidEscapeSequence(pos: number, lineStart: number, curLine: number): void;\n};\n\n// Used to read character escape sequences ('\\x', '\\u').\nfunction readHexChar(\n input: string,\n pos: number,\n lineStart: number,\n curLine: number,\n len: number,\n forceLen: boolean,\n throwOnInvalid: boolean,\n errors: HexCharErrorHandlers,\n) {\n const initialPos = pos;\n let n;\n ({ n, pos } = readInt(\n input,\n pos,\n lineStart,\n curLine,\n 16,\n len,\n forceLen,\n false,\n errors,\n /* bailOnError */ !throwOnInvalid,\n ));\n if (n === null) {\n if (throwOnInvalid) {\n errors.invalidEscapeSequence(initialPos, lineStart, curLine);\n } else {\n pos = initialPos - 1;\n }\n }\n return { code: n, pos };\n}\n\nexport type IntErrorHandlers = {\n numericSeparatorInEscapeSequence(\n pos: number,\n lineStart: number,\n curLine: number,\n ): void;\n unexpectedNumericSeparator(\n pos: number,\n lineStart: number,\n curLine: number,\n ): void;\n // It can return \"true\" to indicate that the error was handled\n // and the int parsing should continue.\n invalidDigit(\n pos: number,\n lineStart: number,\n curLine: number,\n radix: number,\n ): boolean;\n};\n\nexport function readInt(\n input: string,\n pos: number,\n lineStart: number,\n curLine: number,\n radix: number,\n len: number | undefined,\n forceLen: boolean,\n allowNumSeparator: boolean | \"bail\",\n errors: IntErrorHandlers,\n bailOnError: boolean,\n) {\n const start = pos;\n const forbiddenSiblings =\n radix === 16\n ? forbiddenNumericSeparatorSiblings.hex\n : forbiddenNumericSeparatorSiblings.decBinOct;\n const isAllowedSibling =\n radix === 16\n ? isAllowedNumericSeparatorSibling.hex\n : radix === 10\n ? isAllowedNumericSeparatorSibling.dec\n : radix === 8\n ? isAllowedNumericSeparatorSibling.oct\n : isAllowedNumericSeparatorSibling.bin;\n\n let invalid = false;\n let total = 0;\n\n for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {\n const code = input.charCodeAt(pos);\n let val;\n\n if (code === charCodes.underscore && allowNumSeparator !== \"bail\") {\n const prev = input.charCodeAt(pos - 1);\n const next = input.charCodeAt(pos + 1);\n\n if (!allowNumSeparator) {\n if (bailOnError) return { n: null, pos };\n errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);\n } else if (\n Number.isNaN(next) ||\n !isAllowedSibling(next) ||\n forbiddenSiblings.has(prev) ||\n forbiddenSiblings.has(next)\n ) {\n if (bailOnError) return { n: null, pos };\n errors.unexpectedNumericSeparator(pos, lineStart, curLine);\n }\n\n // Ignore this _ character\n ++pos;\n continue;\n }\n\n if (code >= charCodes.lowercaseA) {\n val = code - charCodes.lowercaseA + charCodes.lineFeed;\n } else if (code >= charCodes.uppercaseA) {\n val = code - charCodes.uppercaseA + charCodes.lineFeed;\n } else if (charCodes.isDigit(code)) {\n val = code - charCodes.digit0; // 0-9\n } else {\n val = Infinity;\n }\n if (val >= radix) {\n // If we found a digit which is too big, errors.invalidDigit can return true to avoid\n // breaking the loop (this is used for error recovery).\n if (val <= 9 && bailOnError) {\n return { n: null, pos };\n } else if (\n val <= 9 &&\n errors.invalidDigit(pos, lineStart, curLine, radix)\n ) {\n val = 0;\n } else if (forceLen) {\n val = 0;\n invalid = true;\n } else {\n break;\n }\n }\n ++pos;\n total = total * radix + val;\n }\n if (pos === start || (len != null && pos - start !== len) || invalid) {\n return { n: null, pos };\n }\n\n return { n: total, pos };\n}\n\nexport type CodePointErrorHandlers = HexCharErrorHandlers & {\n invalidCodePoint(pos: number, lineStart: number, curLine: number): void;\n};\n\nexport function readCodePoint(\n input: string,\n pos: number,\n lineStart: number,\n curLine: number,\n throwOnInvalid: boolean,\n errors: CodePointErrorHandlers,\n) {\n const ch = input.charCodeAt(pos);\n let code;\n\n if (ch === charCodes.leftCurlyBrace) {\n ++pos;\n ({ code, pos } = readHexChar(\n input,\n pos,\n lineStart,\n curLine,\n input.indexOf(\"}\", pos) - pos,\n true,\n throwOnInvalid,\n errors,\n ));\n ++pos;\n if (code !== null && code > 0x10ffff) {\n if (throwOnInvalid) {\n errors.invalidCodePoint(pos, lineStart, curLine);\n } else {\n return { code: null, pos };\n }\n }\n } else {\n ({ code, pos } = readHexChar(\n input,\n pos,\n lineStart,\n curLine,\n 4,\n false,\n throwOnInvalid,\n errors,\n ));\n }\n return { code, pos };\n}\n"],"mappings":";;;;;;;;;eAAA,SAASA,OAAT,CAAiBC,IAAjB,EAAuB;EACrB,OAAOA,IAAI,MAAJ,IAAkBA,IAAI,MAA7B;AACD,C;;AAED,MAAMC,iCAAiC,GAAG;EACxCC,SAAS,EAAE,IAAIC,GAAJ,CAAgB,kCAAhB,CAD6B;EAWxCC,GAAG,EAAE,IAAID,GAAJ,CAAgB,iBAAhB;AAXmC,CAA1C;AAmBA,MAAME,gCAAgC,GAAG;EAEvCC,GAAG,EAAGC,EAAD,IAAgBA,EAAE,OAAF,IAA2BA,EAAE,OAFX;EAKvCC,GAAG,EAAGD,EAAD,IAAgBA,EAAE,MAAF,IAA0BA,EAAE,MALV;EAQvCE,GAAG,EAAGF,EAAD,IAAgBA,EAAE,MAAF,IAA0BA,EAAE,MARV;EAWvCH,GAAG,EAAGG,EAAD,IACFA,EAAE,MAAF,IAA0BA,EAAE,MAA7B,IACCA,EAAE,MAAF,IAA8BA,EAAE,MADjC,IAECA,EAAE,MAAF,IAA8BA,EAAE;AAdI,CAAzC;;AAy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