functionalscript 0.32.4 → 0.34.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/README.md +1 -1
- package/fs/asserts/module.f.d.ts +1 -1
- package/fs/asserts/module.f.js +4 -1
- package/fs/bnf/data/module.f.d.ts +0 -103
- package/fs/bnf/data/module.f.js +10 -246
- package/fs/bnf/data/proof.f.d.ts +0 -7
- package/fs/bnf/data/proof.f.js +3 -636
- package/fs/bnf/descent/module.f.d.ts +56 -0
- package/fs/bnf/descent/module.f.js +119 -0
- package/fs/bnf/descent/proof.f.d.ts +5 -0
- package/fs/bnf/descent/proof.f.js +296 -0
- package/fs/bnf/ll1/module.f.d.ts +72 -0
- package/fs/bnf/ll1/module.f.js +153 -0
- package/fs/bnf/ll1/proof.f.d.ts +9 -0
- package/fs/bnf/ll1/proof.f.js +358 -0
- package/fs/cas/cli/module.f.d.ts +6 -0
- package/fs/cas/cli/module.f.js +56 -0
- package/fs/cas/cli/proof.f.d.ts +14 -0
- package/fs/cas/cli/proof.f.js +149 -0
- package/fs/cas/mcp/module.f.d.ts +9 -17
- package/fs/cas/mcp/module.f.js +117 -83
- package/fs/cas/mcp/proof.f.d.ts +5 -1
- package/fs/cas/mcp/proof.f.js +79 -32
- package/fs/cas/module.f.d.ts +33 -27
- package/fs/cas/module.f.js +151 -126
- package/fs/cas/proof.f.d.ts +16 -13
- package/fs/cas/proof.f.js +255 -130
- package/fs/ci/config/module.f.d.ts +15 -15
- package/fs/ci/config/module.f.js +15 -15
- package/fs/ci/proof.f.js +8 -6
- package/fs/cli/proof.f.js +2 -12
- package/fs/djs/parser/module.f.d.ts +0 -5
- package/fs/djs/proof.f.js +5 -6
- package/fs/djs/serializer/module.f.d.ts +1 -3
- package/fs/djs/tokenizer-new/module.f.js +3 -2
- package/fs/djs/tokenizer-new/proof.f.d.ts +3 -0
- package/fs/djs/tokenizer-new/proof.f.js +458 -296
- package/fs/djs/transpiler/proof.f.js +10 -10
- package/fs/effects/list/module.f.d.ts +31 -0
- package/fs/effects/list/module.f.js +16 -0
- package/fs/effects/module.f.d.ts +11 -5
- package/fs/effects/module.f.js +16 -6
- package/fs/effects/node/module.f.d.ts +29 -3
- package/fs/effects/node/module.f.js +35 -1
- package/fs/effects/node/module.js +32 -18
- package/fs/effects/node/proof.f.js +36 -36
- package/fs/effects/node/virtual/module.f.d.ts +16 -2
- package/fs/effects/node/virtual/module.f.js +129 -20
- package/fs/effects/node/virtual/proof.f.d.ts +4 -0
- package/fs/effects/node/virtual/proof.f.js +47 -14
- package/fs/effects/proof.f.d.ts +4 -0
- package/fs/effects/proof.f.js +18 -1
- package/fs/emergent_testing/proof.f.js +3 -11
- package/fs/fjs/module.f.js +2 -8
- package/fs/fjs/proof.f.js +2 -11
- package/fs/html/module.f.js +6 -8
- package/fs/js/tokenizer/module.f.d.ts +5 -0
- package/fs/js/tokenizer/module.f.js +13 -0
- package/fs/json/serializer/module.f.js +0 -1
- package/fs/mcp/module.f.d.ts +1 -1
- package/fs/mime/module.f.d.ts +101 -5
- package/fs/mime/module.f.js +159 -6
- package/fs/mime/proof.f.d.ts +25 -0
- package/fs/mime/proof.f.js +193 -3
- package/fs/text/code_point/module.f.d.ts +39 -2
- package/fs/text/code_point/module.f.js +74 -2
- package/fs/text/code_point/proof.f.d.ts +8 -0
- package/fs/text/code_point/proof.f.js +72 -0
- package/fs/text/sgr/proof.f.js +2 -11
- package/fs/text/utf16/module.f.js +4 -26
- package/fs/text/utf8/module.f.d.ts +27 -0
- package/fs/text/utf8/module.f.js +8 -14
- package/fs/types/bigint/module.f.d.ts +8 -15
- package/fs/types/bigint/module.f.js +9 -22
- package/fs/types/bigint/proof.f.d.ts +0 -2
- package/fs/types/bigint/proof.f.js +6 -16
- package/fs/types/function/operator/module.f.d.ts +26 -0
- package/fs/types/list/module.f.d.ts +3 -0
- package/fs/types/result/module.d.ts +2 -4
- package/fs/types/result/module.js +9 -3
- package/package.json +3 -3
- package/issues/demo/data/data.f.js +0 -12
- package/issues/demo/data/shared.f.js +0 -3
- package/issues/demo/fs/app.js +0 -4
- package/issues/demo/fs/math.f.js +0 -4
- package/issues/demo/sample/proof.f.js +0 -13
- /package/{issues → todo}/031-json.f.d.ts +0 -0
- /package/{issues → todo}/031-json.f.js +0 -0
- /package/{issues → todo}/proof.f.d.ts +0 -0
- /package/{issues → todo}/proof.f.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { descentParser } from "../../bnf/
|
|
1
|
+
import { descentParser } from "../../bnf/descent/module.f.js";
|
|
2
2
|
import { backspace, ht, lf, ff, cr, quotationMark, solidus, reverseSolidus, digitRange, digit0, latinCapitalLetterA, latinSmallLetterA, latinSmallLetterB, latinSmallLetterF, latinSmallLetterN, latinSmallLetterR, latinSmallLetterT, latinSmallLetterU, range, } from "../../text/ascii/module.f.js";
|
|
3
3
|
import { stringToCodePointList } from "../../text/utf16/module.f.js";
|
|
4
4
|
import { contains } from "../../types/range/module.f.js";
|
|
@@ -38,6 +38,8 @@ const scanFunc = (input, state) => {
|
|
|
38
38
|
return [null, state];
|
|
39
39
|
if (isNlTag(input) && isWsTag(state[0]))
|
|
40
40
|
return [null, [input, []]];
|
|
41
|
+
if (isWsTag(input) && isNlTag(state[0]))
|
|
42
|
+
return [null, state];
|
|
41
43
|
const newState = [input, []];
|
|
42
44
|
if (state[0] === '') {
|
|
43
45
|
return [null, newState];
|
|
@@ -53,7 +55,7 @@ const operatorTags = new Set([
|
|
|
53
55
|
'>>>=', '>>>', '>>=', '>>', '>=', '>',
|
|
54
56
|
'<<<=', '<<<', '<<=', '<<', '<=', '<',
|
|
55
57
|
'+=', '++', '+', '-=', '--', '-',
|
|
56
|
-
'**=', '**', '*=', '*', '/=', '%=', '%',
|
|
58
|
+
'**=', '**', '*=', '*', '/=', '/', '%=', '%', // TODO: '/' here causes multi-char line comments (e.g. //ab\n) to fall through as two '/' operator tokens because the oneline rule only consumes one non-newline character (option vs repeat0Plus). Fix the comment rule to use repeat0Plus, or make filterFunc distinguish operator-branch '/' from slash characters inside comments.
|
|
57
59
|
'&&=', '&&', '&=', '&', '||=', '||', '|=', '|',
|
|
58
60
|
'^=', '^', '~', '??=', '??', '?.', '?',
|
|
59
61
|
'[', ']', '{', '}', '(', ')', ',', ':'
|
|
@@ -64,6 +66,7 @@ const filterFunc = tk => {
|
|
|
64
66
|
switch (tk) {
|
|
65
67
|
case 'number':
|
|
66
68
|
case 'string':
|
|
69
|
+
case 'id':
|
|
67
70
|
case '\n':
|
|
68
71
|
case '\r':
|
|
69
72
|
case ' ':
|
|
@@ -102,6 +105,15 @@ const stringDecodeScan = (cp, state) => {
|
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
107
|
const decodeJsonString = codePoints => String.fromCodePoint(...toArray(flat(stateScan(stringDecodeScan)({ kind: 'normal' })(codePoints.slice(1, -1)))));
|
|
108
|
+
const keywords = new Set([
|
|
109
|
+
'true', 'false', 'null', 'undefined',
|
|
110
|
+
'arguments', 'await', 'break', 'case', 'catch', 'class', 'const', 'continue',
|
|
111
|
+
'debugger', 'default', 'delete', 'do', 'else', 'enum', 'eval', 'export',
|
|
112
|
+
'extends', 'finally', 'for', 'function', 'if', 'implements', 'import', 'in',
|
|
113
|
+
'instanceof', 'interface', 'let', 'new', 'package', 'private', 'protected',
|
|
114
|
+
'public', 'return', 'static', 'super', 'switch', 'this', 'throw', 'try',
|
|
115
|
+
'typeof', 'var', 'void', 'while', 'with', 'yield',
|
|
116
|
+
]);
|
|
105
117
|
const toJsToken = tk => {
|
|
106
118
|
switch (tk[0]) {
|
|
107
119
|
case '\n':
|
|
@@ -112,6 +124,12 @@ const toJsToken = tk => {
|
|
|
112
124
|
return { kind: 'ws' };
|
|
113
125
|
case 'string':
|
|
114
126
|
return { kind: 'string', value: decodeJsonString(tk[1]) };
|
|
127
|
+
case 'id': {
|
|
128
|
+
const value = String.fromCodePoint(...tk[1]);
|
|
129
|
+
if (keywords.has(value))
|
|
130
|
+
return { kind: value };
|
|
131
|
+
return { kind: 'id', value };
|
|
132
|
+
}
|
|
115
133
|
default:
|
|
116
134
|
return { kind: tk[0] };
|
|
117
135
|
}
|
|
@@ -600,14 +618,18 @@ export const proof = {
|
|
|
600
618
|
// const result = tokenizeString('0e-')
|
|
601
619
|
// if (result !== 'error') { throw result }
|
|
602
620
|
// },
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
621
|
+
() => {
|
|
622
|
+
const result = tokenizeString('ABCdef1234567890$_');
|
|
623
|
+
if (result !== '[{"kind":"id","value":"ABCdef1234567890$_"},{"kind":"eof"}]') {
|
|
624
|
+
throw result;
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
() => {
|
|
628
|
+
const result = tokenizeString('{ABCdef1234567890$_}');
|
|
629
|
+
if (result !== '[{"kind":"{"},{"kind":"id","value":"ABCdef1234567890$_"},{"kind":"}"},{"kind":"eof"}]') {
|
|
630
|
+
throw result;
|
|
631
|
+
}
|
|
632
|
+
},
|
|
611
633
|
// () => {
|
|
612
634
|
// const result = tokenizeString('123 _123')
|
|
613
635
|
// if (result !== '[{"bf":[123n,0],"kind":"number","value":"123"},{"kind":"ws"},{"kind":"id","value":"_123"},{"kind":"eof"}]') { throw result }
|
|
@@ -660,297 +682,437 @@ export const proof = {
|
|
|
660
682
|
throw result;
|
|
661
683
|
}
|
|
662
684
|
},
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
685
|
+
() => {
|
|
686
|
+
const result = tokenizeString('=a');
|
|
687
|
+
if (result !== '[{"kind":"="},{"kind":"id","value":"a"},{"kind":"eof"}]') {
|
|
688
|
+
throw result;
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
() => {
|
|
692
|
+
const result = tokenizeString('-');
|
|
693
|
+
if (result !== '[{"kind":"-"},{"kind":"eof"}]') {
|
|
694
|
+
throw result;
|
|
695
|
+
}
|
|
696
|
+
},
|
|
671
697
|
// () => {
|
|
672
698
|
// const result = tokenizeString('1*2')
|
|
673
699
|
// if (result !== '[{"bf":[1n,0],"kind":"number","value":"1"},{"kind":"*"},{"bf":[2n,0],"kind":"number","value":"2"},{"kind":"eof"}]') { throw result }
|
|
674
700
|
// },
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
701
|
+
() => {
|
|
702
|
+
const result = tokenizeString('( )');
|
|
703
|
+
if (result !== '[{"kind":"("},{"kind":"ws"},{"kind":")"},{"kind":"eof"}]') {
|
|
704
|
+
throw result;
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
() => {
|
|
708
|
+
const result = tokenizeString('== != === !== > >= < <=');
|
|
709
|
+
if (result !== '[{"kind":"=="},{"kind":"ws"},{"kind":"!="},{"kind":"ws"},{"kind":"==="},{"kind":"ws"},{"kind":"!=="},{"kind":"ws"},{"kind":">"},{"kind":"ws"},{"kind":">="},{"kind":"ws"},{"kind":"<"},{"kind":"ws"},{"kind":"<="},{"kind":"eof"}]') {
|
|
710
|
+
throw result;
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
() => {
|
|
714
|
+
const result = tokenizeString('+ - * / % ++ -- **');
|
|
715
|
+
if (result !== '[{"kind":"+"},{"kind":"ws"},{"kind":"-"},{"kind":"ws"},{"kind":"*"},{"kind":"ws"},{"kind":"/"},{"kind":"ws"},{"kind":"%"},{"kind":"ws"},{"kind":"++"},{"kind":"ws"},{"kind":"--"},{"kind":"ws"},{"kind":"**"},{"kind":"eof"}]') {
|
|
716
|
+
throw result;
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
() => {
|
|
720
|
+
const result = tokenizeString('= += -= *= /= %= **=');
|
|
721
|
+
if (result !== '[{"kind":"="},{"kind":"ws"},{"kind":"+="},{"kind":"ws"},{"kind":"-="},{"kind":"ws"},{"kind":"*="},{"kind":"ws"},{"kind":"/="},{"kind":"ws"},{"kind":"%="},{"kind":"ws"},{"kind":"**="},{"kind":"eof"}]') {
|
|
722
|
+
throw result;
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
() => {
|
|
726
|
+
const result = tokenizeString('& | ^ ~ << >> >>>');
|
|
727
|
+
if (result !== '[{"kind":"&"},{"kind":"ws"},{"kind":"|"},{"kind":"ws"},{"kind":"^"},{"kind":"ws"},{"kind":"~"},{"kind":"ws"},{"kind":"<<"},{"kind":"ws"},{"kind":">>"},{"kind":"ws"},{"kind":">>>"},{"kind":"eof"}]') {
|
|
728
|
+
throw result;
|
|
729
|
+
}
|
|
730
|
+
},
|
|
731
|
+
() => {
|
|
732
|
+
const result = tokenizeString('&= |= ^= <<= >>= >>>=');
|
|
733
|
+
if (result !== '[{"kind":"&="},{"kind":"ws"},{"kind":"|="},{"kind":"ws"},{"kind":"^="},{"kind":"ws"},{"kind":"<<="},{"kind":"ws"},{"kind":">>="},{"kind":"ws"},{"kind":">>>="},{"kind":"eof"}]') {
|
|
734
|
+
throw result;
|
|
735
|
+
}
|
|
736
|
+
},
|
|
737
|
+
() => {
|
|
738
|
+
const result = tokenizeString('&& || ! ??');
|
|
739
|
+
if (result !== '[{"kind":"&&"},{"kind":"ws"},{"kind":"||"},{"kind":"ws"},{"kind":"!"},{"kind":"ws"},{"kind":"??"},{"kind":"eof"}]') {
|
|
740
|
+
throw result;
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
() => {
|
|
744
|
+
const result = tokenizeString('&&= ||= ??=');
|
|
745
|
+
if (result !== '[{"kind":"&&="},{"kind":"ws"},{"kind":"||="},{"kind":"ws"},{"kind":"??="},{"kind":"eof"}]') {
|
|
746
|
+
throw result;
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
() => {
|
|
750
|
+
const result = tokenizeString('? ?. . =>');
|
|
751
|
+
if (result !== '[{"kind":"?"},{"kind":"ws"},{"kind":"?."},{"kind":"ws"},{"kind":"."},{"kind":"ws"},{"kind":"=>"},{"kind":"eof"}]') {
|
|
752
|
+
throw result;
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
],
|
|
756
|
+
ws: [
|
|
757
|
+
() => {
|
|
758
|
+
const result = tokenizeString(' ');
|
|
759
|
+
if (result !== '[{"kind":"ws"},{"kind":"eof"}]') {
|
|
760
|
+
throw result;
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
() => {
|
|
764
|
+
const result = tokenizeString('\t');
|
|
765
|
+
if (result !== '[{"kind":"ws"},{"kind":"eof"}]') {
|
|
766
|
+
throw result;
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
() => {
|
|
770
|
+
const result = tokenizeString(' \t');
|
|
771
|
+
if (result !== '[{"kind":"ws"},{"kind":"eof"}]') {
|
|
772
|
+
throw result;
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
() => {
|
|
776
|
+
const result = tokenizeString('\n');
|
|
777
|
+
if (result !== '[{"kind":"nl"},{"kind":"eof"}]') {
|
|
778
|
+
throw result;
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
() => {
|
|
782
|
+
const result = tokenizeString('\r');
|
|
783
|
+
if (result !== '[{"kind":"nl"},{"kind":"eof"}]') {
|
|
784
|
+
throw result;
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
() => {
|
|
788
|
+
const result = tokenizeString(' \t\n\r ');
|
|
789
|
+
if (result !== '[{"kind":"nl"},{"kind":"eof"}]') {
|
|
790
|
+
throw result;
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
],
|
|
794
|
+
id: [
|
|
795
|
+
() => {
|
|
796
|
+
const result = tokenizeString('err');
|
|
797
|
+
if (result !== '[{"kind":"id","value":"err"},{"kind":"eof"}]') {
|
|
798
|
+
throw result;
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
() => {
|
|
802
|
+
const result = tokenizeString('{e}');
|
|
803
|
+
if (result !== '[{"kind":"{"},{"kind":"id","value":"e"},{"kind":"}"},{"kind":"eof"}]') {
|
|
804
|
+
throw result;
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
() => {
|
|
808
|
+
const result = tokenizeString('tru');
|
|
809
|
+
if (result !== '[{"kind":"id","value":"tru"},{"kind":"eof"}]') {
|
|
810
|
+
throw result;
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
],
|
|
814
|
+
keywords: [
|
|
815
|
+
() => {
|
|
816
|
+
const result = tokenizeString('true');
|
|
817
|
+
if (result !== '[{"kind":"true"},{"kind":"eof"}]') {
|
|
818
|
+
throw result;
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
() => {
|
|
822
|
+
const result = tokenizeString('false');
|
|
823
|
+
if (result !== '[{"kind":"false"},{"kind":"eof"}]') {
|
|
824
|
+
throw result;
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
() => {
|
|
828
|
+
const result = tokenizeString('null');
|
|
829
|
+
if (result !== '[{"kind":"null"},{"kind":"eof"}]') {
|
|
830
|
+
throw result;
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
() => {
|
|
834
|
+
const result = tokenizeString('undefined');
|
|
835
|
+
if (result !== '[{"kind":"undefined"},{"kind":"eof"}]') {
|
|
836
|
+
throw result;
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
() => {
|
|
840
|
+
const result = tokenizeString('[null]');
|
|
841
|
+
if (result !== '[{"kind":"["},{"kind":"null"},{"kind":"]"},{"kind":"eof"}]') {
|
|
842
|
+
throw result;
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
() => {
|
|
846
|
+
const result = tokenizeString('arguments');
|
|
847
|
+
if (result !== '[{"kind":"arguments"},{"kind":"eof"}]') {
|
|
848
|
+
throw result;
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
() => {
|
|
852
|
+
const result = tokenizeString('await');
|
|
853
|
+
if (result !== '[{"kind":"await"},{"kind":"eof"}]') {
|
|
854
|
+
throw result;
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
() => {
|
|
858
|
+
const result = tokenizeString('break');
|
|
859
|
+
if (result !== '[{"kind":"break"},{"kind":"eof"}]') {
|
|
860
|
+
throw result;
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
() => {
|
|
864
|
+
const result = tokenizeString('case');
|
|
865
|
+
if (result !== '[{"kind":"case"},{"kind":"eof"}]') {
|
|
866
|
+
throw result;
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
() => {
|
|
870
|
+
const result = tokenizeString('catch');
|
|
871
|
+
if (result !== '[{"kind":"catch"},{"kind":"eof"}]') {
|
|
872
|
+
throw result;
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
() => {
|
|
876
|
+
const result = tokenizeString('class');
|
|
877
|
+
if (result !== '[{"kind":"class"},{"kind":"eof"}]') {
|
|
878
|
+
throw result;
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
() => {
|
|
882
|
+
const result = tokenizeString('const');
|
|
883
|
+
if (result !== '[{"kind":"const"},{"kind":"eof"}]') {
|
|
884
|
+
throw result;
|
|
885
|
+
}
|
|
886
|
+
},
|
|
887
|
+
() => {
|
|
888
|
+
const result = tokenizeString('continue');
|
|
889
|
+
if (result !== '[{"kind":"continue"},{"kind":"eof"}]') {
|
|
890
|
+
throw result;
|
|
891
|
+
}
|
|
892
|
+
},
|
|
893
|
+
() => {
|
|
894
|
+
const result = tokenizeString('debugger');
|
|
895
|
+
if (result !== '[{"kind":"debugger"},{"kind":"eof"}]') {
|
|
896
|
+
throw result;
|
|
897
|
+
}
|
|
898
|
+
},
|
|
899
|
+
() => {
|
|
900
|
+
const result = tokenizeString('default');
|
|
901
|
+
if (result !== '[{"kind":"default"},{"kind":"eof"}]') {
|
|
902
|
+
throw result;
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
() => {
|
|
906
|
+
const result = tokenizeString('delete');
|
|
907
|
+
if (result !== '[{"kind":"delete"},{"kind":"eof"}]') {
|
|
908
|
+
throw result;
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
() => {
|
|
912
|
+
const result = tokenizeString('do');
|
|
913
|
+
if (result !== '[{"kind":"do"},{"kind":"eof"}]') {
|
|
914
|
+
throw result;
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
() => {
|
|
918
|
+
const result = tokenizeString('else');
|
|
919
|
+
if (result !== '[{"kind":"else"},{"kind":"eof"}]') {
|
|
920
|
+
throw result;
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
() => {
|
|
924
|
+
const result = tokenizeString('enum');
|
|
925
|
+
if (result !== '[{"kind":"enum"},{"kind":"eof"}]') {
|
|
926
|
+
throw result;
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
() => {
|
|
930
|
+
const result = tokenizeString('eval');
|
|
931
|
+
if (result !== '[{"kind":"eval"},{"kind":"eof"}]') {
|
|
932
|
+
throw result;
|
|
933
|
+
}
|
|
934
|
+
},
|
|
935
|
+
() => {
|
|
936
|
+
const result = tokenizeString('export');
|
|
937
|
+
if (result !== '[{"kind":"export"},{"kind":"eof"}]') {
|
|
938
|
+
throw result;
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
() => {
|
|
942
|
+
const result = tokenizeString('extends');
|
|
943
|
+
if (result !== '[{"kind":"extends"},{"kind":"eof"}]') {
|
|
944
|
+
throw result;
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
() => {
|
|
948
|
+
const result = tokenizeString('finally');
|
|
949
|
+
if (result !== '[{"kind":"finally"},{"kind":"eof"}]') {
|
|
950
|
+
throw result;
|
|
951
|
+
}
|
|
952
|
+
},
|
|
953
|
+
() => {
|
|
954
|
+
const result = tokenizeString('for');
|
|
955
|
+
if (result !== '[{"kind":"for"},{"kind":"eof"}]') {
|
|
956
|
+
throw result;
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
() => {
|
|
960
|
+
const result = tokenizeString('function');
|
|
961
|
+
if (result !== '[{"kind":"function"},{"kind":"eof"}]') {
|
|
962
|
+
throw result;
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
() => {
|
|
966
|
+
const result = tokenizeString('if');
|
|
967
|
+
if (result !== '[{"kind":"if"},{"kind":"eof"}]') {
|
|
968
|
+
throw result;
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
() => {
|
|
972
|
+
const result = tokenizeString('implements');
|
|
973
|
+
if (result !== '[{"kind":"implements"},{"kind":"eof"}]') {
|
|
974
|
+
throw result;
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
() => {
|
|
978
|
+
const result = tokenizeString('import');
|
|
979
|
+
if (result !== '[{"kind":"import"},{"kind":"eof"}]') {
|
|
980
|
+
throw result;
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
() => {
|
|
984
|
+
const result = tokenizeString('in');
|
|
985
|
+
if (result !== '[{"kind":"in"},{"kind":"eof"}]') {
|
|
986
|
+
throw result;
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
() => {
|
|
990
|
+
const result = tokenizeString('instanceof');
|
|
991
|
+
if (result !== '[{"kind":"instanceof"},{"kind":"eof"}]') {
|
|
992
|
+
throw result;
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
() => {
|
|
996
|
+
const result = tokenizeString('interface');
|
|
997
|
+
if (result !== '[{"kind":"interface"},{"kind":"eof"}]') {
|
|
998
|
+
throw result;
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
() => {
|
|
1002
|
+
const result = tokenizeString('let');
|
|
1003
|
+
if (result !== '[{"kind":"let"},{"kind":"eof"}]') {
|
|
1004
|
+
throw result;
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
() => {
|
|
1008
|
+
const result = tokenizeString('new');
|
|
1009
|
+
if (result !== '[{"kind":"new"},{"kind":"eof"}]') {
|
|
1010
|
+
throw result;
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
() => {
|
|
1014
|
+
const result = tokenizeString('package');
|
|
1015
|
+
if (result !== '[{"kind":"package"},{"kind":"eof"}]') {
|
|
1016
|
+
throw result;
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
() => {
|
|
1020
|
+
const result = tokenizeString('private');
|
|
1021
|
+
if (result !== '[{"kind":"private"},{"kind":"eof"}]') {
|
|
1022
|
+
throw result;
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
() => {
|
|
1026
|
+
const result = tokenizeString('protected');
|
|
1027
|
+
if (result !== '[{"kind":"protected"},{"kind":"eof"}]') {
|
|
1028
|
+
throw result;
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
() => {
|
|
1032
|
+
const result = tokenizeString('public');
|
|
1033
|
+
if (result !== '[{"kind":"public"},{"kind":"eof"}]') {
|
|
1034
|
+
throw result;
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
() => {
|
|
1038
|
+
const result = tokenizeString('return');
|
|
1039
|
+
if (result !== '[{"kind":"return"},{"kind":"eof"}]') {
|
|
1040
|
+
throw result;
|
|
1041
|
+
}
|
|
1042
|
+
},
|
|
1043
|
+
() => {
|
|
1044
|
+
const result = tokenizeString('static');
|
|
1045
|
+
if (result !== '[{"kind":"static"},{"kind":"eof"}]') {
|
|
1046
|
+
throw result;
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
() => {
|
|
1050
|
+
const result = tokenizeString('super');
|
|
1051
|
+
if (result !== '[{"kind":"super"},{"kind":"eof"}]') {
|
|
1052
|
+
throw result;
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
() => {
|
|
1056
|
+
const result = tokenizeString('switch');
|
|
1057
|
+
if (result !== '[{"kind":"switch"},{"kind":"eof"}]') {
|
|
1058
|
+
throw result;
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
() => {
|
|
1062
|
+
const result = tokenizeString('this');
|
|
1063
|
+
if (result !== '[{"kind":"this"},{"kind":"eof"}]') {
|
|
1064
|
+
throw result;
|
|
1065
|
+
}
|
|
1066
|
+
},
|
|
1067
|
+
() => {
|
|
1068
|
+
const result = tokenizeString('throw');
|
|
1069
|
+
if (result !== '[{"kind":"throw"},{"kind":"eof"}]') {
|
|
1070
|
+
throw result;
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
() => {
|
|
1074
|
+
const result = tokenizeString('try');
|
|
1075
|
+
if (result !== '[{"kind":"try"},{"kind":"eof"}]') {
|
|
1076
|
+
throw result;
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
() => {
|
|
1080
|
+
const result = tokenizeString('typeof');
|
|
1081
|
+
if (result !== '[{"kind":"typeof"},{"kind":"eof"}]') {
|
|
1082
|
+
throw result;
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
() => {
|
|
1086
|
+
const result = tokenizeString('var');
|
|
1087
|
+
if (result !== '[{"kind":"var"},{"kind":"eof"}]') {
|
|
1088
|
+
throw result;
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
() => {
|
|
1092
|
+
const result = tokenizeString('void');
|
|
1093
|
+
if (result !== '[{"kind":"void"},{"kind":"eof"}]') {
|
|
1094
|
+
throw result;
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
() => {
|
|
1098
|
+
const result = tokenizeString('while');
|
|
1099
|
+
if (result !== '[{"kind":"while"},{"kind":"eof"}]') {
|
|
1100
|
+
throw result;
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
() => {
|
|
1104
|
+
const result = tokenizeString('with');
|
|
1105
|
+
if (result !== '[{"kind":"with"},{"kind":"eof"}]') {
|
|
1106
|
+
throw result;
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
() => {
|
|
1110
|
+
const result = tokenizeString('yield');
|
|
1111
|
+
if (result !== '[{"kind":"yield"},{"kind":"eof"}]') {
|
|
1112
|
+
throw result;
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
737
1115
|
],
|
|
738
|
-
// id: [
|
|
739
|
-
// () => {
|
|
740
|
-
// const result = tokenizeString('err')
|
|
741
|
-
// if (result !== '[{"kind":"id","value":"err"},{"kind":"eof"}]') { throw result }
|
|
742
|
-
// },
|
|
743
|
-
// () => {
|
|
744
|
-
// const result = tokenizeString('{e}')
|
|
745
|
-
// if (result !== '[{"kind":"{"},{"kind":"id","value":"e"},{"kind":"}"},{"kind":"eof"}]') { throw result }
|
|
746
|
-
// },
|
|
747
|
-
// () => {
|
|
748
|
-
// const result = tokenizeString('tru')
|
|
749
|
-
// if (result !== '[{"kind":"id","value":"tru"},{"kind":"eof"}]') { throw result }
|
|
750
|
-
// },
|
|
751
|
-
// ],
|
|
752
|
-
// keywords: [
|
|
753
|
-
// () => {
|
|
754
|
-
// const result = tokenizeString('true')
|
|
755
|
-
// if (result !== '[{"kind":"true"},{"kind":"eof"}]') { throw result }
|
|
756
|
-
// },
|
|
757
|
-
// () => {
|
|
758
|
-
// const result = tokenizeString('false')
|
|
759
|
-
// if (result !== '[{"kind":"false"},{"kind":"eof"}]') { throw result }
|
|
760
|
-
// },
|
|
761
|
-
// () => {
|
|
762
|
-
// const result = tokenizeString('null')
|
|
763
|
-
// if (result !== '[{"kind":"null"},{"kind":"eof"}]') { throw result }
|
|
764
|
-
// },
|
|
765
|
-
// () => {
|
|
766
|
-
// const result = tokenizeString('undefined')
|
|
767
|
-
// if (result !== '[{"kind":"undefined"},{"kind":"eof"}]') { throw result }
|
|
768
|
-
// },
|
|
769
|
-
// () => {
|
|
770
|
-
// const result = tokenizeString('[null]')
|
|
771
|
-
// if (result !== '[{"kind":"["},{"kind":"null"},{"kind":"]"},{"kind":"eof"}]') { throw result }
|
|
772
|
-
// },
|
|
773
|
-
// () => {
|
|
774
|
-
// const result = tokenizeString('arguments')
|
|
775
|
-
// if (result !== '[{"kind":"arguments"},{"kind":"eof"}]') { throw result }
|
|
776
|
-
// },
|
|
777
|
-
// () => {
|
|
778
|
-
// const result = tokenizeString('await')
|
|
779
|
-
// if (result !== '[{"kind":"await"},{"kind":"eof"}]') { throw result }
|
|
780
|
-
// },
|
|
781
|
-
// () => {
|
|
782
|
-
// const result = tokenizeString('break')
|
|
783
|
-
// if (result !== '[{"kind":"break"},{"kind":"eof"}]') { throw result }
|
|
784
|
-
// },
|
|
785
|
-
// () => {
|
|
786
|
-
// const result = tokenizeString('case')
|
|
787
|
-
// if (result !== '[{"kind":"case"},{"kind":"eof"}]') { throw result }
|
|
788
|
-
// },
|
|
789
|
-
// () => {
|
|
790
|
-
// const result = tokenizeString('catch')
|
|
791
|
-
// if (result !== '[{"kind":"catch"},{"kind":"eof"}]') { throw result }
|
|
792
|
-
// },
|
|
793
|
-
// () => {
|
|
794
|
-
// const result = tokenizeString('class')
|
|
795
|
-
// if (result !== '[{"kind":"class"},{"kind":"eof"}]') { throw result }
|
|
796
|
-
// },
|
|
797
|
-
// () => {
|
|
798
|
-
// const result = tokenizeString('const')
|
|
799
|
-
// if (result !== '[{"kind":"const"},{"kind":"eof"}]') { throw result }
|
|
800
|
-
// },
|
|
801
|
-
// () => {
|
|
802
|
-
// const result = tokenizeString('continue')
|
|
803
|
-
// if (result !== '[{"kind":"continue"},{"kind":"eof"}]') { throw result }
|
|
804
|
-
// },
|
|
805
|
-
// () => {
|
|
806
|
-
// const result = tokenizeString('debugger')
|
|
807
|
-
// if (result !== '[{"kind":"debugger"},{"kind":"eof"}]') { throw result }
|
|
808
|
-
// },
|
|
809
|
-
// () => {
|
|
810
|
-
// const result = tokenizeString('default')
|
|
811
|
-
// if (result !== '[{"kind":"default"},{"kind":"eof"}]') { throw result }
|
|
812
|
-
// },
|
|
813
|
-
// () => {
|
|
814
|
-
// const result = tokenizeString('delete')
|
|
815
|
-
// if (result !== '[{"kind":"delete"},{"kind":"eof"}]') { throw result }
|
|
816
|
-
// },
|
|
817
|
-
// () => {
|
|
818
|
-
// const result = tokenizeString('do')
|
|
819
|
-
// if (result !== '[{"kind":"do"},{"kind":"eof"}]') { throw result }
|
|
820
|
-
// },
|
|
821
|
-
// () => {
|
|
822
|
-
// const result = tokenizeString('else')
|
|
823
|
-
// if (result !== '[{"kind":"else"},{"kind":"eof"}]') { throw result }
|
|
824
|
-
// },
|
|
825
|
-
// () => {
|
|
826
|
-
// const result = tokenizeString('enum')
|
|
827
|
-
// if (result !== '[{"kind":"enum"},{"kind":"eof"}]') { throw result }
|
|
828
|
-
// },
|
|
829
|
-
// () => {
|
|
830
|
-
// const result = tokenizeString('eval')
|
|
831
|
-
// if (result !== '[{"kind":"eval"},{"kind":"eof"}]') { throw result }
|
|
832
|
-
// },
|
|
833
|
-
// () => {
|
|
834
|
-
// const result = tokenizeString('export')
|
|
835
|
-
// if (result !== '[{"kind":"export"},{"kind":"eof"}]') { throw result }
|
|
836
|
-
// },
|
|
837
|
-
// () => {
|
|
838
|
-
// const result = tokenizeString('extends')
|
|
839
|
-
// if (result !== '[{"kind":"extends"},{"kind":"eof"}]') { throw result }
|
|
840
|
-
// },
|
|
841
|
-
// () => {
|
|
842
|
-
// const result = tokenizeString('finally')
|
|
843
|
-
// if (result !== '[{"kind":"finally"},{"kind":"eof"}]') { throw result }
|
|
844
|
-
// },
|
|
845
|
-
// () => {
|
|
846
|
-
// const result = tokenizeString('for')
|
|
847
|
-
// if (result !== '[{"kind":"for"},{"kind":"eof"}]') { throw result }
|
|
848
|
-
// },
|
|
849
|
-
// () => {
|
|
850
|
-
// const result = tokenizeString('function')
|
|
851
|
-
// if (result !== '[{"kind":"function"},{"kind":"eof"}]') { throw result }
|
|
852
|
-
// },
|
|
853
|
-
// () => {
|
|
854
|
-
// const result = tokenizeString('if')
|
|
855
|
-
// if (result !== '[{"kind":"if"},{"kind":"eof"}]') { throw result }
|
|
856
|
-
// },
|
|
857
|
-
// () => {
|
|
858
|
-
// const result = tokenizeString('implements')
|
|
859
|
-
// if (result !== '[{"kind":"implements"},{"kind":"eof"}]') { throw result }
|
|
860
|
-
// },
|
|
861
|
-
// () => {
|
|
862
|
-
// const result = tokenizeString('import')
|
|
863
|
-
// if (result !== '[{"kind":"import"},{"kind":"eof"}]') { throw result }
|
|
864
|
-
// },
|
|
865
|
-
// () => {
|
|
866
|
-
// const result = tokenizeString('in')
|
|
867
|
-
// if (result !== '[{"kind":"in"},{"kind":"eof"}]') { throw result }
|
|
868
|
-
// },
|
|
869
|
-
// () => {
|
|
870
|
-
// const result = tokenizeString('instanceof')
|
|
871
|
-
// if (result !== '[{"kind":"instanceof"},{"kind":"eof"}]') { throw result }
|
|
872
|
-
// },
|
|
873
|
-
// () => {
|
|
874
|
-
// const result = tokenizeString('interface')
|
|
875
|
-
// if (result !== '[{"kind":"interface"},{"kind":"eof"}]') { throw result }
|
|
876
|
-
// },
|
|
877
|
-
// () => {
|
|
878
|
-
// const result = tokenizeString('let')
|
|
879
|
-
// if (result !== '[{"kind":"let"},{"kind":"eof"}]') { throw result }
|
|
880
|
-
// },
|
|
881
|
-
// () => {
|
|
882
|
-
// const result = tokenizeString('new')
|
|
883
|
-
// if (result !== '[{"kind":"new"},{"kind":"eof"}]') { throw result }
|
|
884
|
-
// },
|
|
885
|
-
// () => {
|
|
886
|
-
// const result = tokenizeString('package')
|
|
887
|
-
// if (result !== '[{"kind":"package"},{"kind":"eof"}]') { throw result }
|
|
888
|
-
// },
|
|
889
|
-
// () => {
|
|
890
|
-
// const result = tokenizeString('private')
|
|
891
|
-
// if (result !== '[{"kind":"private"},{"kind":"eof"}]') { throw result }
|
|
892
|
-
// },
|
|
893
|
-
// () => {
|
|
894
|
-
// const result = tokenizeString('protected')
|
|
895
|
-
// if (result !== '[{"kind":"protected"},{"kind":"eof"}]') { throw result }
|
|
896
|
-
// },
|
|
897
|
-
// () => {
|
|
898
|
-
// const result = tokenizeString('public')
|
|
899
|
-
// if (result !== '[{"kind":"public"},{"kind":"eof"}]') { throw result }
|
|
900
|
-
// },
|
|
901
|
-
// () => {
|
|
902
|
-
// const result = tokenizeString('return')
|
|
903
|
-
// if (result !== '[{"kind":"return"},{"kind":"eof"}]') { throw result }
|
|
904
|
-
// },
|
|
905
|
-
// () => {
|
|
906
|
-
// const result = tokenizeString('static')
|
|
907
|
-
// if (result !== '[{"kind":"static"},{"kind":"eof"}]') { throw result }
|
|
908
|
-
// },
|
|
909
|
-
// () => {
|
|
910
|
-
// const result = tokenizeString('super')
|
|
911
|
-
// if (result !== '[{"kind":"super"},{"kind":"eof"}]') { throw result }
|
|
912
|
-
// },
|
|
913
|
-
// () => {
|
|
914
|
-
// const result = tokenizeString('switch')
|
|
915
|
-
// if (result !== '[{"kind":"switch"},{"kind":"eof"}]') { throw result }
|
|
916
|
-
// },
|
|
917
|
-
// () => {
|
|
918
|
-
// const result = tokenizeString('this')
|
|
919
|
-
// if (result !== '[{"kind":"this"},{"kind":"eof"}]') { throw result }
|
|
920
|
-
// },
|
|
921
|
-
// () => {
|
|
922
|
-
// const result = tokenizeString('throw')
|
|
923
|
-
// if (result !== '[{"kind":"throw"},{"kind":"eof"}]') { throw result }
|
|
924
|
-
// },
|
|
925
|
-
// () => {
|
|
926
|
-
// const result = tokenizeString('try')
|
|
927
|
-
// if (result !== '[{"kind":"try"},{"kind":"eof"}]') { throw result }
|
|
928
|
-
// },
|
|
929
|
-
// () => {
|
|
930
|
-
// const result = tokenizeString('typeof')
|
|
931
|
-
// if (result !== '[{"kind":"typeof"},{"kind":"eof"}]') { throw result }
|
|
932
|
-
// },
|
|
933
|
-
// () => {
|
|
934
|
-
// const result = tokenizeString('var')
|
|
935
|
-
// if (result !== '[{"kind":"var"},{"kind":"eof"}]') { throw result }
|
|
936
|
-
// },
|
|
937
|
-
// () => {
|
|
938
|
-
// const result = tokenizeString('void')
|
|
939
|
-
// if (result !== '[{"kind":"void"},{"kind":"eof"}]') { throw result }
|
|
940
|
-
// },
|
|
941
|
-
// () => {
|
|
942
|
-
// const result = tokenizeString('while')
|
|
943
|
-
// if (result !== '[{"kind":"while"},{"kind":"eof"}]') { throw result }
|
|
944
|
-
// },
|
|
945
|
-
// () => {
|
|
946
|
-
// const result = tokenizeString('with')
|
|
947
|
-
// if (result !== '[{"kind":"with"},{"kind":"eof"}]') { throw result }
|
|
948
|
-
// },
|
|
949
|
-
// () => {
|
|
950
|
-
// const result = tokenizeString('yield')
|
|
951
|
-
// if (result !== '[{"kind":"yield"},{"kind":"eof"}]') { throw result }
|
|
952
|
-
// },
|
|
953
|
-
// ],
|
|
954
1116
|
throw: {
|
|
955
1117
|
parse: () => { parse(''); }
|
|
956
1118
|
},
|