snyk 1.1308.2 → 1.1308.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/674.index.js +190 -154
- package/dist/cli/674.index.js.map +1 -1
- package/dist/cli/741.index.js +3 -1
- package/dist/cli/741.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +9 -9
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +9 -9
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/674.index.js
CHANGED
|
@@ -3315,7 +3315,7 @@ module.exports = {
|
|
|
3315
3315
|
parse: function(input, options) {
|
|
3316
3316
|
var str = input.toString();
|
|
3317
3317
|
var nodes = parser.parse(str, options);
|
|
3318
|
-
return compiler.compile(nodes, str);
|
|
3318
|
+
return compiler.compile(nodes, str, options);
|
|
3319
3319
|
}
|
|
3320
3320
|
};
|
|
3321
3321
|
|
|
@@ -3327,14 +3327,41 @@ module.exports = {
|
|
|
3327
3327
|
|
|
3328
3328
|
"use strict";
|
|
3329
3329
|
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3330
|
+
|
|
3331
|
+
var INT64_MIN = -(2n ** 63n);
|
|
3332
|
+
var INT64_MAX = 2n ** 63n - 1n;
|
|
3333
|
+
var MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
3334
|
+
var MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
3335
|
+
|
|
3336
|
+
// TOML's redefinition rules depend on how a table came to exist, not on its
|
|
3337
|
+
// shape, so every container the compiler creates is tagged with its origin.
|
|
3338
|
+
// Values that arrive from the parser (dates, static arrays, primitives) are
|
|
3339
|
+
// never tagged, which is what stops key paths from descending into them and
|
|
3340
|
+
// on into their prototype chains.
|
|
3341
|
+
var HEADER_TABLE = "header"; // [a]
|
|
3342
|
+
var IMPLICIT_TABLE = "implicit"; // `a` in [a.b]; a later [a] header may still define it
|
|
3343
|
+
var DOTTED_TABLE = "dotted"; // `a` in a.b = 1
|
|
3344
|
+
var INLINE_TABLE = "inline"; // a = { b = 1 }; closed once parsed
|
|
3345
|
+
var TABLE_ARRAY = "table-array"; // [[a]]
|
|
3346
|
+
|
|
3347
|
+
function compile(nodes, inputText, options) {
|
|
3348
|
+
options = options || {};
|
|
3349
|
+
var temporal = null;
|
|
3350
|
+
if (options.useTemporal) {
|
|
3351
|
+
temporal = options.temporal || (typeof Temporal !== "undefined" ? Temporal : null);
|
|
3352
|
+
if (!temporal) {
|
|
3353
|
+
throw new Error(
|
|
3354
|
+
"The `useTemporal` option was set, but no Temporal implementation is available. " +
|
|
3355
|
+
"Use a runtime with global `Temporal` support, or provide an implementation " +
|
|
3356
|
+
"(e.g. from the `@js-temporal/polyfill` package) via the `temporal` option."
|
|
3357
|
+
);
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
var containerKinds = new WeakMap();
|
|
3362
|
+
var data = createTable(HEADER_TABLE);
|
|
3337
3363
|
var context = data;
|
|
3364
|
+
var currentPath = [];
|
|
3338
3365
|
|
|
3339
3366
|
return reduce(nodes);
|
|
3340
3367
|
|
|
@@ -3376,213 +3403,206 @@ function compile(nodes, inputText) {
|
|
|
3376
3403
|
}
|
|
3377
3404
|
|
|
3378
3405
|
function assign(node) {
|
|
3379
|
-
var keys = node.key;
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
if (!Array.isArray(keys)) keys = [keys];
|
|
3384
|
-
|
|
3385
|
-
var reduced = reduceValueNode(value);
|
|
3406
|
+
var keys = Array.isArray(node.key) ? node.key : [node.key];
|
|
3407
|
+
assignDotted(context, keys, reduceValueNode(node.value), node.offset, currentPath);
|
|
3408
|
+
}
|
|
3386
3409
|
|
|
3387
|
-
|
|
3410
|
+
// Walks `keys` down from `table`, creating intermediate tables as needed,
|
|
3411
|
+
// and stores `value` under the last key. `prefix` names the path leading to
|
|
3412
|
+
// `table` and is only used in error messages.
|
|
3413
|
+
function assignDotted(table, keys, value, off, prefix) {
|
|
3388
3414
|
for (var i = 0; i < keys.length - 1; i++) {
|
|
3389
|
-
var
|
|
3390
|
-
var
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3415
|
+
var key = keys[i];
|
|
3416
|
+
var next = table[key];
|
|
3417
|
+
if (next === undefined) {
|
|
3418
|
+
next = createTable(DOTTED_TABLE);
|
|
3419
|
+
table[key] = next;
|
|
3420
|
+
} else {
|
|
3421
|
+
var kind = containerKinds.get(next);
|
|
3422
|
+
if (kind !== DOTTED_TABLE && kind !== IMPLICIT_TABLE) {
|
|
3423
|
+
var path = pathKey(prefix.concat(keys.slice(0, i + 1)));
|
|
3424
|
+
if (kind === HEADER_TABLE) {
|
|
3425
|
+
genError("Cannot use dotted keys to extend table '" + path + "' defined elsewhere.", off);
|
|
3426
|
+
}
|
|
3427
|
+
if (kind === INLINE_TABLE) {
|
|
3428
|
+
genError("Cannot extend inline table '" + path + "'.", off);
|
|
3429
|
+
}
|
|
3430
|
+
genError("Cannot redefine existing key '" + path + "'.", off);
|
|
3431
|
+
}
|
|
3401
3432
|
}
|
|
3402
|
-
|
|
3433
|
+
table = next;
|
|
3403
3434
|
}
|
|
3404
3435
|
|
|
3405
3436
|
var lastKey = keys[keys.length - 1];
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
if (typeof target[lastKey] !== "undefined") {
|
|
3409
|
-
genError("Cannot redefine existing key '" + fullPath + "'.", off);
|
|
3437
|
+
if (table[lastKey] !== undefined) {
|
|
3438
|
+
genError("Cannot redefine existing key '" + pathKey(prefix.concat(keys)) + "'.", off);
|
|
3410
3439
|
}
|
|
3411
|
-
|
|
3412
|
-
target[lastKey] = reduced;
|
|
3413
|
-
|
|
3414
|
-
assignedPaths.add(fullPath);
|
|
3415
|
-
valueAssignments.add(fullPath);
|
|
3440
|
+
table[lastKey] = value;
|
|
3416
3441
|
}
|
|
3417
3442
|
|
|
3418
|
-
|
|
3419
3443
|
function reduceValueNode(node) {
|
|
3420
|
-
if (node.type === "
|
|
3444
|
+
if (node.type === "Integer") {
|
|
3445
|
+
return reduceInteger(node);
|
|
3446
|
+
} else if (node.type === "Array") {
|
|
3421
3447
|
return reduceArray(node.value);
|
|
3422
3448
|
} else if (node.type === "InlineTable") {
|
|
3423
3449
|
return reduceInlineTableNode(node.value);
|
|
3424
|
-
} else {
|
|
3425
|
-
|
|
3450
|
+
} else if (temporal) {
|
|
3451
|
+
switch (node.type) {
|
|
3452
|
+
case "Date":
|
|
3453
|
+
return temporal.ZonedDateTime.from(
|
|
3454
|
+
truncateFractionalSeconds(node.raw) + node.tz +
|
|
3455
|
+
"[" + (node.tz === "Z" ? "UTC" : node.tz) + "]"
|
|
3456
|
+
);
|
|
3457
|
+
case "LocalDateTime":
|
|
3458
|
+
return temporal.PlainDateTime.from(truncateFractionalSeconds(node.value));
|
|
3459
|
+
case "LocalDate":
|
|
3460
|
+
return temporal.PlainDate.from(node.value);
|
|
3461
|
+
case "LocalTime":
|
|
3462
|
+
return temporal.PlainTime.from(truncateFractionalSeconds(node.value));
|
|
3463
|
+
}
|
|
3426
3464
|
}
|
|
3465
|
+
return node.value;
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
// TOML allows arbitrary fractional-second precision (implementations may
|
|
3469
|
+
// truncate); Temporal rejects more than 9 digits (nanoseconds).
|
|
3470
|
+
function truncateFractionalSeconds(str) {
|
|
3471
|
+
return str.replace(/\.(\d{9})\d+/, ".$1");
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3474
|
+
// Integer nodes arrive from the parser as BigInt so the full 64-bit
|
|
3475
|
+
// range is preserved exactly.
|
|
3476
|
+
function reduceInteger(node) {
|
|
3477
|
+
var value = node.value;
|
|
3478
|
+
if (value < INT64_MIN || value > INT64_MAX) {
|
|
3479
|
+
genError(
|
|
3480
|
+
"Integer " + value + " is outside the 64-bit signed integer range required by TOML.",
|
|
3481
|
+
node.offset
|
|
3482
|
+
);
|
|
3483
|
+
}
|
|
3484
|
+
if (options.bigint) {
|
|
3485
|
+
return value;
|
|
3486
|
+
}
|
|
3487
|
+
if (value < MIN_SAFE || value > MAX_SAFE) {
|
|
3488
|
+
genError(
|
|
3489
|
+
"Integer " + value + " cannot be represented losslessly as a JavaScript number. " +
|
|
3490
|
+
"Use the `bigint` option to parse integers as BigInt values.",
|
|
3491
|
+
node.offset
|
|
3492
|
+
);
|
|
3493
|
+
}
|
|
3494
|
+
return Number(value);
|
|
3427
3495
|
}
|
|
3428
3496
|
|
|
3429
3497
|
function reduceInlineTableNode(values) {
|
|
3430
|
-
var
|
|
3431
|
-
var definedKeys = new Set();
|
|
3498
|
+
var table = createTable(INLINE_TABLE);
|
|
3432
3499
|
|
|
3433
3500
|
for (var i = 0; i < values.length; i++) {
|
|
3434
3501
|
var val = values[i];
|
|
3435
3502
|
if (val.type !== "InlineTableValue") continue;
|
|
3436
3503
|
|
|
3437
|
-
var keys = val.key;
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
var reduced = reduceValueNode(val.value);
|
|
3441
|
-
setNestedKey(obj, keys, reduced, val.offset, definedKeys);
|
|
3442
|
-
|
|
3443
|
-
definedKeys.add(pathKey(keys));
|
|
3504
|
+
var keys = Array.isArray(val.key) ? val.key : [val.key];
|
|
3505
|
+
assignDotted(table, keys, reduceValueNode(val.value), val.offset, []);
|
|
3444
3506
|
}
|
|
3445
3507
|
|
|
3446
|
-
return
|
|
3447
|
-
}
|
|
3448
|
-
|
|
3449
|
-
function setNestedKey(obj, keys, value, off, definedKeys) {
|
|
3450
|
-
for (var i = 0; i < keys.length - 1; i++) {
|
|
3451
|
-
var k = keys[i];
|
|
3452
|
-
var intermediatePath = pathKey(keys.slice(0, i + 1));
|
|
3453
|
-
if (typeof obj[k] === "undefined") {
|
|
3454
|
-
obj[k] = createTable();
|
|
3455
|
-
} else if (typeof obj[k] !== "object" || obj[k] === null || Array.isArray(obj[k])) {
|
|
3456
|
-
genError("Cannot redefine existing key '" + intermediatePath + "'.", off);
|
|
3457
|
-
} else if (definedKeys && definedKeys.has(intermediatePath)) {
|
|
3458
|
-
genError("Cannot extend inline table '" + intermediatePath + "'.", off);
|
|
3459
|
-
}
|
|
3460
|
-
obj = obj[k];
|
|
3461
|
-
}
|
|
3462
|
-
var lastKey = keys[keys.length - 1];
|
|
3463
|
-
if (typeof obj[lastKey] !== "undefined") {
|
|
3464
|
-
genError("Cannot redefine existing key '" + pathKey(keys) + "'.", off);
|
|
3465
|
-
}
|
|
3466
|
-
obj[lastKey] = value;
|
|
3508
|
+
return table;
|
|
3467
3509
|
}
|
|
3468
3510
|
|
|
3469
3511
|
function setPath(node) {
|
|
3470
3512
|
var path = node.value;
|
|
3471
|
-
var quotedPath = path.map(quoteDottedString).join(".");
|
|
3472
3513
|
var off = node.offset;
|
|
3473
3514
|
|
|
3474
|
-
|
|
3475
|
-
|
|
3515
|
+
var parent = resolveParentTable(path, off);
|
|
3516
|
+
var name = path[path.length - 1];
|
|
3517
|
+
var table = parent[name];
|
|
3518
|
+
|
|
3519
|
+
if (table === undefined) {
|
|
3520
|
+
table = createTable(HEADER_TABLE);
|
|
3521
|
+
parent[name] = table;
|
|
3522
|
+
} else if (containerKinds.get(table) === IMPLICIT_TABLE) {
|
|
3523
|
+
containerKinds.set(table, HEADER_TABLE);
|
|
3524
|
+
} else {
|
|
3525
|
+
genError("Cannot redefine existing key '" + pathKey(path) + "'.", off);
|
|
3476
3526
|
}
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
context = deepRef(data, path, createTable(), off);
|
|
3527
|
+
|
|
3528
|
+
context = table;
|
|
3480
3529
|
currentPath = path;
|
|
3481
3530
|
}
|
|
3482
3531
|
|
|
3483
3532
|
function addTableArray(node) {
|
|
3484
3533
|
var path = node.value;
|
|
3485
|
-
var quotedPath = path.map(quoteDottedString).join(".");
|
|
3486
3534
|
var off = node.offset;
|
|
3487
3535
|
|
|
3488
|
-
|
|
3489
|
-
|
|
3536
|
+
var parent = resolveParentTable(path, off);
|
|
3537
|
+
var name = path[path.length - 1];
|
|
3538
|
+
var tableArray = parent[name];
|
|
3539
|
+
|
|
3540
|
+
if (tableArray === undefined) {
|
|
3541
|
+
tableArray = createTableArray();
|
|
3542
|
+
parent[name] = tableArray;
|
|
3543
|
+
} else if (containerKinds.get(tableArray) !== TABLE_ARRAY) {
|
|
3544
|
+
if (Array.isArray(tableArray)) {
|
|
3545
|
+
genError("Cannot append to statically defined array '" + pathKey(path) + "'.", off);
|
|
3546
|
+
}
|
|
3547
|
+
genError("Cannot redefine existing key '" + pathKey(path) + "'.", off);
|
|
3490
3548
|
}
|
|
3491
3549
|
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
});
|
|
3496
|
-
valueAssignments.forEach(function(p) {
|
|
3497
|
-
if (isSameOrSubPath(p, quotedPath)) valueAssignments.delete(p);
|
|
3498
|
-
});
|
|
3499
|
-
assignedPaths.add(quotedPath);
|
|
3500
|
-
context = deepRef(data, path, createTableArray(), off);
|
|
3550
|
+
var table = createTable(HEADER_TABLE);
|
|
3551
|
+
tableArray.push(table);
|
|
3552
|
+
context = table;
|
|
3501
3553
|
currentPath = path;
|
|
3502
|
-
|
|
3503
|
-
if (context instanceof Array) {
|
|
3504
|
-
var newObj = createTable();
|
|
3505
|
-
context.push(newObj);
|
|
3506
|
-
context = newObj;
|
|
3507
|
-
} else {
|
|
3508
|
-
genError("Cannot redefine existing key '" + path + "'.", off);
|
|
3509
|
-
}
|
|
3510
3554
|
}
|
|
3511
3555
|
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
}
|
|
3524
|
-
} else if (i !== keys.length - 1 && valueAssignments.has(traversedPath)) {
|
|
3525
|
-
genError("Cannot redefine existing key '" + traversedPath + "'.", off);
|
|
3556
|
+
// Returns the table a header's last key belongs in, creating implicit
|
|
3557
|
+
// tables along the way. A path through an array of tables refers to its
|
|
3558
|
+
// most recent element.
|
|
3559
|
+
function resolveParentTable(path, off) {
|
|
3560
|
+
var table = data;
|
|
3561
|
+
for (var i = 0; i < path.length - 1; i++) {
|
|
3562
|
+
var key = path[i];
|
|
3563
|
+
var next = table[key];
|
|
3564
|
+
if (next === undefined) {
|
|
3565
|
+
next = createTable(IMPLICIT_TABLE);
|
|
3566
|
+
table[key] = next;
|
|
3526
3567
|
}
|
|
3527
3568
|
|
|
3528
|
-
|
|
3529
|
-
if (
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
if (ctx instanceof Array) {
|
|
3534
|
-
if (!ctx.length) {
|
|
3535
|
-
genError("Cannot redefine existing key '" + traversedPath + "'.", off);
|
|
3536
|
-
}
|
|
3537
|
-
ctx = ctx[ctx.length - 1];
|
|
3538
|
-
if (!isOwnedContainer(ctx)) {
|
|
3539
|
-
genError("Cannot redefine existing key '" + traversedPath + "'.", off);
|
|
3540
|
-
}
|
|
3541
|
-
}
|
|
3569
|
+
var kind = containerKinds.get(next);
|
|
3570
|
+
if (kind === TABLE_ARRAY) {
|
|
3571
|
+
next = next[next.length - 1];
|
|
3572
|
+
} else if (kind === undefined || kind === INLINE_TABLE) {
|
|
3573
|
+
genError("Cannot redefine existing key '" + pathKey(path.slice(0, i + 1)) + "'.", off);
|
|
3542
3574
|
}
|
|
3575
|
+
table = next;
|
|
3543
3576
|
}
|
|
3544
|
-
|
|
3545
|
-
return ctx;
|
|
3577
|
+
return table;
|
|
3546
3578
|
}
|
|
3547
3579
|
|
|
3548
3580
|
function reduceArray(array) {
|
|
3549
3581
|
return array.map(reduceValueNode);
|
|
3550
3582
|
}
|
|
3551
3583
|
|
|
3552
|
-
function
|
|
3553
|
-
if (str.indexOf(".") > -1) {
|
|
3554
|
-
return "\"" + str + "\"";
|
|
3555
|
-
} else {
|
|
3556
|
-
return str;
|
|
3557
|
-
}
|
|
3558
|
-
}
|
|
3559
|
-
|
|
3560
|
-
function createTable() {
|
|
3584
|
+
function createTable(kind) {
|
|
3561
3585
|
var table = Object.create(null);
|
|
3562
|
-
|
|
3586
|
+
containerKinds.set(table, kind);
|
|
3563
3587
|
return table;
|
|
3564
3588
|
}
|
|
3565
3589
|
|
|
3566
3590
|
function createTableArray() {
|
|
3567
3591
|
var tableArray = [];
|
|
3568
|
-
|
|
3592
|
+
containerKinds.set(tableArray, TABLE_ARRAY);
|
|
3569
3593
|
return tableArray;
|
|
3570
3594
|
}
|
|
3571
3595
|
|
|
3572
|
-
function isOwnedContainer(value) {
|
|
3573
|
-
return value !== null && typeof value === "object" && ownedContainers.has(value);
|
|
3574
|
-
}
|
|
3575
|
-
|
|
3576
3596
|
function pathKey(keys) {
|
|
3577
3597
|
return keys.map(quoteDottedString).join(".");
|
|
3578
3598
|
}
|
|
3579
3599
|
|
|
3580
|
-
function
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3600
|
+
function quoteDottedString(str) {
|
|
3601
|
+
if (str.indexOf(".") > -1) {
|
|
3602
|
+
return "\"" + str + "\"";
|
|
3603
|
+
} else {
|
|
3604
|
+
return str;
|
|
3605
|
+
}
|
|
3586
3606
|
}
|
|
3587
3607
|
}
|
|
3588
3608
|
|
|
@@ -3922,10 +3942,10 @@ function peg$parse(input, options) {
|
|
|
3922
3942
|
function peg$f39(sign, digits) { return (sign === '-' ? '-' : '') + digits }
|
|
3923
3943
|
function peg$f40() { return '0' }
|
|
3924
3944
|
function peg$f41(sign, digits) { return (sign || '') + digits }
|
|
3925
|
-
function peg$f42(digits) { return
|
|
3926
|
-
function peg$f43(digits) { return
|
|
3927
|
-
function peg$f44(digits) { return
|
|
3928
|
-
function peg$f45(text) { return
|
|
3945
|
+
function peg$f42(digits) { return integerNode(16, digits, offset()) }
|
|
3946
|
+
function peg$f43(digits) { return integerNode(8, digits, offset()) }
|
|
3947
|
+
function peg$f44(digits) { return integerNode(2, digits, offset()) }
|
|
3948
|
+
function peg$f45(text) { return integerNode(10, text, offset()) }
|
|
3929
3949
|
function peg$f46(sign) { return (sign || '') + '0' }
|
|
3930
3950
|
function peg$f47(sign, digits) { return (sign || '') + digits }
|
|
3931
3951
|
function peg$f48() { return node('Boolean', true, offset()) }
|
|
@@ -3947,7 +3967,7 @@ function peg$parse(input, options) {
|
|
|
3947
3967
|
function peg$f60(t, frac) { return frac ? t + frac : t }
|
|
3948
3968
|
function peg$f61(t) { return t + ':00' }
|
|
3949
3969
|
function peg$f62() { return "Z" }
|
|
3950
|
-
function peg$f63(d, t, o) { var off = offset(); validateDate(d, off); validateTime(t, off); validateOffset(o, off);
|
|
3970
|
+
function peg$f63(d, t, o) { var off = offset(); validateDate(d, off); validateTime(t, off); validateOffset(o, off); var n = node('Date', new Date(d + "T" + t + o), off); n.raw = d + "T" + t; n.tz = o; return n }
|
|
3951
3971
|
function peg$f64(d, t) { var off = offset(); validateDate(d, off); validateTime(t, off); return node('LocalDateTime', d + "T" + t, off) }
|
|
3952
3972
|
function peg$f65(d) { var off = offset(); validateDate(d, off); return node('LocalDate', d, off) }
|
|
3953
3973
|
function peg$f66(t) { var off = offset(); validateTime(t, off); return node('LocalTime', t, off) }
|
|
@@ -8015,6 +8035,22 @@ function peg$parse(input, options) {
|
|
|
8015
8035
|
return str.indexOf('_') === -1 ? str : str.replace(/_/g, '');
|
|
8016
8036
|
}
|
|
8017
8037
|
|
|
8038
|
+
// Digits in the largest int64 magnitude for each base. BigInt conversion
|
|
8039
|
+
// is super-linear in digit count, so a literal that cannot fit is rejected
|
|
8040
|
+
// by length before converting (GHSA-9qmh-m7c6-f92p); the compiler still
|
|
8041
|
+
// performs the exact range check on what gets through.
|
|
8042
|
+
var MAX_INT64_DIGITS = { 2: 63, 8: 21, 10: 19, 16: 16 };
|
|
8043
|
+
var RADIX_PREFIX = { 2: '0b', 8: '0o', 10: '', 16: '0x' };
|
|
8044
|
+
|
|
8045
|
+
function integerNode(radix, text, off) {
|
|
8046
|
+
var digits = stripUnderscores(text);
|
|
8047
|
+
var significant = digits.replace(/^[+-]?0*/, '');
|
|
8048
|
+
if (significant.length > MAX_INT64_DIGITS[radix]) {
|
|
8049
|
+
genError("Integer literal is outside the 64-bit signed integer range required by TOML.", off);
|
|
8050
|
+
}
|
|
8051
|
+
return node('Integer', BigInt(RADIX_PREFIX[radix] + digits), off);
|
|
8052
|
+
}
|
|
8053
|
+
|
|
8018
8054
|
function convertCodePoint(str) {
|
|
8019
8055
|
var num = parseInt(str, 16);
|
|
8020
8056
|
|