%PDF- %PDF-
Direktori : /usr/share/nodejs/acorn-numeric-separator/dist/ |
Current File : //usr/share/nodejs/acorn-numeric-separator/dist/acorn-numeric-separator.js.map |
{"version":3,"file":"acorn-numeric-separator.js","sources":["../src/index.js"],"sourcesContent":["function withoutAcornBigInt(acorn, Parser) {\n return class extends Parser {\n readInt(radix, len) {\n // Hack: len is only != null for unicode escape sequences,\n // where numeric separators are not allowed\n if (len != null) return super.readInt(radix, len)\n\n let start = this.pos, total = 0, acceptUnderscore = false\n for (;;) {\n let code = this.input.charCodeAt(this.pos), val\n if (code >= 97) val = code - 97 + 10 // a\n else if (code == 95) {\n if (!acceptUnderscore) this.raise(this.pos, \"Invalid numeric separator\")\n ++this.pos\n acceptUnderscore = false\n continue\n } else if (code >= 65) val = code - 65 + 10 // A\n else if (code >= 48 && code <= 57) val = code - 48 // 0-9\n else val = Infinity\n if (val >= radix) break\n ++this.pos\n total = total * radix + val\n acceptUnderscore = true\n }\n if (this.pos === start) return null\n if (!acceptUnderscore) this.raise(this.pos - 1, \"Invalid numeric separator\")\n\n return total\n }\n\n readNumber(startsWithDot) {\n const token = super.readNumber(startsWithDot)\n let octal = this.end - this.start >= 2 && this.input.charCodeAt(this.start) === 48\n const stripped = this.getNumberInput(this.start, this.end)\n if (stripped.length < this.end - this.start) {\n if (octal) this.raise(this.start, \"Invalid number\")\n this.value = parseFloat(stripped)\n }\n return token\n }\n\n // This is used by acorn-bigint\n getNumberInput(start, end) {\n return this.input.slice(start, end).replace(/_/g, \"\")\n }\n }\n}\n\nfunction withAcornBigInt(acorn, Parser) {\n return class extends Parser {\n readInt(radix, len) {\n // Hack: len is only != null for unicode escape sequences,\n // where numeric separators are not allowed\n if (len != null) return super.readInt(radix, len)\n\n let start = this.pos, total = 0, acceptUnderscore = false\n for (;;) {\n let code = this.input.charCodeAt(this.pos), val\n if (code >= 97) val = code - 97 + 10 // a\n else if (code == 95) {\n if (!acceptUnderscore) this.raise(this.pos, \"Invalid numeric separator\")\n ++this.pos\n acceptUnderscore = false\n continue\n } else if (code >= 65) val = code - 65 + 10 // A\n else if (code >= 48 && code <= 57) val = code - 48 // 0-9\n else val = Infinity\n if (val >= radix) break\n ++this.pos\n total = total * radix + val\n acceptUnderscore = true\n }\n if (this.pos === start) return null\n if (!acceptUnderscore) this.raise(this.pos - 1, \"Invalid numeric separator\")\n\n return total\n }\n\n readNumber(startsWithDot) {\n let start = this.pos\n if (!startsWithDot && this.readInt(10) === null) this.raise(start, \"Invalid number\")\n let octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48\n let octalLike = false\n if (octal && this.strict) this.raise(start, \"Invalid number\")\n let next = this.input.charCodeAt(this.pos)\n if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {\n let str = this.getNumberInput(start, this.pos)\n // eslint-disable-next-line node/no-unsupported-features/es-builtins\n let val = typeof BigInt !== \"undefined\" ? BigInt(str) : null\n ++this.pos\n if (acorn.isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, \"Identifier directly after number\")\n return this.finishToken(acorn.tokTypes.num, val)\n }\n if (octal && /[89]/.test(this.input.slice(start, this.pos))) {\n octal = false\n octalLike = true\n }\n if (next === 46 && !octal) { // '.'\n ++this.pos\n this.readInt(10)\n next = this.input.charCodeAt(this.pos)\n }\n if ((next === 69 || next === 101) && !octal) { // 'eE'\n next = this.input.charCodeAt(++this.pos)\n if (next === 43 || next === 45) ++this.pos // '+-'\n if (this.readInt(10) === null) this.raise(start, \"Invalid number\")\n }\n if (acorn.isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, \"Identifier directly after number\")\n let str = this.getNumberInput(start, this.pos)\n if ((octal || octalLike) && str.length < this.pos - start) {\n this.raise(start, \"Invalid number\")\n }\n\n let val = octal ? parseInt(str, 8) : parseFloat(str)\n return this.finishToken(acorn.tokTypes.num, val)\n }\n\n parseLiteral(value) {\n const ret = super.parseLiteral(value)\n if (ret.bigint) ret.bigint = ret.bigint.replace(/_/g, \"\")\n return ret\n }\n\n readRadixNumber(radix) {\n let start = this.pos\n this.pos += 2 // 0x\n let val = this.readInt(radix)\n if (val == null) { this.raise(this.start + 2, `Expected number in radix ${radix}`) }\n if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {\n let str = this.getNumberInput(start, this.pos)\n // eslint-disable-next-line node/no-unsupported-features/es-builtins\n val = typeof BigInt !== \"undefined\" ? BigInt(str) : null\n ++this.pos\n } else if (acorn.isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\") }\n return this.finishToken(acorn.tokTypes.num, val)\n }\n\n // This is used by acorn-bigint, which theoretically could be used with acorn@6.2 || acorn@7\n getNumberInput(start, end) {\n return this.input.slice(start, end).replace(/_/g, \"\")\n }\n }\n}\n\n// eslint-disable-next-line node/no-unsupported-features/es-syntax\nexport default function numericSeparator(Parser) {\n const acorn = Parser.acorn || require(\"acorn\")\n const withAcornBigIntSupport = (acorn.version.startsWith(\"6.\") && !(acorn.version.startsWith(\"6.0.\") || acorn.version.startsWith(\"6.1.\"))) || acorn.version.startsWith(\"7.\")\n\n return withAcornBigIntSupport ? withAcornBigInt(acorn, Parser) : withoutAcornBigInt(acorn, Parser)\n}\n"],"names":[],"mappings":";;AAAA,SAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE;AAC3C,EAAE,OAAO,cAAc,MAAM,CAAC;AAC9B,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE;AACxB;AACA;AACA,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;AACvD;AACA,MAAM,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,gBAAgB,GAAG,MAAK;AAC/D,MAAM,SAAS;AACf,QAAQ,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,I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