@putout/bundle 1.5.3 → 1.6.0
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/bundle/putout-iife.js +291 -301
- package/bundle/putout.js +301 -291
- package/package.json +1 -1
package/bundle/putout-iife.js
CHANGED
|
@@ -4700,358 +4700,348 @@
|
|
|
4700
4700
|
|
|
4701
4701
|
var lib$i = {};
|
|
4702
4702
|
|
|
4703
|
-
|
|
4703
|
+
Object.defineProperty(lib$i, "__esModule", {
|
|
4704
|
+
value: true
|
|
4705
|
+
});
|
|
4706
|
+
lib$i.readCodePoint = readCodePoint$1;
|
|
4707
|
+
lib$i.readInt = readInt$1;
|
|
4708
|
+
lib$i.readStringContents = readStringContents$1;
|
|
4704
4709
|
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4710
|
+
var _isDigit$1 = function isDigit(code) {
|
|
4711
|
+
return code >= 48 && code <= 57;
|
|
4712
|
+
};
|
|
4708
4713
|
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4714
|
+
const forbiddenNumericSeparatorSiblings$1 = {
|
|
4715
|
+
decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
|
|
4716
|
+
hex: new Set([46, 88, 95, 120])
|
|
4717
|
+
};
|
|
4718
|
+
const isAllowedNumericSeparatorSibling$1 = {
|
|
4719
|
+
bin: ch => ch === 48 || ch === 49,
|
|
4720
|
+
oct: ch => ch >= 48 && ch <= 55,
|
|
4721
|
+
dec: ch => ch >= 48 && ch <= 57,
|
|
4722
|
+
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
4723
|
+
};
|
|
4715
4724
|
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4725
|
+
function readStringContents$1(type, input, pos, lineStart, curLine, errors) {
|
|
4726
|
+
const initialPos = pos;
|
|
4727
|
+
const initialLineStart = lineStart;
|
|
4728
|
+
const initialCurLine = curLine;
|
|
4729
|
+
let out = "";
|
|
4730
|
+
let firstInvalidLoc = null;
|
|
4731
|
+
let chunkStart = pos;
|
|
4732
|
+
const {
|
|
4733
|
+
length
|
|
4734
|
+
} = input;
|
|
4719
4735
|
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
oct: ch => ch >= 48 && ch <= 55,
|
|
4727
|
-
dec: ch => ch >= 48 && ch <= 57,
|
|
4728
|
-
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
4729
|
-
};
|
|
4736
|
+
for (;;) {
|
|
4737
|
+
if (pos >= length) {
|
|
4738
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
4739
|
+
out += input.slice(chunkStart, pos);
|
|
4740
|
+
break;
|
|
4741
|
+
}
|
|
4730
4742
|
|
|
4731
|
-
|
|
4732
|
-
const initialPos = pos;
|
|
4733
|
-
const initialLineStart = lineStart;
|
|
4734
|
-
const initialCurLine = curLine;
|
|
4735
|
-
let out = "";
|
|
4736
|
-
let firstInvalidLoc = null;
|
|
4737
|
-
let chunkStart = pos;
|
|
4738
|
-
const {
|
|
4739
|
-
length
|
|
4740
|
-
} = input;
|
|
4743
|
+
const ch = input.charCodeAt(pos);
|
|
4741
4744
|
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
break;
|
|
4747
|
-
}
|
|
4745
|
+
if (isStringEnd$1(type, ch, input, pos)) {
|
|
4746
|
+
out += input.slice(chunkStart, pos);
|
|
4747
|
+
break;
|
|
4748
|
+
}
|
|
4748
4749
|
|
|
4749
|
-
|
|
4750
|
+
if (ch === 92) {
|
|
4751
|
+
out += input.slice(chunkStart, pos);
|
|
4752
|
+
const res = readEscapedChar$1(input, pos, lineStart, curLine, type === "template", errors);
|
|
4750
4753
|
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4754
|
+
if (res.ch === null && !firstInvalidLoc) {
|
|
4755
|
+
firstInvalidLoc = {
|
|
4756
|
+
pos,
|
|
4757
|
+
lineStart,
|
|
4758
|
+
curLine
|
|
4759
|
+
};
|
|
4760
|
+
} else {
|
|
4761
|
+
out += res.ch;
|
|
4762
|
+
}
|
|
4755
4763
|
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4764
|
+
({
|
|
4765
|
+
pos,
|
|
4766
|
+
lineStart,
|
|
4767
|
+
curLine
|
|
4768
|
+
} = res);
|
|
4769
|
+
chunkStart = pos;
|
|
4770
|
+
} else if (ch === 8232 || ch === 8233) {
|
|
4771
|
+
++pos;
|
|
4772
|
+
++curLine;
|
|
4773
|
+
lineStart = pos;
|
|
4774
|
+
} else if (ch === 10 || ch === 13) {
|
|
4775
|
+
if (type === "template") {
|
|
4776
|
+
out += input.slice(chunkStart, pos) + "\n";
|
|
4777
|
+
++pos;
|
|
4759
4778
|
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
lineStart,
|
|
4764
|
-
curLine
|
|
4765
|
-
};
|
|
4766
|
-
} else {
|
|
4767
|
-
out += res.ch;
|
|
4768
|
-
}
|
|
4779
|
+
if (ch === 13 && input.charCodeAt(pos) === 10) {
|
|
4780
|
+
++pos;
|
|
4781
|
+
}
|
|
4769
4782
|
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
lineStart = pos;
|
|
4780
|
-
} else if (ch === 10 || ch === 13) {
|
|
4781
|
-
if (type === "template") {
|
|
4782
|
-
out += input.slice(chunkStart, pos) + "\n";
|
|
4783
|
-
++pos;
|
|
4784
|
-
|
|
4785
|
-
if (ch === 13 && input.charCodeAt(pos) === 10) {
|
|
4786
|
-
++pos;
|
|
4787
|
-
}
|
|
4783
|
+
++curLine;
|
|
4784
|
+
chunkStart = lineStart = pos;
|
|
4785
|
+
} else {
|
|
4786
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
4787
|
+
}
|
|
4788
|
+
} else {
|
|
4789
|
+
++pos;
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4788
4792
|
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4793
|
+
return {
|
|
4794
|
+
pos,
|
|
4795
|
+
str: out,
|
|
4796
|
+
firstInvalidLoc,
|
|
4797
|
+
lineStart,
|
|
4798
|
+
curLine,
|
|
4799
|
+
containsInvalid: !!firstInvalidLoc
|
|
4800
|
+
};
|
|
4801
|
+
}
|
|
4798
4802
|
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
lineStart,
|
|
4804
|
-
curLine,
|
|
4805
|
-
containsInvalid: !!firstInvalidLoc
|
|
4806
|
-
};
|
|
4807
|
-
}
|
|
4803
|
+
function isStringEnd$1(type, ch, input, pos) {
|
|
4804
|
+
if (type === "template") {
|
|
4805
|
+
return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
|
|
4806
|
+
}
|
|
4808
4807
|
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
|
|
4812
|
-
}
|
|
4808
|
+
return ch === (type === "double" ? 34 : 39);
|
|
4809
|
+
}
|
|
4813
4810
|
|
|
4814
|
-
|
|
4815
|
-
|
|
4811
|
+
function readEscapedChar$1(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
4812
|
+
const throwOnInvalid = !inTemplate;
|
|
4813
|
+
pos++;
|
|
4816
4814
|
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4815
|
+
const res = ch => ({
|
|
4816
|
+
pos,
|
|
4817
|
+
ch,
|
|
4818
|
+
lineStart,
|
|
4819
|
+
curLine
|
|
4820
|
+
});
|
|
4820
4821
|
|
|
4821
|
-
|
|
4822
|
-
pos,
|
|
4823
|
-
ch,
|
|
4824
|
-
lineStart,
|
|
4825
|
-
curLine
|
|
4826
|
-
});
|
|
4822
|
+
const ch = input.charCodeAt(pos++);
|
|
4827
4823
|
|
|
4828
|
-
|
|
4824
|
+
switch (ch) {
|
|
4825
|
+
case 110:
|
|
4826
|
+
return res("\n");
|
|
4829
4827
|
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
return res("\n");
|
|
4828
|
+
case 114:
|
|
4829
|
+
return res("\r");
|
|
4833
4830
|
|
|
4834
|
-
|
|
4835
|
-
|
|
4831
|
+
case 120:
|
|
4832
|
+
{
|
|
4833
|
+
let code;
|
|
4834
|
+
({
|
|
4835
|
+
code,
|
|
4836
|
+
pos
|
|
4837
|
+
} = readHexChar$1(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
|
|
4838
|
+
return res(code === null ? null : String.fromCharCode(code));
|
|
4839
|
+
}
|
|
4836
4840
|
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4841
|
+
case 117:
|
|
4842
|
+
{
|
|
4843
|
+
let code;
|
|
4844
|
+
({
|
|
4845
|
+
code,
|
|
4846
|
+
pos
|
|
4847
|
+
} = readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors));
|
|
4848
|
+
return res(code === null ? null : String.fromCodePoint(code));
|
|
4849
|
+
}
|
|
4846
4850
|
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
let code;
|
|
4850
|
-
({
|
|
4851
|
-
code,
|
|
4852
|
-
pos
|
|
4853
|
-
} = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
|
|
4854
|
-
return res(code === null ? null : String.fromCodePoint(code));
|
|
4855
|
-
}
|
|
4851
|
+
case 116:
|
|
4852
|
+
return res("\t");
|
|
4856
4853
|
|
|
4857
|
-
|
|
4858
|
-
|
|
4854
|
+
case 98:
|
|
4855
|
+
return res("\b");
|
|
4859
4856
|
|
|
4860
|
-
|
|
4861
|
-
|
|
4857
|
+
case 118:
|
|
4858
|
+
return res("\u000b");
|
|
4862
4859
|
|
|
4863
|
-
|
|
4864
|
-
|
|
4860
|
+
case 102:
|
|
4861
|
+
return res("\f");
|
|
4865
4862
|
|
|
4866
|
-
|
|
4867
|
-
|
|
4863
|
+
case 13:
|
|
4864
|
+
if (input.charCodeAt(pos) === 10) {
|
|
4865
|
+
++pos;
|
|
4866
|
+
}
|
|
4868
4867
|
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
}
|
|
4868
|
+
case 10:
|
|
4869
|
+
lineStart = pos;
|
|
4870
|
+
++curLine;
|
|
4873
4871
|
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4872
|
+
case 8232:
|
|
4873
|
+
case 8233:
|
|
4874
|
+
return res("");
|
|
4877
4875
|
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4876
|
+
case 56:
|
|
4877
|
+
case 57:
|
|
4878
|
+
if (inTemplate) {
|
|
4879
|
+
return res(null);
|
|
4880
|
+
} else {
|
|
4881
|
+
errors.strictNumericEscape(pos - 1, lineStart, curLine);
|
|
4882
|
+
}
|
|
4881
4883
|
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
}
|
|
4884
|
+
default:
|
|
4885
|
+
if (ch >= 48 && ch <= 55) {
|
|
4886
|
+
const startPos = pos - 1;
|
|
4887
|
+
const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
|
|
4888
|
+
let octalStr = match[0];
|
|
4889
|
+
let octal = parseInt(octalStr, 8);
|
|
4889
4890
|
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
let octalStr = match[0];
|
|
4895
|
-
let octal = parseInt(octalStr, 8);
|
|
4896
|
-
|
|
4897
|
-
if (octal > 255) {
|
|
4898
|
-
octalStr = octalStr.slice(0, -1);
|
|
4899
|
-
octal = parseInt(octalStr, 8);
|
|
4900
|
-
}
|
|
4891
|
+
if (octal > 255) {
|
|
4892
|
+
octalStr = octalStr.slice(0, -1);
|
|
4893
|
+
octal = parseInt(octalStr, 8);
|
|
4894
|
+
}
|
|
4901
4895
|
|
|
4902
|
-
|
|
4903
|
-
|
|
4896
|
+
pos += octalStr.length - 1;
|
|
4897
|
+
const next = input.charCodeAt(pos);
|
|
4904
4898
|
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4899
|
+
if (octalStr !== "0" || next === 56 || next === 57) {
|
|
4900
|
+
if (inTemplate) {
|
|
4901
|
+
return res(null);
|
|
4902
|
+
} else {
|
|
4903
|
+
errors.strictNumericEscape(startPos, lineStart, curLine);
|
|
4904
|
+
}
|
|
4905
|
+
}
|
|
4912
4906
|
|
|
4913
|
-
|
|
4914
|
-
|
|
4907
|
+
return res(String.fromCharCode(octal));
|
|
4908
|
+
}
|
|
4915
4909
|
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4910
|
+
return res(String.fromCharCode(ch));
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4919
4913
|
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4914
|
+
function readHexChar$1(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
4915
|
+
const initialPos = pos;
|
|
4916
|
+
let n;
|
|
4917
|
+
({
|
|
4918
|
+
n,
|
|
4919
|
+
pos
|
|
4920
|
+
} = readInt$1(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
4927
4921
|
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4922
|
+
if (n === null) {
|
|
4923
|
+
if (throwOnInvalid) {
|
|
4924
|
+
errors.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
4925
|
+
} else {
|
|
4926
|
+
pos = initialPos - 1;
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4935
4929
|
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4930
|
+
return {
|
|
4931
|
+
code: n,
|
|
4932
|
+
pos
|
|
4933
|
+
};
|
|
4934
|
+
}
|
|
4941
4935
|
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4936
|
+
function readInt$1(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
4937
|
+
const start = pos;
|
|
4938
|
+
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings$1.hex : forbiddenNumericSeparatorSiblings$1.decBinOct;
|
|
4939
|
+
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling$1.hex : radix === 10 ? isAllowedNumericSeparatorSibling$1.dec : radix === 8 ? isAllowedNumericSeparatorSibling$1.oct : isAllowedNumericSeparatorSibling$1.bin;
|
|
4940
|
+
let invalid = false;
|
|
4941
|
+
let total = 0;
|
|
4948
4942
|
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4943
|
+
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
4944
|
+
const code = input.charCodeAt(pos);
|
|
4945
|
+
let val;
|
|
4952
4946
|
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4947
|
+
if (code === 95 && allowNumSeparator !== "bail") {
|
|
4948
|
+
const prev = input.charCodeAt(pos - 1);
|
|
4949
|
+
const next = input.charCodeAt(pos + 1);
|
|
4956
4950
|
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4951
|
+
if (!allowNumSeparator) {
|
|
4952
|
+
if (bailOnError) return {
|
|
4953
|
+
n: null,
|
|
4954
|
+
pos
|
|
4955
|
+
};
|
|
4956
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
4957
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
|
|
4958
|
+
if (bailOnError) return {
|
|
4959
|
+
n: null,
|
|
4960
|
+
pos
|
|
4961
|
+
};
|
|
4962
|
+
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
4963
|
+
}
|
|
4970
4964
|
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4965
|
+
++pos;
|
|
4966
|
+
continue;
|
|
4967
|
+
}
|
|
4974
4968
|
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4969
|
+
if (code >= 97) {
|
|
4970
|
+
val = code - 97 + 10;
|
|
4971
|
+
} else if (code >= 65) {
|
|
4972
|
+
val = code - 65 + 10;
|
|
4973
|
+
} else if (_isDigit$1(code)) {
|
|
4974
|
+
val = code - 48;
|
|
4975
|
+
} else {
|
|
4976
|
+
val = Infinity;
|
|
4977
|
+
}
|
|
4984
4978
|
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
4979
|
+
if (val >= radix) {
|
|
4980
|
+
if (val <= 9 && bailOnError) {
|
|
4981
|
+
return {
|
|
4982
|
+
n: null,
|
|
4983
|
+
pos
|
|
4984
|
+
};
|
|
4985
|
+
} else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
|
|
4986
|
+
val = 0;
|
|
4987
|
+
} else if (forceLen) {
|
|
4988
|
+
val = 0;
|
|
4989
|
+
invalid = true;
|
|
4990
|
+
} else {
|
|
4991
|
+
break;
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
5000
4994
|
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
4995
|
+
++pos;
|
|
4996
|
+
total = total * radix + val;
|
|
4997
|
+
}
|
|
5004
4998
|
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
4999
|
+
if (pos === start || len != null && pos - start !== len || invalid) {
|
|
5000
|
+
return {
|
|
5001
|
+
n: null,
|
|
5002
|
+
pos
|
|
5003
|
+
};
|
|
5004
|
+
}
|
|
5011
5005
|
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5006
|
+
return {
|
|
5007
|
+
n: total,
|
|
5008
|
+
pos
|
|
5009
|
+
};
|
|
5010
|
+
}
|
|
5017
5011
|
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5012
|
+
function readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
5013
|
+
const ch = input.charCodeAt(pos);
|
|
5014
|
+
let code;
|
|
5021
5015
|
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
if (code !== null && code > 0x10ffff) {
|
|
5031
|
-
if (throwOnInvalid) {
|
|
5032
|
-
errors.invalidCodePoint(pos, lineStart, curLine);
|
|
5033
|
-
} else {
|
|
5034
|
-
return {
|
|
5035
|
-
code: null,
|
|
5036
|
-
pos
|
|
5037
|
-
};
|
|
5038
|
-
}
|
|
5039
|
-
}
|
|
5040
|
-
} else {
|
|
5041
|
-
({
|
|
5042
|
-
code,
|
|
5043
|
-
pos
|
|
5044
|
-
} = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
5045
|
-
}
|
|
5016
|
+
if (ch === 123) {
|
|
5017
|
+
++pos;
|
|
5018
|
+
({
|
|
5019
|
+
code,
|
|
5020
|
+
pos
|
|
5021
|
+
} = readHexChar$1(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
5022
|
+
++pos;
|
|
5046
5023
|
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5024
|
+
if (code !== null && code > 0x10ffff) {
|
|
5025
|
+
if (throwOnInvalid) {
|
|
5026
|
+
errors.invalidCodePoint(pos, lineStart, curLine);
|
|
5027
|
+
} else {
|
|
5028
|
+
return {
|
|
5029
|
+
code: null,
|
|
5030
|
+
pos
|
|
5031
|
+
};
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
} else {
|
|
5035
|
+
({
|
|
5036
|
+
code,
|
|
5037
|
+
pos
|
|
5038
|
+
} = readHexChar$1(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
5039
|
+
}
|
|
5052
5040
|
|
|
5053
|
-
|
|
5054
|
-
|
|
5041
|
+
return {
|
|
5042
|
+
code,
|
|
5043
|
+
pos
|
|
5044
|
+
};
|
|
5055
5045
|
}
|
|
5056
5046
|
|
|
5057
5047
|
var constants = {};
|
|
@@ -5405,7 +5395,7 @@
|
|
|
5405
5395
|
var _is = requireIs$1();
|
|
5406
5396
|
var _isValidIdentifier = isValidIdentifier$1;
|
|
5407
5397
|
var _helperValidatorIdentifier = lib$j;
|
|
5408
|
-
var _helperStringParser =
|
|
5398
|
+
var _helperStringParser = lib$i;
|
|
5409
5399
|
var _constants = constants;
|
|
5410
5400
|
var _utils = requireUtils$2();
|
|
5411
5401
|
const defineType = (0, _utils.defineAliasedType)("Standardized");
|
package/bundle/putout.js
CHANGED
|
@@ -4694,348 +4694,358 @@ function isValidIdentifier(name, reserved = true) {
|
|
|
4694
4694
|
|
|
4695
4695
|
var lib$i = {};
|
|
4696
4696
|
|
|
4697
|
-
|
|
4698
|
-
value: true
|
|
4699
|
-
});
|
|
4700
|
-
lib$i.readCodePoint = readCodePoint$1;
|
|
4701
|
-
lib$i.readInt = readInt$1;
|
|
4702
|
-
lib$i.readStringContents = readStringContents$1;
|
|
4697
|
+
var hasRequiredLib$b;
|
|
4703
4698
|
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4699
|
+
function requireLib$b () {
|
|
4700
|
+
if (hasRequiredLib$b) return lib$i;
|
|
4701
|
+
hasRequiredLib$b = 1;
|
|
4707
4702
|
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
oct: ch => ch >= 48 && ch <= 55,
|
|
4715
|
-
dec: ch => ch >= 48 && ch <= 57,
|
|
4716
|
-
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
4717
|
-
};
|
|
4703
|
+
Object.defineProperty(lib$i, "__esModule", {
|
|
4704
|
+
value: true
|
|
4705
|
+
});
|
|
4706
|
+
lib$i.readCodePoint = readCodePoint;
|
|
4707
|
+
lib$i.readInt = readInt;
|
|
4708
|
+
lib$i.readStringContents = readStringContents;
|
|
4718
4709
|
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
const initialCurLine = curLine;
|
|
4723
|
-
let out = "";
|
|
4724
|
-
let firstInvalidLoc = null;
|
|
4725
|
-
let chunkStart = pos;
|
|
4726
|
-
const {
|
|
4727
|
-
length
|
|
4728
|
-
} = input;
|
|
4710
|
+
var _isDigit = function isDigit(code) {
|
|
4711
|
+
return code >= 48 && code <= 57;
|
|
4712
|
+
};
|
|
4729
4713
|
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4714
|
+
const forbiddenNumericSeparatorSiblings = {
|
|
4715
|
+
decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
|
|
4716
|
+
hex: new Set([46, 88, 95, 120])
|
|
4717
|
+
};
|
|
4718
|
+
const isAllowedNumericSeparatorSibling = {
|
|
4719
|
+
bin: ch => ch === 48 || ch === 49,
|
|
4720
|
+
oct: ch => ch >= 48 && ch <= 55,
|
|
4721
|
+
dec: ch => ch >= 48 && ch <= 57,
|
|
4722
|
+
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
4723
|
+
};
|
|
4736
4724
|
|
|
4737
|
-
|
|
4725
|
+
function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
4726
|
+
const initialPos = pos;
|
|
4727
|
+
const initialLineStart = lineStart;
|
|
4728
|
+
const initialCurLine = curLine;
|
|
4729
|
+
let out = "";
|
|
4730
|
+
let firstInvalidLoc = null;
|
|
4731
|
+
let chunkStart = pos;
|
|
4732
|
+
const {
|
|
4733
|
+
length
|
|
4734
|
+
} = input;
|
|
4738
4735
|
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4736
|
+
for (;;) {
|
|
4737
|
+
if (pos >= length) {
|
|
4738
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
4739
|
+
out += input.slice(chunkStart, pos);
|
|
4740
|
+
break;
|
|
4741
|
+
}
|
|
4743
4742
|
|
|
4744
|
-
|
|
4745
|
-
out += input.slice(chunkStart, pos);
|
|
4746
|
-
const res = readEscapedChar$1(input, pos, lineStart, curLine, type === "template", errors);
|
|
4743
|
+
const ch = input.charCodeAt(pos);
|
|
4747
4744
|
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
curLine
|
|
4753
|
-
};
|
|
4754
|
-
} else {
|
|
4755
|
-
out += res.ch;
|
|
4756
|
-
}
|
|
4745
|
+
if (isStringEnd(type, ch, input, pos)) {
|
|
4746
|
+
out += input.slice(chunkStart, pos);
|
|
4747
|
+
break;
|
|
4748
|
+
}
|
|
4757
4749
|
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
curLine
|
|
4762
|
-
} = res);
|
|
4763
|
-
chunkStart = pos;
|
|
4764
|
-
} else if (ch === 8232 || ch === 8233) {
|
|
4765
|
-
++pos;
|
|
4766
|
-
++curLine;
|
|
4767
|
-
lineStart = pos;
|
|
4768
|
-
} else if (ch === 10 || ch === 13) {
|
|
4769
|
-
if (type === "template") {
|
|
4770
|
-
out += input.slice(chunkStart, pos) + "\n";
|
|
4771
|
-
++pos;
|
|
4750
|
+
if (ch === 92) {
|
|
4751
|
+
out += input.slice(chunkStart, pos);
|
|
4752
|
+
const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
|
|
4772
4753
|
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4754
|
+
if (res.ch === null && !firstInvalidLoc) {
|
|
4755
|
+
firstInvalidLoc = {
|
|
4756
|
+
pos,
|
|
4757
|
+
lineStart,
|
|
4758
|
+
curLine
|
|
4759
|
+
};
|
|
4760
|
+
} else {
|
|
4761
|
+
out += res.ch;
|
|
4762
|
+
}
|
|
4776
4763
|
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4764
|
+
({
|
|
4765
|
+
pos,
|
|
4766
|
+
lineStart,
|
|
4767
|
+
curLine
|
|
4768
|
+
} = res);
|
|
4769
|
+
chunkStart = pos;
|
|
4770
|
+
} else if (ch === 8232 || ch === 8233) {
|
|
4771
|
+
++pos;
|
|
4772
|
+
++curLine;
|
|
4773
|
+
lineStart = pos;
|
|
4774
|
+
} else if (ch === 10 || ch === 13) {
|
|
4775
|
+
if (type === "template") {
|
|
4776
|
+
out += input.slice(chunkStart, pos) + "\n";
|
|
4777
|
+
++pos;
|
|
4778
|
+
|
|
4779
|
+
if (ch === 13 && input.charCodeAt(pos) === 10) {
|
|
4780
|
+
++pos;
|
|
4781
|
+
}
|
|
4786
4782
|
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
}
|
|
4783
|
+
++curLine;
|
|
4784
|
+
chunkStart = lineStart = pos;
|
|
4785
|
+
} else {
|
|
4786
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
4787
|
+
}
|
|
4788
|
+
} else {
|
|
4789
|
+
++pos;
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4796
4792
|
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4793
|
+
return {
|
|
4794
|
+
pos,
|
|
4795
|
+
str: out,
|
|
4796
|
+
firstInvalidLoc,
|
|
4797
|
+
lineStart,
|
|
4798
|
+
curLine,
|
|
4799
|
+
containsInvalid: !!firstInvalidLoc
|
|
4800
|
+
};
|
|
4801
|
+
}
|
|
4801
4802
|
|
|
4802
|
-
|
|
4803
|
-
|
|
4803
|
+
function isStringEnd(type, ch, input, pos) {
|
|
4804
|
+
if (type === "template") {
|
|
4805
|
+
return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
|
|
4806
|
+
}
|
|
4804
4807
|
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
pos++;
|
|
4808
|
+
return ch === (type === "double" ? 34 : 39);
|
|
4809
|
+
}
|
|
4808
4810
|
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
lineStart,
|
|
4813
|
-
curLine
|
|
4814
|
-
});
|
|
4811
|
+
function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
4812
|
+
const throwOnInvalid = !inTemplate;
|
|
4813
|
+
pos++;
|
|
4815
4814
|
|
|
4816
|
-
|
|
4815
|
+
const res = ch => ({
|
|
4816
|
+
pos,
|
|
4817
|
+
ch,
|
|
4818
|
+
lineStart,
|
|
4819
|
+
curLine
|
|
4820
|
+
});
|
|
4817
4821
|
|
|
4818
|
-
|
|
4819
|
-
case 110:
|
|
4820
|
-
return res("\n");
|
|
4822
|
+
const ch = input.charCodeAt(pos++);
|
|
4821
4823
|
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
+
switch (ch) {
|
|
4825
|
+
case 110:
|
|
4826
|
+
return res("\n");
|
|
4824
4827
|
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
let code;
|
|
4828
|
-
({
|
|
4829
|
-
code,
|
|
4830
|
-
pos
|
|
4831
|
-
} = readHexChar$1(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
|
|
4832
|
-
return res(code === null ? null : String.fromCharCode(code));
|
|
4833
|
-
}
|
|
4828
|
+
case 114:
|
|
4829
|
+
return res("\r");
|
|
4834
4830
|
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4831
|
+
case 120:
|
|
4832
|
+
{
|
|
4833
|
+
let code;
|
|
4834
|
+
({
|
|
4835
|
+
code,
|
|
4836
|
+
pos
|
|
4837
|
+
} = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
|
|
4838
|
+
return res(code === null ? null : String.fromCharCode(code));
|
|
4839
|
+
}
|
|
4844
4840
|
|
|
4845
|
-
|
|
4846
|
-
|
|
4841
|
+
case 117:
|
|
4842
|
+
{
|
|
4843
|
+
let code;
|
|
4844
|
+
({
|
|
4845
|
+
code,
|
|
4846
|
+
pos
|
|
4847
|
+
} = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
|
|
4848
|
+
return res(code === null ? null : String.fromCodePoint(code));
|
|
4849
|
+
}
|
|
4847
4850
|
|
|
4848
|
-
|
|
4849
|
-
|
|
4851
|
+
case 116:
|
|
4852
|
+
return res("\t");
|
|
4850
4853
|
|
|
4851
|
-
|
|
4852
|
-
|
|
4854
|
+
case 98:
|
|
4855
|
+
return res("\b");
|
|
4853
4856
|
|
|
4854
|
-
|
|
4855
|
-
|
|
4857
|
+
case 118:
|
|
4858
|
+
return res("\u000b");
|
|
4856
4859
|
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
++pos;
|
|
4860
|
-
}
|
|
4860
|
+
case 102:
|
|
4861
|
+
return res("\f");
|
|
4861
4862
|
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4863
|
+
case 13:
|
|
4864
|
+
if (input.charCodeAt(pos) === 10) {
|
|
4865
|
+
++pos;
|
|
4866
|
+
}
|
|
4865
4867
|
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4868
|
+
case 10:
|
|
4869
|
+
lineStart = pos;
|
|
4870
|
+
++curLine;
|
|
4869
4871
|
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
return res(null);
|
|
4874
|
-
} else {
|
|
4875
|
-
errors.strictNumericEscape(pos - 1, lineStart, curLine);
|
|
4876
|
-
}
|
|
4872
|
+
case 8232:
|
|
4873
|
+
case 8233:
|
|
4874
|
+
return res("");
|
|
4877
4875
|
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4876
|
+
case 56:
|
|
4877
|
+
case 57:
|
|
4878
|
+
if (inTemplate) {
|
|
4879
|
+
return res(null);
|
|
4880
|
+
} else {
|
|
4881
|
+
errors.strictNumericEscape(pos - 1, lineStart, curLine);
|
|
4882
|
+
}
|
|
4884
4883
|
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4884
|
+
default:
|
|
4885
|
+
if (ch >= 48 && ch <= 55) {
|
|
4886
|
+
const startPos = pos - 1;
|
|
4887
|
+
const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
|
|
4888
|
+
let octalStr = match[0];
|
|
4889
|
+
let octal = parseInt(octalStr, 8);
|
|
4890
|
+
|
|
4891
|
+
if (octal > 255) {
|
|
4892
|
+
octalStr = octalStr.slice(0, -1);
|
|
4893
|
+
octal = parseInt(octalStr, 8);
|
|
4894
|
+
}
|
|
4889
4895
|
|
|
4890
|
-
|
|
4891
|
-
|
|
4896
|
+
pos += octalStr.length - 1;
|
|
4897
|
+
const next = input.charCodeAt(pos);
|
|
4892
4898
|
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4899
|
+
if (octalStr !== "0" || next === 56 || next === 57) {
|
|
4900
|
+
if (inTemplate) {
|
|
4901
|
+
return res(null);
|
|
4902
|
+
} else {
|
|
4903
|
+
errors.strictNumericEscape(startPos, lineStart, curLine);
|
|
4904
|
+
}
|
|
4905
|
+
}
|
|
4900
4906
|
|
|
4901
|
-
|
|
4902
|
-
|
|
4907
|
+
return res(String.fromCharCode(octal));
|
|
4908
|
+
}
|
|
4903
4909
|
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
}
|
|
4910
|
+
return res(String.fromCharCode(ch));
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4907
4913
|
|
|
4908
|
-
function readHexChar
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4914
|
+
function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
4915
|
+
const initialPos = pos;
|
|
4916
|
+
let n;
|
|
4917
|
+
({
|
|
4918
|
+
n,
|
|
4919
|
+
pos
|
|
4920
|
+
} = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
4915
4921
|
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4922
|
+
if (n === null) {
|
|
4923
|
+
if (throwOnInvalid) {
|
|
4924
|
+
errors.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
4925
|
+
} else {
|
|
4926
|
+
pos = initialPos - 1;
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4923
4929
|
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
}
|
|
4930
|
+
return {
|
|
4931
|
+
code: n,
|
|
4932
|
+
pos
|
|
4933
|
+
};
|
|
4934
|
+
}
|
|
4929
4935
|
|
|
4930
|
-
function readInt
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
+
function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
4937
|
+
const start = pos;
|
|
4938
|
+
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
|
|
4939
|
+
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
|
|
4940
|
+
let invalid = false;
|
|
4941
|
+
let total = 0;
|
|
4936
4942
|
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4943
|
+
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
4944
|
+
const code = input.charCodeAt(pos);
|
|
4945
|
+
let val;
|
|
4940
4946
|
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4947
|
+
if (code === 95 && allowNumSeparator !== "bail") {
|
|
4948
|
+
const prev = input.charCodeAt(pos - 1);
|
|
4949
|
+
const next = input.charCodeAt(pos + 1);
|
|
4944
4950
|
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4951
|
+
if (!allowNumSeparator) {
|
|
4952
|
+
if (bailOnError) return {
|
|
4953
|
+
n: null,
|
|
4954
|
+
pos
|
|
4955
|
+
};
|
|
4956
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
4957
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
|
|
4958
|
+
if (bailOnError) return {
|
|
4959
|
+
n: null,
|
|
4960
|
+
pos
|
|
4961
|
+
};
|
|
4962
|
+
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
4963
|
+
}
|
|
4958
4964
|
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4965
|
+
++pos;
|
|
4966
|
+
continue;
|
|
4967
|
+
}
|
|
4962
4968
|
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4969
|
+
if (code >= 97) {
|
|
4970
|
+
val = code - 97 + 10;
|
|
4971
|
+
} else if (code >= 65) {
|
|
4972
|
+
val = code - 65 + 10;
|
|
4973
|
+
} else if (_isDigit(code)) {
|
|
4974
|
+
val = code - 48;
|
|
4975
|
+
} else {
|
|
4976
|
+
val = Infinity;
|
|
4977
|
+
}
|
|
4972
4978
|
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4979
|
+
if (val >= radix) {
|
|
4980
|
+
if (val <= 9 && bailOnError) {
|
|
4981
|
+
return {
|
|
4982
|
+
n: null,
|
|
4983
|
+
pos
|
|
4984
|
+
};
|
|
4985
|
+
} else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
|
|
4986
|
+
val = 0;
|
|
4987
|
+
} else if (forceLen) {
|
|
4988
|
+
val = 0;
|
|
4989
|
+
invalid = true;
|
|
4990
|
+
} else {
|
|
4991
|
+
break;
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
4988
4994
|
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4995
|
+
++pos;
|
|
4996
|
+
total = total * radix + val;
|
|
4997
|
+
}
|
|
4992
4998
|
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
+
if (pos === start || len != null && pos - start !== len || invalid) {
|
|
5000
|
+
return {
|
|
5001
|
+
n: null,
|
|
5002
|
+
pos
|
|
5003
|
+
};
|
|
5004
|
+
}
|
|
4999
5005
|
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
}
|
|
5006
|
+
return {
|
|
5007
|
+
n: total,
|
|
5008
|
+
pos
|
|
5009
|
+
};
|
|
5010
|
+
}
|
|
5005
5011
|
|
|
5006
|
-
function readCodePoint
|
|
5007
|
-
|
|
5008
|
-
|
|
5012
|
+
function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
5013
|
+
const ch = input.charCodeAt(pos);
|
|
5014
|
+
let code;
|
|
5009
5015
|
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5016
|
+
if (ch === 123) {
|
|
5017
|
+
++pos;
|
|
5018
|
+
({
|
|
5019
|
+
code,
|
|
5020
|
+
pos
|
|
5021
|
+
} = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
5022
|
+
++pos;
|
|
5023
|
+
|
|
5024
|
+
if (code !== null && code > 0x10ffff) {
|
|
5025
|
+
if (throwOnInvalid) {
|
|
5026
|
+
errors.invalidCodePoint(pos, lineStart, curLine);
|
|
5027
|
+
} else {
|
|
5028
|
+
return {
|
|
5029
|
+
code: null,
|
|
5030
|
+
pos
|
|
5031
|
+
};
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
} else {
|
|
5035
|
+
({
|
|
5036
|
+
code,
|
|
5037
|
+
pos
|
|
5038
|
+
} = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
5039
|
+
}
|
|
5017
5040
|
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
code: null,
|
|
5024
|
-
pos
|
|
5025
|
-
};
|
|
5026
|
-
}
|
|
5027
|
-
}
|
|
5028
|
-
} else {
|
|
5029
|
-
({
|
|
5030
|
-
code,
|
|
5031
|
-
pos
|
|
5032
|
-
} = readHexChar$1(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
5033
|
-
}
|
|
5041
|
+
return {
|
|
5042
|
+
code,
|
|
5043
|
+
pos
|
|
5044
|
+
};
|
|
5045
|
+
}
|
|
5034
5046
|
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
pos
|
|
5038
|
-
};
|
|
5047
|
+
|
|
5048
|
+
return lib$i;
|
|
5039
5049
|
}
|
|
5040
5050
|
|
|
5041
5051
|
var constants = {};
|
|
@@ -5389,7 +5399,7 @@ function requireCore$2 () {
|
|
|
5389
5399
|
var _is = requireIs$1();
|
|
5390
5400
|
var _isValidIdentifier = isValidIdentifier$1;
|
|
5391
5401
|
var _helperValidatorIdentifier = lib$j;
|
|
5392
|
-
var _helperStringParser =
|
|
5402
|
+
var _helperStringParser = requireLib$b();
|
|
5393
5403
|
var _constants = constants;
|
|
5394
5404
|
var _utils = requireUtils$2();
|
|
5395
5405
|
const defineType = (0, _utils.defineAliasedType)("Standardized");
|