text stringlengths 9 39.2M | dir stringlengths 26 295 | lang stringclasses 185
values | created_date timestamp[us] | updated_date timestamp[us] | repo_name stringlengths 1 97 | repo_full_name stringlengths 7 106 | star int64 1k 183k | len_tokens int64 1 13.8M |
|---|---|---|---|---|---|---|---|---|
```html
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Esprima: Compatibility Tests</title>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="../assets/style.css">
<link rel="stylesheet" href="../assets/foundation/foundation.min.css">
</head>
<body>
<!-- Navigation bar -->
<div class="row">
<div class="twelve columns">
<nav class="top-bar">
<ul>
<li class="name">
<h1><a href="../index.html">Esprima</a></h1>
</li>
</ul>
<section>
<ul class="right">
<li class="divider show-for-medium-and-up"></li>
<li class="has-dropdown">
<a href="../demo/index.html">Demo</a>
<ul class="dropdown">
<li><label>Static Analysis</label></li>
<li><a href="../demo/parse.html">Online Parsing</a></li>
<li><a href="../demo/validate.html">Syntax Validator</a></li>
<li><a href="../demo/precedence.html">Operator Precedence</a></li>
<li><a href="../demo/collector.html">Regex Collector</a></li>
<li><label>Dynamic Tracing</label></li>
<li><a href="../demo/functiontrace.html">Function Instrumentation</a></li>
<li><label>Code Transformation</label></li>
<li><a href="../demo/rewrite.html">Source Rewrite</a></li>
<li><a href="../demo/minify.html">Minifiy & Obfuscate</a></li>
<li><label>Editing Tools</label></li>
<li><a href="../demo/highlight.html">Identifier Highlight</a></li>
<li><a href="../demo/autocomplete.html">Autocomplete</a></li>
</ul>
</li>
<li class="has-dropdown">
<a href="#">Project</a>
<ul class="dropdown">
<li><a href="path_to_url">Git Repository</a></li>
<li><a href="path_to_url">Continuous Integration</a></li>
<li><a href="path_to_url">Mailing List</a></li>
<li><a href="path_to_url">Issue Tracker</a></li>
<li class="divider"></li>
<li><label>QA</label></li>
<li><a href="../test/index.html">Unit Tests</a></li>
<li><a href="../test/benchmarks.html">Benchmarks Suite</a></li>
<li><a href="../test/compat.html">Compatibility Tests</a></li>
<li><a href="../test/compare.html">Speed Comparison</a></li>
<li><a href="../test/module.html">Module Loading</a></li>
<li><a href="../test/coverage.html">Coverage Analysis</a></li>
</ul>
</li>
<li><a href="../doc/index.html">Documentation</a></li>
</ul>
</section>
</nav>
</div>
</div>
<!-- Title and subtitle -->
<div class="row">
<div class="twelve columns">
<h3 class="subheader"><strong>Compatibility</strong> keeps everyone happy</h3>
</div>
</div>
<!-- Main content -->
<div class="row">
<div class="eight columns">
<div id="report"></div>
</div>
<div class="four columns">
<div id="status" class="alert-box secondary">Please wait...</div>
<div class="panel">
<p>The following tests are to ensure that the syntax tree is compatible to
that produced by Mozilla SpiderMonkey
<a href="path_to_url">Parser reflection</a>.</p>
<p>Version being tested: <strong><span id="version"></span></strong>.</p>
</div>
</div>
</div>
<!-- Footer -->
<div class="row copyright">
<div class="six columns">
<p>Esprima is created and mantained by <a href="path_to_url">Ariya Hidayat</a>.</p>
</div>
<div class="six columns">
<ul class="link-list right">
<li><a href="path_to_url">@Esprima</a></li>
<li><a href="path_to_url">GitHub</a></li>
</ul>
</div>
</div>
<script src="../esprima.js"></script>
<script src="../assets/json2.js"></script>
<script id="reflect" src="reflect.js"></script>
<script src="compat.js"></script>
<script>
/*jslint browser: true */
window.onload = window.runTests;
</script>
</body>
</html>
``` | /content/code_sandbox/node_modules/esprima-fb/test/compat.html | html | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,148 |
```javascript
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint browser: true node: true */
/*global load:true, print:true */
var setupBenchmarks,
parsers,
fixtureList,
suite;
parsers = [
'Esprima',
'parse-js',
'Acorn'
];
fixtureList = [
'Underscore 1.4.1',
'Backbone 0.9.2',
'CodeMirror 2.34',
'jQuery 1.8.2'
];
function slug(name) {
'use strict';
return name.toLowerCase().replace(/\.js/g, 'js').replace(/\s/g, '-');
}
function kb(bytes) {
'use strict';
return (bytes / 1024).toFixed(1);
}
function inject(fname) {
'use strict';
var head = document.getElementsByTagName('head')[0],
script = document.createElement('script');
script.src = fname;
script.type = 'text/javascript';
head.appendChild(script);
}
if (typeof window !== 'undefined') {
// Run all tests in a browser environment.
setupBenchmarks = function () {
'use strict';
function id(i) {
return document.getElementById(i);
}
function setText(id, str) {
var el = document.getElementById(id);
if (typeof el.innerText === 'string') {
el.innerText = str;
} else {
el.textContent = str;
}
}
function enableRunButtons() {
id('run').disabled = false;
}
function disableRunButtons() {
id('run').disabled = true;
}
function createTable() {
var str = '',
i,
index,
test,
name;
str += '<table>';
str += '<thead><tr><th>Source</th><th>Size (KiB)</th>';
for (i = 0; i < parsers.length; i += 1) {
str += '<th>' + parsers[i] + '</th>';
}
str += '</tr></thead>';
str += '<tbody>';
for (index = 0; index < fixtureList.length; index += 1) {
test = fixtureList[index];
name = slug(test);
str += '<tr>';
str += '<td>' + test + '</td>';
if (window.data && window.data[name]) {
str += '<td id="' + name + '-size">' + kb(window.data[name].length) + '</td>';
} else {
str += '<td id="' + name + '-size"></td>';
}
for (i = 0; i < parsers.length; i += 1) {
str += '<td id="' + name + '-' + slug(parsers[i]) + '-time"></td>';
}
str += '</tr>';
}
str += '<tr><td><b>Total</b></td>';
str += '<td id="total-size"></td>';
for (i = 0; i < parsers.length; i += 1) {
str += '<td id="' + slug(parsers[i]) + '-total"></td>';
}
str += '</tr>';
str += '</tbody>';
str += '</table>';
id('result').innerHTML = str;
}
function loadFixtures() {
var index = 0,
totalSize = 0;
function load(test, callback) {
var xhr = new XMLHttpRequest(),
src = '3rdparty/' + test + '.js';
window.data = window.data || {};
window.data[test] = '';
try {
xhr.timeout = 30000;
xhr.open('GET', src, true);
xhr.ontimeout = function () {
setText('status', 'Error: time out while loading ' + test);
callback.apply();
};
xhr.onreadystatechange = function () {
var success = false,
size = 0;
if (this.readyState === XMLHttpRequest.DONE) {
if (this.status === 200) {
window.data[test] = this.responseText;
size = this.responseText.length;
totalSize += size;
success = true;
}
}
if (success) {
setText(test + '-size', kb(size));
} else {
setText('status', 'Please wait. Error loading ' + src);
setText(test + '-size', 'Error');
}
callback.apply();
};
xhr.send(null);
} catch (e) {
setText('status', 'Please wait. Error loading ' + src);
callback.apply();
}
}
function loadNextTest() {
var test;
if (index < fixtureList.length) {
test = fixtureList[index];
index += 1;
setText('status', 'Please wait. Loading ' + test +
' (' + index + ' of ' + fixtureList.length + ')');
window.setTimeout(function () {
load(slug(test), loadNextTest);
}, 100);
} else {
setText('total-size', kb(totalSize));
setText('status', 'Ready.');
enableRunButtons();
}
}
loadNextTest();
}
function setupParser() {
var i, j;
suite = [];
for (i = 0; i < fixtureList.length; i += 1) {
for (j = 0; j < parsers.length; j += 1) {
suite.push({
fixture: fixtureList[i],
parser: parsers[j]
});
}
}
createTable();
}
function runBenchmarks() {
var index = 0,
totalTime = {};
function reset() {
var i, name;
for (i = 0; i < suite.length; i += 1) {
name = slug(suite[i].fixture) + '-' + slug(suite[i].parser);
setText(name + '-time', '');
}
}
function run() {
var fixture, parser, test, source, fn, benchmark;
if (index >= suite.length) {
setText('status', 'Ready.');
enableRunButtons();
return;
}
fixture = suite[index].fixture;
parser = suite[index].parser;
source = window.data[slug(fixture)];
test = slug(fixture) + '-' + slug(parser);
setText(test + '-time', 'Running...');
setText('status', 'Please wait. Parsing ' + fixture + '...');
// Force the result to be held in this array, thus defeating any
// possible "dead code elimination" optimization.
window.tree = [];
switch (parser) {
case 'Esprima':
fn = function () {
var syntax = window.esprima.parse(source);
window.tree.push(syntax.body.length);
};
break;
case 'parse-js':
fn = function () {
var syntax = window.parseJS.parse(source);
window.tree.push(syntax.length);
};
break;
case 'Acorn':
fn = function () {
var syntax = window.acorn.parse(source);
window.tree.push(syntax.body.length);
};
break;
default:
throw 'Unknown parser type ' + parser;
}
benchmark = new window.Benchmark(test, fn, {
'onComplete': function () {
setText(this.name + '-time', (1000 * this.stats.mean).toFixed(1));
if (!totalTime[parser]) {
totalTime[parser] = this.stats.mean;
} else {
totalTime[parser] += this.stats.mean;
}
setText(slug(parser) + '-total', (1000 * totalTime[parser]).toFixed(1));
}
});
window.setTimeout(function () {
benchmark.run();
index += 1;
window.setTimeout(run, 211);
}, 211);
}
disableRunButtons();
setText('status', 'Please wait. Running benchmarks...');
reset();
run();
}
id('run').onclick = function () {
runBenchmarks();
};
setText('benchmarkjs-version', ' version ' + window.Benchmark.version);
setText('version', window.esprima.version);
setupParser();
createTable();
disableRunButtons();
loadFixtures();
};
} else {
// TODO
console.log('Not implemented yet!');
}
/* vim: set sw=4 ts=4 et tw=80 : */
``` | /content/code_sandbox/node_modules/esprima-fb/test/compare.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,031 |
```html
<!doctype html>
<html>
<head>
<title>Code coverage report for esprima/esprima.js</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-language" content="en-gb">
<link rel='stylesheet' href='../prettify.css'>
<style type='text/css'>
body, html {
margin:0; padding: 0;
}
body {
font-family: "Helvetic Neue", Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: consolas, menlo, monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
xtext-decoration: line-through;
}
.missing-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("path_to_url") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
</style>
</head>
<body>
<div class='header high'>
<h1>Code coverage report for <span class='entity'>esprima/esprima.js</span></h1>
<h2>
Statements: <span class='metric'>99.72% <small>(1760 / 1765)</small></span>
Branches: <span class='metric'>98.49% <small>(1107 / 1124)</small></span>
Functions: <span class='metric'>100% <small>(154 / 154)</small></span>
Lines: <span class='metric'>99.72% <small>(1760 / 1765)</small></span>
</h2>
</div>
<div class='body'>
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
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
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818</td><td class="line-coverage"><span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1568</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">5969</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">224</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">266</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">32604</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">32068</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">9111</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">16161</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">88</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">84</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">632</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">108</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">524</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">611</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2798</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2754</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">177</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">572</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">381</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">609</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">131</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">99</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">579</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">194</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">24482</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24482</span>
<span class="cline-any cline-yes">24482</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24482</span>
<span class="cline-any cline-yes">29971</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29971</span>
<span class="cline-any cline-yes">318</span>
<span class="cline-any cline-yes">318</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29653</span>
<span class="cline-any cline-yes">1020</span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">956</span>
<span class="cline-any cline-yes">956</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">948</span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28633</span>
<span class="cline-any cline-yes">371</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">371</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">332</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">264</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28262</span>
<span class="cline-any cline-yes">5934</span>
<span class="cline-any cline-yes">22328</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">22211</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-yes">174</span>
<span class="cline-any cline-yes">152</span>
<span class="cline-any cline-yes">152</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">37</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">4174</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4174</span>
<span class="cline-any cline-yes">4174</span>
<span class="cline-any cline-yes">16103</span>
<span class="cline-any cline-yes">16103</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16084</span>
<span class="cline-any cline-yes">12235</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3849</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4155</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">4203</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4203</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4203</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4167</span>
<span class="cline-any cline-yes">1369</span>
<span class="cline-any cline-yes">2798</span>
<span class="cline-any cline-yes">1440</span>
<span class="cline-any cline-yes">1358</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">1334</span>
<span class="cline-any cline-yes">153</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1181</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4167</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">6341</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6341</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">5418</span>
<span class="cline-any cline-yes">5418</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">923</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">923</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">33</span>
<span class="cline-any cline-yes">33</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">875</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">875</span>
<span class="cline-any cline-yes">875</span>
<span class="cline-any cline-yes">875</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">875</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">872</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">866</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">863</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">860</span>
<span class="cline-any cline-yes">167</span>
<span class="cline-any cline-yes">167</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">693</span>
<span class="cline-any cline-yes">677</span>
<span class="cline-any cline-yes">677</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">611</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">611</span>
<span class="cline-any cline-yes">611</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">611</span>
<span class="cline-any cline-yes">611</span>
<span class="cline-any cline-yes">611</span>
<span class="cline-any cline-yes">608</span>
<span class="cline-any cline-yes">608</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">608</span>
<span class="cline-any cline-yes">102</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">55</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">70</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">543</span>
<span class="cline-any cline-yes">733</span>
<span class="cline-any cline-yes">419</span>
<span class="cline-any cline-yes">419</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">314</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">546</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">78</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">72</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">546</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">530</span>
<span class="cline-any cline-yes">391</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">514</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-yes">4864</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4864</span>
<span class="cline-any cline-yes">455</span>
<span class="cline-any cline-yes">455</span>
<span class="cline-any cline-yes">4409</span>
<span class="cline-any cline-yes">121</span>
<span class="cline-any cline-yes">121</span>
<span class="cline-any cline-yes">115</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">78</span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-yes">47</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">78</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4288</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4280</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">455</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-yes">247</span>
<span class="cline-any cline-yes">247</span>
<span class="cline-any cline-yes">247</span>
<span class="cline-any cline-yes">112</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">135</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-yes">93</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">43</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-yes">42</span>
<span class="cline-any cline-yes">42</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">67</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">13035</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13035</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13011</span>
<span class="cline-any cline-yes">1385</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11626</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11626</span>
<span class="cline-any cline-yes">2496</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9130</span>
<span class="cline-any cline-yes">471</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">8659</span>
<span class="cline-any cline-yes">4203</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4456</span>
<span class="cline-any cline-yes">78</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">75</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4378</span>
<span class="cline-any cline-yes">608</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3770</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">11067</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11067</span>
<span class="cline-any cline-yes">11067</span>
<span class="cline-any cline-yes">11067</span>
<span class="cline-any cline-yes">11067</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11067</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11059</span>
<span class="cline-any cline-yes">11059</span>
<span class="cline-any cline-yes">11059</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11059</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1968</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1968</span>
<span class="cline-any cline-yes">1968</span>
<span class="cline-any cline-yes">1968</span>
<span class="cline-any cline-yes">1968</span>
<span class="cline-any cline-yes">1832</span>
<span class="cline-any cline-yes">1832</span>
<span class="cline-any cline-yes">1832</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">42</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">221</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">308</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">308</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">486</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">138</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1289</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">47</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">158</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2578</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1114</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">75</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">106</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">214</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">127</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">180</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">211</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">916</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">336</span>
<span class="cline-any cline-yes">336</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">916</span>
<span class="cline-any cline-yes">506</span>
<span class="cline-any cline-yes">506</span>
<span class="cline-any cline-yes">506</span>
<span class="cline-any cline-yes">506</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">410</span>
<span class="cline-any cline-yes">410</span>
<span class="cline-any cline-yes">410</span>
<span class="cline-any cline-yes">410</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">916</span>
<span class="cline-any cline-yes">916</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">300</span>
<span class="cline-any cline-yes">300</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">300</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">232</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">312</span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">232</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">216</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">212</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">208</span>
<span class="cline-any cline-yes">88</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">84</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">120</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">4378</span>
<span class="cline-any cline-yes">4378</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1225</span>
<span class="cline-any cline-yes">1225</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">28095</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">6064</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2367</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2367</span>
<span class="cline-any cline-yes">824</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1543</span>
<span class="cline-any cline-yes">1543</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1504</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1504</span>
<span class="cline-any cline-yes">552</span>
<span class="cline-any cline-yes">552</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">952</span>
<span class="cline-any cline-yes">952</span>
<span class="cline-any cline-yes">952</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">925</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">922</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">356</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">50</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">50</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">50</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">35</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">42</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">42</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">105</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">105</span>
<span class="cline-any cline-yes">105</span>
<span class="cline-any cline-yes">105</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">97</span>
<span class="cline-any cline-yes">97</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">355</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">355</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">327</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">254</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">254</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">254</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">218</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">218</span>
<span class="cline-any cline-yes">53</span>
<span class="cline-any cline-yes">53</span>
<span class="cline-any cline-yes">53</span>
<span class="cline-any cline-yes">53</span>
<span class="cline-any cline-yes">53</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">165</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">109</span>
<span class="cline-any cline-yes">109</span>
<span class="cline-any cline-yes">97</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">202</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">202</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">202</span>
<span class="cline-any cline-yes">254</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">214</span>
<span class="cline-any cline-yes">194</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">214</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">214</span>
<span class="cline-any cline-yes">214</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">160</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">174</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">174</span>
<span class="cline-any cline-yes">78</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">106</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">106</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">3183</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3183</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3183</span>
<span class="cline-any cline-yes">1373</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1810</span>
<span class="cline-any cline-yes">962</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">950</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">848</span>
<span class="cline-any cline-yes">144</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">141</span>
<span class="cline-any cline-yes">129</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">716</span>
<span class="cline-any cline-yes">113</span>
<span class="cline-any cline-yes">113</span>
<span class="cline-any cline-yes">113</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">603</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">599</span>
<span class="cline-any cline-yes">50</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">549</span>
<span class="cline-any cline-yes">202</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">347</span>
<span class="cline-any cline-yes">216</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">131</span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">158</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">158</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">158</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">73</span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">154</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">154</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">67</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">67</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">67</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">67</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1743</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1743</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1311</span>
<span class="cline-any cline-yes">89</span>
<span class="cline-any cline-yes">62</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1303</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">3183</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2743</span>
<span class="cline-any cline-yes">821</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1922</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1898</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">3270</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3270</span>
<span class="cline-any cline-yes">2440</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">830</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">778</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">758</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">743</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2691</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2691</span>
<span class="cline-any cline-yes">789</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1902</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">92</span>
<span class="cline-any cline-yes">92</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1557</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1902</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2383</span>
<span class="cline-any cline-yes">2383</span>
<span class="cline-any cline-yes">2383</span>
<span class="cline-any cline-yes">2161</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">222</span>
<span class="cline-any cline-yes">222</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">222</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">206</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">102</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">102</span>
<span class="cline-any cline-yes">102</span>
<span class="cline-any cline-yes">102</span>
<span class="cline-any cline-yes">102</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">206</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">206</span>
<span class="cline-any cline-yes">206</span>
<span class="cline-any cline-yes">206</span>
<span class="cline-any cline-yes">254</span>
<span class="cline-any cline-yes">254</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">206</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2367</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2367</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-yes">2859</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2367</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">257</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">237</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-yes">221</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2110</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2240</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1756</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1756</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-yes">401</span>
<span class="cline-any cline-yes">181</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">220</span>
<span class="cline-any cline-yes">184</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">180</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">193</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">193</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">181</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">915</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">915</span>
<span class="cline-any cline-yes">100</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">819</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">276</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">216</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">208</span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">177</span>
<span class="cline-any cline-yes">120</span>
<span class="cline-any cline-yes">116</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">180</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">223</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">223</span>
<span class="cline-any cline-yes">276</span>
<span class="cline-any cline-yes">180</span>
<span class="cline-any cline-yes">127</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">53</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">127</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">157</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">157</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">157</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">81</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">81</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">198</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">38</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">38</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">38</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">56</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">49</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">49</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">49</span>
<span class="cline-any cline-yes">49</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">49</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">50</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">37</span>
<span class="cline-any cline-yes">23</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">23</span>
<span class="cline-any cline-yes">23</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">21</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">42</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">17</span>
<span class="cline-any cline-yes">33</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">26</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">18</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2576</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2576</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2552</span>
<span class="cline-any cline-yes">548</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">160</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">198</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">136</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2140</span>
<span class="cline-any cline-yes">685</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">38</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">157</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">86</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1506</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1310</span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-yes">51</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1251</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1231</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">513</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">513</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">513</span>
<span class="cline-any cline-yes">780</span>
<span class="cline-any cline-yes">494</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">286</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">286</span>
<span class="cline-any cline-yes">278</span>
<span class="cline-any cline-yes">278</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">275</span>
<span class="cline-any cline-yes">275</span>
<span class="cline-any cline-yes">261</span>
<span class="cline-any cline-yes">261</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">497</span>
<span class="cline-any cline-yes">590</span>
<span class="cline-any cline-yes">305</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">285</span>
<span class="cline-any cline-yes">97</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">93</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">309</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">305</span>
<span class="cline-any cline-yes">305</span>
<span class="cline-any cline-yes">305</span>
<span class="cline-any cline-yes">305</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">305</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">424</span>
<span class="cline-any cline-yes">424</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">424</span>
<span class="cline-any cline-yes">111</span>
<span class="cline-any cline-yes">111</span>
<span class="cline-any cline-yes">144</span>
<span class="cline-any cline-yes">144</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">76</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-yes">95</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">33</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">408</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">408</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">335</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">335</span>
<span class="cline-any cline-yes">335</span>
<span class="cline-any cline-yes">335</span>
<span class="cline-any cline-yes">315</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">275</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">250</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">307</span>
<span class="cline-any cline-yes">291</span>
<span class="cline-any cline-yes">291</span>
<span class="cline-any cline-yes">291</span>
<span class="cline-any cline-yes">291</span>
<span class="cline-any cline-yes">49</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">291</span>
<span class="cline-any cline-yes">291</span>
<span class="cline-any cline-yes">107</span>
<span class="cline-any cline-yes">44</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">47</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">47</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">129</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">129</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">129</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">16</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">117</span>
<span class="cline-any cline-yes">93</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">69</span>
<span class="cline-any cline-yes">14</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">61</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">61</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2677</span>
<span class="cline-any cline-yes">981</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">332</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">608</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1696</span>
<span class="cline-any cline-yes">1684</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1805</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1805</span>
<span class="cline-any cline-yes">1874</span>
<span class="cline-any cline-yes">1874</span>
<span class="cline-any cline-yes">1728</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">146</span>
<span class="cline-any cline-yes">146</span>
<span class="cline-any cline-yes">146</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">143</span>
<span class="cline-any cline-yes">143</span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-yes">30</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1801</span>
<span class="cline-any cline-yes">1740</span>
<span class="cline-any cline-yes">1032</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1028</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1805</span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">99</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">99</span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-yes">22</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">77</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">3357</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3357</span>
<span class="cline-any cline-yes">3357</span>
<span class="cline-any cline-yes">3357</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3357</span>
<span class="cline-any cline-yes">5299</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">5299</span>
<span class="cline-any cline-yes">391</span>
<span class="cline-any cline-yes">391</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-yes">362</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">353</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4908</span>
<span class="cline-any cline-yes">431</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">34</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">397</span>
<span class="cline-any cline-yes">397</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">389</span>
<span class="cline-any cline-yes">389</span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">64</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-yes">58</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4477</span>
<span class="cline-any cline-yes">135</span>
<span class="cline-any cline-yes">135</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">41</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">94</span>
<span class="cline-any cline-yes">70</span>
<span class="cline-any cline-yes">70</span>
<span class="cline-any cline-yes">70</span>
<span class="cline-any cline-yes">70</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">70</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4342</span>
<span class="cline-any cline-yes">1242</span>
<span class="cline-any cline-yes">3100</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-yes">39</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">3061</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-yes">38</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">63</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">168</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-yes">72</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-yes">72</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">123</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">13398</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13398</span>
<span class="cline-any cline-yes">13398</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13398</span>
<span class="cline-any cline-yes">12068</span>
<span class="cline-any cline-yes">12068</span>
<span class="cline-any cline-yes">12068</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13398</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13398</span>
<span class="cline-any cline-yes">4598</span>
<span class="cline-any cline-yes">4574</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">4598</span>
<span class="cline-any cline-yes">4574</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">13398</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">48</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1440</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1440</span>
<span class="cline-any cline-yes">1440</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1440</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1440</span>
<span class="cline-any cline-yes">126</span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-yes">80</span>
<span class="cline-any cline-yes">46</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1440</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">20890</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20890</span>
<span class="cline-any cline-yes">20890</span>
<span class="cline-any cline-yes">50620</span>
<span class="cline-any cline-yes">50524</span>
<span class="cline-any cline-yes">50524</span>
<span class="cline-any cline-yes">30380</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20144</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">20890</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">19396</span>
<span class="cline-any cline-yes">13442</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">19396</span>
<span class="cline-any cline-yes">776</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">776</span>
<span class="cline-any cline-yes">152</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">776</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">776</span>
<span class="cline-any cline-yes">776</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">752</span>
<span class="cline-any cline-yes">66</span>
<span class="cline-any cline-yes">66</span>
<span class="cline-any cline-yes">66</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">776</span>
<span class="cline-any cline-yes">776</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">752</span>
<span class="cline-any cline-yes">66</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">19396</span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-yes">4444</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-yes">496</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">11890</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">478</span>
<span class="cline-any cline-yes">478</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">478</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1933</span>
<span class="cline-any cline-yes">1933</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1933</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1933</span>
<span class="cline-any cline-yes">478</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1933</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1938</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-yes">54</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-yes">68</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-yes">746</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">848</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-yes">1941</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1093</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint bitwise:true plusplus:true */
/*global esprima:true, define:true, exports:true, window: true,
throwError: true, generateStatement: true, peek: true,
parseAssignmentExpression: true, parseBlock: true, parseExpression: true,
parseFunctionDeclaration: true, parseFunctionExpression: true,
parseFunctionSourceElements: true, parseVariableIdentifier: true,
parseLeftHandSideExpression: true,
parseStatement: true, parseSourceElement: true */
(function (root, factory) {
'use strict';
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
// Rhino, and plain browser loading.
<span class="missing-if-branch" title="if path not taken"" >I</span>if (typeof define === 'function' && <span class="branch-1 cbranch-no" title="branch not covered" >define.amd)</span> {
<span class="cstat-no" title="statement not covered" > define(['exports'], factory);</span>
} else <span class="missing-if-branch" title="else path not taken"" >E</span>if (typeof exports !== 'undefined') {
factory(exports);
} else {
<span class="cstat-no" title="statement not covered" > factory((root.esprima = {}));</span>
}
}(this, function (exports) {
'use strict';
var Token,
TokenName,
Syntax,
PropertyKind,
Messages,
Regex,
SyntaxTreeDelegate,
source,
strict,
index,
lineNumber,
lineStart,
length,
delegate,
lookahead,
state,
extra;
Token = {
BooleanLiteral: 1,
EOF: 2,
Identifier: 3,
Keyword: 4,
NullLiteral: 5,
NumericLiteral: 6,
Punctuator: 7,
StringLiteral: 8
};
TokenName = {};
TokenName[Token.BooleanLiteral] = 'Boolean';
TokenName[Token.EOF] = '<end>';
TokenName[Token.Identifier] = 'Identifier';
TokenName[Token.Keyword] = 'Keyword';
TokenName[Token.NullLiteral] = 'Null';
TokenName[Token.NumericLiteral] = 'Numeric';
TokenName[Token.Punctuator] = 'Punctuator';
TokenName[Token.StringLiteral] = 'String';
Syntax = {
AssignmentExpression: 'AssignmentExpression',
ArrayExpression: 'ArrayExpression',
BlockStatement: 'BlockStatement',
BinaryExpression: 'BinaryExpression',
BreakStatement: 'BreakStatement',
CallExpression: 'CallExpression',
CatchClause: 'CatchClause',
ConditionalExpression: 'ConditionalExpression',
ContinueStatement: 'ContinueStatement',
DoWhileStatement: 'DoWhileStatement',
DebuggerStatement: 'DebuggerStatement',
EmptyStatement: 'EmptyStatement',
ExpressionStatement: 'ExpressionStatement',
ForStatement: 'ForStatement',
ForInStatement: 'ForInStatement',
FunctionDeclaration: 'FunctionDeclaration',
FunctionExpression: 'FunctionExpression',
Identifier: 'Identifier',
IfStatement: 'IfStatement',
Literal: 'Literal',
LabeledStatement: 'LabeledStatement',
LogicalExpression: 'LogicalExpression',
MemberExpression: 'MemberExpression',
NewExpression: 'NewExpression',
ObjectExpression: 'ObjectExpression',
Program: 'Program',
Property: 'Property',
ReturnStatement: 'ReturnStatement',
SequenceExpression: 'SequenceExpression',
SwitchStatement: 'SwitchStatement',
SwitchCase: 'SwitchCase',
ThisExpression: 'ThisExpression',
ThrowStatement: 'ThrowStatement',
TryStatement: 'TryStatement',
UnaryExpression: 'UnaryExpression',
UpdateExpression: 'UpdateExpression',
VariableDeclaration: 'VariableDeclaration',
VariableDeclarator: 'VariableDeclarator',
WhileStatement: 'WhileStatement',
WithStatement: 'WithStatement'
};
PropertyKind = {
Data: 1,
Get: 2,
Set: 4
};
// Error messages should be identical to V8.
Messages = {
UnexpectedToken: 'Unexpected token %0',
UnexpectedNumber: 'Unexpected number',
UnexpectedString: 'Unexpected string',
UnexpectedIdentifier: 'Unexpected identifier',
UnexpectedReserved: 'Unexpected reserved word',
UnexpectedEOS: 'Unexpected end of input',
NewlineAfterThrow: 'Illegal newline after throw',
InvalidRegExp: 'Invalid regular expression',
UnterminatedRegExp: 'Invalid regular expression: missing /',
InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
InvalidLHSInForIn: 'Invalid left-hand side in for-in',
MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
NoCatchOrFinally: 'Missing catch or finally after try',
UnknownLabel: 'Undefined label \'%0\'',
Redeclaration: '%0 \'%1\' has already been declared',
IllegalContinue: 'Illegal continue statement',
IllegalBreak: 'Illegal break statement',
IllegalReturn: 'Illegal return statement',
StrictModeWith: 'Strict mode code may not include a with statement',
StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
StrictVarName: 'Variable name may not be eval or arguments in strict mode',
StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
StrictDelete: 'Delete of an unqualified identifier in strict mode.',
StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',
AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',
AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',
StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
StrictReservedWord: 'Use of future reserved word in strict mode'
};
// See also tools/generate-unicode-regex.py.
Regex = {
NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]')
};
// Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.
function assert(condition, message) {
<span class="missing-if-branch" title="if path not taken"" >I</span>if (!condition) {
<span class="cstat-no" title="statement not covered" > throw new Error('ASSERT: ' + message);</span>
}
}
function isDecimalDigit(ch) {
return (ch >= 48 && ch <= 57); // 0..9
}
function isHexDigit(ch) {
return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}
function isOctalDigit(ch) {
return '01234567'.indexOf(ch) >= 0;
}
// 7.2 White Space
function isWhiteSpace(ch) {
return (ch === 32) || // space
(ch === 9) || // tab
(ch === 0xB) ||
(ch === 0xC) ||
(ch === 0xA0) ||
(ch >= 0x1680 && '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);
}
// 7.3 Line Terminators
function isLineTerminator(ch) {
return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);
}
// 7.6 Identifier Names and Identifiers
function isIdentifierStart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122) || // a..z
(ch === 92) || // \ (backslash)
((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));
}
function isIdentifierPart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122) || // a..z
(ch >= 48 && ch <= 57) || // 0..9
(ch === 92) || // \ (backslash)
((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
}
// 7.6.1.2 Future Reserved Words
function isFutureReservedWord(id) {
switch (id) {
case 'class':
case 'enum':
case 'export':
case 'extends':
case 'import':
case 'super':
return true;
default:
return false;
}
}
function isStrictModeReservedWord(id) {
switch (id) {
case 'implements':
case 'interface':
case 'package':
case 'private':
case 'protected':
case 'public':
case 'static':
case 'yield':
case 'let':
return true;
default:
return false;
}
}
function isRestrictedWord(id) {
return id === 'eval' || id === 'arguments';
}
// 7.6.1.1 Keywords
function isKeyword(id) {
if (strict && isStrictModeReservedWord(id)) {
return true;
}
// 'const' is specialized as Keyword in V8.
// 'yield' and 'let' are for compatiblity with SpiderMonkey and ES.next.
// Some others are from future reserved words.
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === 'this') || (id === 'else') || (id === 'case') ||
(id === 'void') || (id === 'with') || (id === 'enum');
case 5:
return (id === 'while') || (id === 'break') || (id === 'catch') ||
(id === 'throw') || (id === 'const') || (id === 'yield') ||
(id === 'class') || (id === 'super');
case 6:
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
(id === 'switch') || (id === 'export') || (id === 'import');
case 7:
return (id === 'default') || (id === 'finally') || (id === 'extends');
case 8:
return (id === 'function') || (id === 'continue') || (id === 'debugger');
case 10:
return (id === 'instanceof');
default:
return false;
}
}
// 7.4 Comments
function skipComment() {
var ch, blockComment, lineComment;
blockComment = false;
lineComment = false;
while (index < length) {
ch = source.charCodeAt(index);
if (lineComment) {
++index;
if (isLineTerminator(ch)) {
lineComment = false;
if (ch === 13 && source.charCodeAt(index) === 10) {
++index;
}
++lineNumber;
lineStart = index;
}
} else if (blockComment) {
if (isLineTerminator(ch)) {
if (ch === 13 && source.charCodeAt(index + 1) === 10) {
++index;
}
++lineNumber;
++index;
lineStart = index;
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
ch = source.charCodeAt(index++);
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// Block comment ends with '*/' (char #42, char #47).
if (ch === 42) {
ch = source.charCodeAt(index);
if (ch === 47) {
++index;
blockComment = false;
}
}
}
} else if (ch === 47) {
ch = source.charCodeAt(index + 1);
// Line comment starts with '//' (char #47, char #47).
if (ch === 47) {
index += 2;
lineComment = true;
} else if (ch === 42) {
// Block comment starts with '/*' (char #47, char #42).
index += 2;
blockComment = true;
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
break;
}
} else if (isWhiteSpace(ch)) {
++index;
} else if (isLineTerminator(ch)) {
++index;
if (ch === 13 && source.charCodeAt(index) === 10) {
++index;
}
++lineNumber;
lineStart = index;
} else {
break;
}
}
}
function scanHexEscape(prefix) {
var i, len, ch, code = 0;
len = (prefix === 'u') ? 4 : 2;
for (i = 0; i < len; ++i) {
if (index < length && isHexDigit(source[index])) {
ch = source[index++];
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
} else {
return '';
}
}
return String.fromCharCode(code);
}
function getEscapedIdentifier() {
var ch, id;
ch = source.charCodeAt(index++);
id = String.fromCharCode(ch);
// '\u' (char #92, char #117) denotes an escaped character.
if (ch === 92) {
if (source.charCodeAt(index) !== 117) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
id = ch;
}
while (index < length) {
ch = source.charCodeAt(index);
if (!isIdentifierPart(ch)) {
break;
}
++index;
id += String.fromCharCode(ch);
// '\u' (char #92, char #117) denotes an escaped character.
if (ch === 92) {
id = id.substr(0, id.length - 1);
if (source.charCodeAt(index) !== 117) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
id += ch;
}
}
return id;
}
function getIdentifier() {
var start, ch;
start = index++;
while (index < length) {
ch = source.charCodeAt(index);
if (ch === 92) {
// Blackslash (char #92) marks Unicode escape sequence.
index = start;
return getEscapedIdentifier();
}
if (isIdentifierPart(ch)) {
++index;
} else {
break;
}
}
return source.slice(start, index);
}
function scanIdentifier() {
var start, id, type;
start = index;
// Backslash (char #92) starts an escaped character.
id = (source.charCodeAt(index) === 92) ? getEscapedIdentifier() : getIdentifier();
// There is no keyword or literal with only one character.
// Thus, it must be an identifier.
if (id.length === 1) {
type = Token.Identifier;
} else if (isKeyword(id)) {
type = Token.Keyword;
} else if (id === 'null') {
type = Token.NullLiteral;
} else if (id === 'true' || id === 'false') {
type = Token.BooleanLiteral;
} else {
type = Token.Identifier;
}
return {
type: type,
value: id,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// 7.7 Punctuators
function scanPunctuator() {
var start = index,
code = source.charCodeAt(index),
code2,
ch1 = source[index],
ch2,
ch3,
ch4;
switch (code) {
// Check for most common single-character punctuators.
case 46: // . dot
case 40: // ( open bracket
case 41: // ) close bracket
case 59: // ; semicolon
case 44: // , comma
case 123: // { open curly brace
case 125: // } close curly brace
case 91: // [
case 93: // ]
case 58: // :
case 63: // ?
case 126: // ~
++index;
return {
type: Token.Punctuator,
value: String.fromCharCode(code),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
default:
code2 = source.charCodeAt(index + 1);
// '=' (char #61) marks an assignment or comparison operator.
if (code2 === 61) {
switch (code) {
case 37: // %
case 38: // &
case 42: // *:
case 43: // +
case 45: // -
case 47: // /
case 60: // <
case 62: // >
case 94: // ^
case 124: // |
index += 2;
return {
type: Token.Punctuator,
value: String.fromCharCode(code) + String.fromCharCode(code2),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
case 33: // !
case 61: // =
index += 2;
// !== and ===
if (source.charCodeAt(index) === 61) {
++index;
}
return {
type: Token.Punctuator,
value: source.slice(start, index),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
default:
break;
}
}
break;
}
// Peek more characters.
ch2 = source[index + 1];
ch3 = source[index + 2];
ch4 = source[index + 3];
// 4-character punctuator: >>>=
if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
if (ch4 === '=') {
index += 4;
return {
type: Token.Punctuator,
value: '>>>=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
}
// 3-character punctuators: === !== >>> <<= >>=
if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
index += 3;
return {
type: Token.Punctuator,
value: '>>>',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '<' && ch2 === '<' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '<<=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '>' && ch2 === '>' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '>>=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// Other 2-character punctuators: ++ -- << >> && ||
if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0)) {
index += 2;
return {
type: Token.Punctuator,
value: ch1 + ch2,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
++index;
return {
type: Token.Punctuator,
value: ch1,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// 7.8.3 Numeric Literals
function scanNumericLiteral() {
var number, start, ch;
ch = source[index];
assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
'Numeric literal must start with a decimal digit or a decimal point');
start = index;
number = '';
if (ch !== '.') {
number = source[index++];
ch = source[index];
// Hex number starts with '0x'.
// Octal number starts with '0'.
if (number === '0') {
if (ch === 'x' || ch === 'X') {
number += source[index++];
while (index < length) {
ch = source[index];
if (!isHexDigit(ch)) {
break;
}
number += source[index++];
}
if (number.length <= 2) {
// only 0x
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
if (index < length) {
ch = source[index];
if (isIdentifierStart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
return {
type: Token.NumericLiteral,
value: parseInt(number, 16),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (isOctalDigit(ch)) {
number += source[index++];
while (index < length) {
ch = source[index];
if (!isOctalDigit(ch)) {
break;
}
number += source[index++];
}
if (index < length) {
ch = source.charCodeAt(index);
if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
return {
type: Token.NumericLiteral,
value: parseInt(number, 8),
octal: true,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// decimal number starts with '0' such as '09' is illegal.
if (ch && isDecimalDigit(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
while (index < length) {
if (!isDecimalDigit(source.charCodeAt(index))) {
ch = source[index];
break;
}
number += source[index++];
}
}
if (ch === '.') {
number += source[index++];
while (index < length) {
if (!isDecimalDigit(source.charCodeAt(index))) {
ch = source[index];
break;
}
number += source[index++];
}
}
if (ch === 'e' || ch === 'E') {
number += source[index++];
ch = source[index];
if (ch === '+' || ch === '-') {
number += source[index++];
}
ch = source[index];
if (ch && isDecimalDigit(ch.charCodeAt(0))) {
number += source[index++];
while (index < length) {
if (!isDecimalDigit(source.charCodeAt(index))) {
ch = source[index];
break;
}
number += source[index++];
}
} else {
ch = 'character ' + ch;
if (index >= length) {
ch = '<end>';
}
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
if (index < length) {
if (isIdentifierStart(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
return {
type: Token.NumericLiteral,
value: parseFloat(number),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// 7.8.4 String Literals
function scanStringLiteral() {
var str = '', quote, start, ch, code, unescaped, restore, octal = false;
quote = source[index];
assert((quote === '\'' || quote === '"'),
'String literal must starts with a quote');
start = index;
++index;
while (index < length) {
ch = source[index++];
if (ch === quote) {
quote = '';
break;
} else if (ch === '\\') {
ch = source[index++];
if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
str += '\n';
break;
case 'r':
str += '\r';
break;
case 't':
str += '\t';
break;
case 'u':
case 'x':
restore = index;
unescaped = scanHexEscape(ch);
if (unescaped) {
str += unescaped;
} else {
index = restore;
str += ch;
}
break;
case 'b':
str += '\b';
break;
case 'f':
str += '\f';
break;
case 'v':
str += '\v';
break;
default:
if (isOctalDigit(ch)) {
code = '01234567'.indexOf(ch);
// \0 is not octal escape sequence
if (code !== 0) {
octal = true;
}
if (index < length && isOctalDigit(source[index])) {
octal = true;
code = code * 8 + '01234567'.indexOf(source[index++]);
// 3 digits are only allowed when string starts
// with 0, 1, 2, 3
if ('0123'.indexOf(ch) >= 0 &&
index < length &&
isOctalDigit(source[index])) {
code = code * 8 + '01234567'.indexOf(source[index++]);
}
}
str += String.fromCharCode(code);
} else {
str += ch;
}
break;
}
} else {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
break;
} else {
str += ch;
}
}
if (quote !== '') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.StringLiteral,
value: str,
octal: octal,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanRegExp() {
var str, ch, start, pattern, flags, value, classMarker = false, restore, terminated = false;
lookahead = null;
skipComment();
start = index;
ch = source[index];
assert(ch === '/', 'Regular expression literal must start with a slash');
str = source[index++];
while (index < length) {
ch = source[index++];
str += ch;
if (classMarker) {
if (ch === ']') {
classMarker = false;
}
} else {
if (ch === '\\') {
ch = source[index++];
// ECMA-262 7.8.5
if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, Messages.UnterminatedRegExp);
}
str += ch;
} else if (ch === '/') {
terminated = true;
break;
} else if (ch === '[') {
classMarker = true;
} else if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, Messages.UnterminatedRegExp);
}
}
}
if (!terminated) {
throwError({}, Messages.UnterminatedRegExp);
}
// Exclude leading and trailing slash.
pattern = str.substr(1, str.length - 2);
flags = '';
while (index < length) {
ch = source[index];
if (!isIdentifierPart(ch.charCodeAt(0))) {
break;
}
++index;
if (ch === '\\' && index < length) {
ch = source[index];
if (ch === 'u') {
++index;
restore = index;
ch = scanHexEscape('u');
if (ch) {
flags += ch;
for (str += '\\u'; restore < index; ++restore) {
str += source[restore];
}
} else {
index = restore;
flags += 'u';
str += '\\u';
}
} else {
str += '\\';
}
} else {
flags += ch;
str += ch;
}
}
try {
value = new RegExp(pattern, flags);
} catch (e) {
throwError({}, Messages.InvalidRegExp);
}
peek();
return {
literal: str,
value: value,
range: [start, index]
};
}
function isIdentifierName(token) {
return token.type === Token.Identifier ||
token.type === Token.Keyword ||
token.type === Token.BooleanLiteral ||
token.type === Token.NullLiteral;
}
function advance() {
var ch;
skipComment();
if (index >= length) {
return {
type: Token.EOF,
lineNumber: lineNumber,
lineStart: lineStart,
range: [index, index]
};
}
ch = source.charCodeAt(index);
// Very common: ( and ) and ;
if (ch === 40 || ch === 41 || ch === 58) {
return scanPunctuator();
}
// String literal starts with single quote (#39) or double quote (#34).
if (ch === 39 || ch === 34) {
return scanStringLiteral();
}
if (isIdentifierStart(ch)) {
return scanIdentifier();
}
// Dot (.) char #46 can also start a floating-point number, hence the need
// to check the next character.
if (ch === 46) {
if (isDecimalDigit(source.charCodeAt(index + 1))) {
return scanNumericLiteral();
}
return scanPunctuator();
}
if (isDecimalDigit(ch)) {
return scanNumericLiteral();
}
return scanPunctuator();
}
function lex() {
var token;
token = lookahead;
index = token.range[1];
lineNumber = token.lineNumber;
lineStart = token.lineStart;
lookahead = advance();
index = token.range[1];
lineNumber = token.lineNumber;
lineStart = token.lineStart;
return token;
}
function peek() {
var pos, line, start;
pos = index;
line = lineNumber;
start = lineStart;
lookahead = advance();
index = pos;
lineNumber = line;
lineStart = start;
}
SyntaxTreeDelegate = {
name: 'SyntaxTree',
createArrayExpression: function (elements) {
return {
type: Syntax.ArrayExpression,
elements: elements
};
},
createAssignmentExpression: function (operator, left, right) {
return {
type: Syntax.AssignmentExpression,
operator: operator,
left: left,
right: right
};
},
createBinaryExpression: function (operator, left, right) {
var type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression :
Syntax.BinaryExpression;
return {
type: type,
operator: operator,
left: left,
right: right
};
},
createBlockStatement: function (body) {
return {
type: Syntax.BlockStatement,
body: body
};
},
createBreakStatement: function (label) {
return {
type: Syntax.BreakStatement,
label: label
};
},
createCallExpression: function (callee, args) {
return {
type: Syntax.CallExpression,
callee: callee,
'arguments': args
};
},
createCatchClause: function (param, body) {
return {
type: Syntax.CatchClause,
param: param,
body: body
};
},
createConditionalExpression: function (test, consequent, alternate) {
return {
type: Syntax.ConditionalExpression,
test: test,
consequent: consequent,
alternate: alternate
};
},
createContinueStatement: function (label) {
return {
type: Syntax.ContinueStatement,
label: label
};
},
createDebuggerStatement: function () {
return {
type: Syntax.DebuggerStatement
};
},
createDoWhileStatement: function (body, test) {
return {
type: Syntax.DoWhileStatement,
body: body,
test: test
};
},
createEmptyStatement: function () {
return {
type: Syntax.EmptyStatement
};
},
createExpressionStatement: function (expression) {
return {
type: Syntax.ExpressionStatement,
expression: expression
};
},
createForStatement: function (init, test, update, body) {
return {
type: Syntax.ForStatement,
init: init,
test: test,
update: update,
body: body
};
},
createForInStatement: function (left, right, body) {
return {
type: Syntax.ForInStatement,
left: left,
right: right,
body: body,
each: false
};
},
createFunctionDeclaration: function (id, params, defaults, body) {
return {
type: Syntax.FunctionDeclaration,
id: id,
params: params,
defaults: defaults,
body: body,
rest: null,
generator: false,
expression: false
};
},
createFunctionExpression: function (id, params, defaults, body) {
return {
type: Syntax.FunctionExpression,
id: id,
params: params,
defaults: defaults,
body: body,
rest: null,
generator: false,
expression: false
};
},
createIdentifier: function (name) {
return {
type: Syntax.Identifier,
name: name
};
},
createIfStatement: function (test, consequent, alternate) {
return {
type: Syntax.IfStatement,
test: test,
consequent: consequent,
alternate: alternate
};
},
createLabeledStatement: function (label, body) {
return {
type: Syntax.LabeledStatement,
label: label,
body: body
};
},
createLiteral: function (token) {
return {
type: Syntax.Literal,
value: token.value,
raw: source.slice(token.range[0], token.range[1])
};
},
createMemberExpression: function (accessor, object, property) {
return {
type: Syntax.MemberExpression,
computed: accessor === '[',
object: object,
property: property
};
},
createNewExpression: function (callee, args) {
return {
type: Syntax.NewExpression,
callee: callee,
'arguments': args
};
},
createObjectExpression: function (properties) {
return {
type: Syntax.ObjectExpression,
properties: properties
};
},
createPostfixExpression: function (operator, argument) {
return {
type: Syntax.UpdateExpression,
operator: operator,
argument: argument,
prefix: false
};
},
createProgram: function (body) {
return {
type: Syntax.Program,
body: body
};
},
createProperty: function (kind, key, value) {
return {
type: Syntax.Property,
key: key,
value: value,
kind: kind
};
},
createReturnStatement: function (argument) {
return {
type: Syntax.ReturnStatement,
argument: argument
};
},
createSequenceExpression: function (expressions) {
return {
type: Syntax.SequenceExpression,
expressions: expressions
};
},
createSwitchCase: function (test, consequent) {
return {
type: Syntax.SwitchCase,
test: test,
consequent: consequent
};
},
createSwitchStatement: function (discriminant, cases) {
return {
type: Syntax.SwitchStatement,
discriminant: discriminant,
cases: cases
};
},
createThisExpression: function () {
return {
type: Syntax.ThisExpression
};
},
createThrowStatement: function (argument) {
return {
type: Syntax.ThrowStatement,
argument: argument
};
},
createTryStatement: function (block, guardedHandlers, handlers, finalizer) {
return {
type: Syntax.TryStatement,
block: block,
guardedHandlers: guardedHandlers,
handlers: handlers,
finalizer: finalizer
};
},
createUnaryExpression: function (operator, argument) {
if (operator === '++' || operator === '--') {
return {
type: Syntax.UpdateExpression,
operator: operator,
argument: argument,
prefix: true
};
}
return {
type: Syntax.UnaryExpression,
operator: operator,
argument: argument
};
},
createVariableDeclaration: function (declarations, kind) {
return {
type: Syntax.VariableDeclaration,
declarations: declarations,
kind: kind
};
},
createVariableDeclarator: function (id, init) {
return {
type: Syntax.VariableDeclarator,
id: id,
init: init
};
},
createWhileStatement: function (test, body) {
return {
type: Syntax.WhileStatement,
test: test,
body: body
};
},
createWithStatement: function (object, body) {
return {
type: Syntax.WithStatement,
object: object,
body: body
};
}
};
// Return true if there is a line terminator before the next token.
function peekLineTerminator() {
var pos, line, start, found;
pos = index;
line = lineNumber;
start = lineStart;
skipComment();
found = lineNumber !== line;
index = pos;
lineNumber = line;
lineStart = start;
return found;
}
// Throw an exception
function throwError(token, messageFormat) {
var error,
args = Array.prototype.slice.call(arguments, 2),
msg = messageFormat.replace(
/%(\d)/g,
function (whole, index) {
assert(index < args.length, 'Message reference must be in range');
return args[index];
}
);
if (typeof token.lineNumber === 'number') {
error = new Error('Line ' + token.lineNumber + ': ' + msg);
error.index = token.range[0];
error.lineNumber = token.lineNumber;
error.column = token.range[0] - lineStart + 1;
} else {
error = new Error('Line ' + lineNumber + ': ' + msg);
error.index = index;
error.lineNumber = lineNumber;
error.column = index - lineStart + 1;
}
error.description = msg;
throw error;
}
function throwErrorTolerant() {
try {
throwError.apply(null, arguments);
} catch (e) {
if (extra.errors) {
extra.errors.push(e);
} else {
throw e;
}
}
}
// Throw an exception because of the token.
function throwUnexpected(token) {
if (token.type === Token.EOF) {
throwError(token, Messages.UnexpectedEOS);
}
if (token.type === Token.NumericLiteral) {
throwError(token, Messages.UnexpectedNumber);
}
if (token.type === Token.StringLiteral) {
throwError(token, Messages.UnexpectedString);
}
if (token.type === Token.Identifier) {
throwError(token, Messages.UnexpectedIdentifier);
}
if (token.type === Token.Keyword) {
if (isFutureReservedWord(token.value)) {
throwError(token, Messages.UnexpectedReserved);
} else if (strict && isStrictModeReservedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictReservedWord);
return;
}
throwError(token, Messages.UnexpectedToken, token.value);
}
// BooleanLiteral, NullLiteral, or Punctuator.
throwError(token, Messages.UnexpectedToken, token.value);
}
// Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.
function expect(value) {
var token = lex();
if (token.type !== Token.Punctuator || token.value !== value) {
throwUnexpected(token);
}
}
// Expect the next token to match the specified keyword.
// If not, an exception will be thrown.
function expectKeyword(keyword) {
var token = lex();
if (token.type !== Token.Keyword || token.value !== keyword) {
throwUnexpected(token);
}
}
// Return true if the next token matches the specified punctuator.
function match(value) {
return lookahead.type === Token.Punctuator && lookahead.value === value;
}
// Return true if the next token matches the specified keyword
function matchKeyword(keyword) {
return lookahead.type === Token.Keyword && lookahead.value === keyword;
}
// Return true if the next token is an assignment operator
function matchAssign() {
var op;
if (lookahead.type !== Token.Punctuator) {
return false;
}
op = lookahead.value;
return op === '=' ||
op === '*=' ||
op === '/=' ||
op === '%=' ||
op === '+=' ||
op === '-=' ||
op === '<<=' ||
op === '>>=' ||
op === '>>>=' ||
op === '&=' ||
op === '^=' ||
op === '|=';
}
function consumeSemicolon() {
var line;
// Catch the very common case first: immediately a semicolon (char #59).
if (source.charCodeAt(index) === 59) {
lex();
return;
}
line = lineNumber;
skipComment();
if (lineNumber !== line) {
return;
}
if (match(';')) {
lex();
return;
}
if (lookahead.type !== Token.EOF && !match('}')) {
throwUnexpected(lookahead);
}
}
// Return true if provided expression is LeftHandSideExpression
function isLeftHandSide(expr) {
return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;
}
// 11.1.4 Array Initialiser
function parseArrayInitialiser() {
var elements = [];
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
elements.push(parseAssignmentExpression());
if (!match(']')) {
expect(',');
}
}
}
expect(']');
return delegate.createArrayExpression(elements);
}
// 11.1.5 Object Initialiser
function parsePropertyFunction(param, first) {
var previousStrict, body;
previousStrict = strict;
body = parseFunctionSourceElements();
if (first && strict && isRestrictedWord(param[0].name)) {
throwErrorTolerant(first, Messages.StrictParamName);
}
strict = previousStrict;
return delegate.createFunctionExpression(null, param, [], body);
}
function parseObjectPropertyKey() {
var token = lex();
// Note: This function is called only from parseObjectProperty(), where
// EOF and Punctuator tokens are already filtered out.
if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {
if (strict && token.octal) {
throwErrorTolerant(token, Messages.StrictOctalLiteral);
}
return delegate.createLiteral(token);
}
return delegate.createIdentifier(token.value);
}
function parseObjectProperty() {
var token, key, id, value, param;
token = lookahead;
if (token.type === Token.Identifier) {
id = parseObjectPropertyKey();
// Property Assignment: Getter and Setter.
if (token.value === 'get' && !match(':')) {
key = parseObjectPropertyKey();
expect('(');
expect(')');
value = parsePropertyFunction([]);
return delegate.createProperty('get', key, value);
}
if (token.value === 'set' && !match(':')) {
key = parseObjectPropertyKey();
expect('(');
token = lookahead;
if (token.type !== Token.Identifier) {
throwUnexpected(lex());
}
param = [ parseVariableIdentifier() ];
expect(')');
value = parsePropertyFunction(param, token);
return delegate.createProperty('set', key, value);
}
expect(':');
value = parseAssignmentExpression();
return delegate.createProperty('init', id, value);
}
if (token.type === Token.EOF || token.type === Token.Punctuator) {
throwUnexpected(token);
} else {
key = parseObjectPropertyKey();
expect(':');
value = parseAssignmentExpression();
return delegate.createProperty('init', key, value);
}
}
function parseObjectInitialiser() {
var properties = [], property, name, key, kind, map = {}, toString = String;
expect('{');
while (!match('}')) {
property = parseObjectProperty();
if (property.key.type === Syntax.Identifier) {
name = property.key.name;
} else {
name = toString(property.key.value);
}
kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;
key = '$' + name;
if (Object.prototype.hasOwnProperty.call(map, key)) {
if (map[key] === PropertyKind.Data) {
if (strict && kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.StrictDuplicateProperty);
} else if (kind !== PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
}
} else {
if (kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
} else if (map[key] & kind) {
throwErrorTolerant({}, Messages.AccessorGetSet);
}
}
map[key] |= kind;
} else {
map[key] = kind;
}
properties.push(property);
if (!match('}')) {
expect(',');
}
}
expect('}');
return delegate.createObjectExpression(properties);
}
// 11.1.6 The Grouping Operator
function parseGroupExpression() {
var expr;
expect('(');
expr = parseExpression();
expect(')');
return expr;
}
// 11.1 Primary Expressions
function parsePrimaryExpression() {
var type, token;
type = lookahead.type;
if (type === Token.Identifier) {
return delegate.createIdentifier(lex().value);
}
if (type === Token.StringLiteral || type === Token.NumericLiteral) {
if (strict && lookahead.octal) {
throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);
}
return delegate.createLiteral(lex());
}
if (type === Token.Keyword) {
if (matchKeyword('this')) {
lex();
return delegate.createThisExpression();
}
if (matchKeyword('function')) {
return parseFunctionExpression();
}
}
if (type === Token.BooleanLiteral) {
token = lex();
token.value = (token.value === 'true');
return delegate.createLiteral(token);
}
if (type === Token.NullLiteral) {
token = lex();
token.value = null;
return delegate.createLiteral(token);
}
if (match('[')) {
return parseArrayInitialiser();
}
if (match('{')) {
return parseObjectInitialiser();
}
if (match('(')) {
return parseGroupExpression();
}
if (match('/') || match('/=')) {
return delegate.createLiteral(scanRegExp());
}
return throwUnexpected(lex());
}
// 11.2 Left-Hand-Side Expressions
function parseArguments() {
var args = [];
expect('(');
if (!match(')')) {
while (index < length) {
args.push(parseAssignmentExpression());
if (match(')')) {
break;
}
expect(',');
}
}
expect(')');
return args;
}
function parseNonComputedProperty() {
var token = lex();
if (!isIdentifierName(token)) {
throwUnexpected(token);
}
return delegate.createIdentifier(token.value);
}
function parseNonComputedMember() {
expect('.');
return parseNonComputedProperty();
}
function parseComputedMember() {
var expr;
expect('[');
expr = parseExpression();
expect(']');
return expr;
}
function parseNewExpression() {
var callee, args;
expectKeyword('new');
callee = parseLeftHandSideExpression();
args = match('(') ? parseArguments() : [];
return delegate.createNewExpression(callee, args);
}
function parseLeftHandSideExpressionAllowCall() {
var expr, args, property;
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || match('(')) {
if (match('(')) {
args = parseArguments();
expr = delegate.createCallExpression(expr, args);
} else if (match('[')) {
property = parseComputedMember();
expr = delegate.createMemberExpression('[', expr, property);
} else {
property = parseNonComputedMember();
expr = delegate.createMemberExpression('.', expr, property);
}
}
return expr;
}
function parseLeftHandSideExpression() {
var expr, property;
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[')) {
if (match('[')) {
property = parseComputedMember();
expr = delegate.createMemberExpression('[', expr, property);
} else {
property = parseNonComputedMember();
expr = delegate.createMemberExpression('.', expr, property);
}
}
return expr;
}
// 11.3 Postfix Expressions
function parsePostfixExpression() {
var expr = parseLeftHandSideExpressionAllowCall(), token;
if (lookahead.type !== Token.Punctuator) {
return expr;
}
if ((match('++') || match('--')) && !peekLineTerminator()) {
// 11.3.1, 11.3.2
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPostfix);
}
if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
token = lex();
expr = delegate.createPostfixExpression(token.value, expr);
}
return expr;
}
// 11.4 Unary Operators
function parseUnaryExpression() {
var token, expr;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
return parsePostfixExpression();
}
if (match('++') || match('--')) {
token = lex();
expr = parseUnaryExpression();
// 11.4.4, 11.4.5
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPrefix);
}
if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
return delegate.createUnaryExpression(token.value, expr);
}
if (match('+') || match('-') || match('~') || match('!')) {
token = lex();
expr = parseUnaryExpression();
return delegate.createUnaryExpression(token.value, expr);
}
if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
token = lex();
expr = parseUnaryExpression();
expr = delegate.createUnaryExpression(token.value, expr);
if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
throwErrorTolerant({}, Messages.StrictDelete);
}
return expr;
}
return parsePostfixExpression();
}
function binaryPrecedence(token, allowIn) {
var prec = 0;
if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
return 0;
}
switch (token.value) {
case '||':
prec = 1;
break;
case '&&':
prec = 2;
break;
case '|':
prec = 3;
break;
case '^':
prec = 4;
break;
case '&':
prec = 5;
break;
case '==':
case '!=':
case '===':
case '!==':
prec = 6;
break;
case '<':
case '>':
case '<=':
case '>=':
case 'instanceof':
prec = 7;
break;
case 'in':
prec = allowIn ? 7 : 0;
break;
case '<<':
case '>>':
case '>>>':
prec = 8;
break;
case '+':
case '-':
prec = 9;
break;
case '*':
case '/':
case '%':
prec = 11;
break;
default:
break;
}
return prec;
}
// 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators
function parseBinaryExpression() {
var expr, token, prec, previousAllowIn, stack, right, operator, left, i;
previousAllowIn = state.allowIn;
state.allowIn = true;
expr = parseUnaryExpression();
token = lookahead;
prec = binaryPrecedence(token, previousAllowIn);
if (prec === 0) {
return expr;
}
token.prec = prec;
lex();
stack = [expr, token, parseUnaryExpression()];
while ((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) {
// Reduce: make a binary expression from the three topmost entries.
while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
right = stack.pop();
operator = stack.pop().value;
left = stack.pop();
stack.push(delegate.createBinaryExpression(operator, left, right));
}
// Shift.
token = lex();
token.prec = prec;
stack.push(token);
stack.push(parseUnaryExpression());
}
state.allowIn = previousAllowIn;
// Final reduce to clean-up the stack.
i = stack.length - 1;
expr = stack[i];
while (i > 1) {
expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
i -= 2;
}
return expr;
}
// 11.12 Conditional Operator
function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate;
expr = parseBinaryExpression();
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn = true;
consequent = parseAssignmentExpression();
state.allowIn = previousAllowIn;
expect(':');
alternate = parseAssignmentExpression();
expr = delegate.createConditionalExpression(expr, consequent, alternate);
}
return expr;
}
// 11.13 Assignment Operators
function parseAssignmentExpression() {
var token, left, right;
token = lookahead;
left = parseConditionalExpression();
if (matchAssign()) {
// LeftHandSideExpression
if (!isLeftHandSide(left)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
// 11.13.1
if (strict && left.type === Syntax.Identifier && isRestrictedWord(left.name)) {
throwErrorTolerant(token, Messages.StrictLHSAssignment);
}
token = lex();
right = parseAssignmentExpression();
return delegate.createAssignmentExpression(token.value, left, right);
}
return left;
}
// 11.14 Comma Operator
function parseExpression() {
var expr = parseAssignmentExpression();
if (match(',')) {
expr = delegate.createSequenceExpression([ expr ]);
while (index < length) {
if (!match(',')) {
break;
}
lex();
expr.expressions.push(parseAssignmentExpression());
}
}
return expr;
}
// 12.1 Block
function parseStatementList() {
var list = [],
statement;
while (index < length) {
if (match('}')) {
break;
}
statement = parseSourceElement();
if (typeof statement === 'undefined') {
break;
}
list.push(statement);
}
return list;
}
function parseBlock() {
var block;
expect('{');
block = parseStatementList();
expect('}');
return delegate.createBlockStatement(block);
}
// 12.2 Variable Statement
function parseVariableIdentifier() {
var token = lex();
if (token.type !== Token.Identifier) {
throwUnexpected(token);
}
return delegate.createIdentifier(token.value);
}
function parseVariableDeclaration(kind) {
var id = parseVariableIdentifier(),
init = null;
// 12.2.1
if (strict && isRestrictedWord(id.name)) {
throwErrorTolerant({}, Messages.StrictVarName);
}
if (kind === 'const') {
expect('=');
init = parseAssignmentExpression();
} else if (match('=')) {
lex();
init = parseAssignmentExpression();
}
return delegate.createVariableDeclarator(id, init);
}
function parseVariableDeclarationList(kind) {
var list = [];
do {
list.push(parseVariableDeclaration(kind));
if (!match(',')) {
break;
}
lex();
} while (index < length);
return list;
}
function parseVariableStatement() {
var declarations;
expectKeyword('var');
declarations = parseVariableDeclarationList();
consumeSemicolon();
return delegate.createVariableDeclaration(declarations, 'var');
}
// kind may be `const` or `let`
// Both are experimental and not in the specification yet.
// see path_to_url
// and path_to_url
function parseConstLetDeclaration(kind) {
var declarations;
expectKeyword(kind);
declarations = parseVariableDeclarationList(kind);
consumeSemicolon();
return delegate.createVariableDeclaration(declarations, kind);
}
// 12.3 Empty Statement
function parseEmptyStatement() {
expect(';');
return delegate.createEmptyStatement();
}
// 12.4 Expression Statement
function parseExpressionStatement() {
var expr = parseExpression();
consumeSemicolon();
return delegate.createExpressionStatement(expr);
}
// 12.5 If statement
function parseIfStatement() {
var test, consequent, alternate;
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement();
} else {
alternate = null;
}
return delegate.createIfStatement(test, consequent, alternate);
}
// 12.6 Iteration Statements
function parseDoWhileStatement() {
var body, test, oldInIteration;
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
if (match(';')) {
lex();
}
return delegate.createDoWhileStatement(body, test);
}
function parseWhileStatement() {
var test, body, oldInIteration;
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
return delegate.createWhileStatement(test, body);
}
function parseForVariableDeclaration() {
var token = lex(),
declarations = parseVariableDeclarationList();
return delegate.createVariableDeclaration(declarations, token.value);
}
function parseForStatement() {
var init, test, update, left, right, body, oldInIteration;
init = test = update = null;
expectKeyword('for');
expect('(');
if (match(';')) {
lex();
} else {
if (matchKeyword('var') || matchKeyword('let')) {
state.allowIn = false;
init = parseForVariableDeclaration();
state.allowIn = true;
if (init.declarations.length === 1 && matchKeyword('in')) {
lex();
left = init;
right = parseExpression();
init = null;
}
} else {
state.allowIn = false;
init = parseExpression();
state.allowIn = true;
if (matchKeyword('in')) {
// LeftHandSideExpression
if (!isLeftHandSide(init)) {
throwError({}, Messages.InvalidLHSInForIn);
}
lex();
left = init;
right = parseExpression();
init = null;
}
}
if (typeof left === 'undefined') {
expect(';');
}
}
if (typeof left === 'undefined') {
if (!match(';')) {
test = parseExpression();
}
expect(';');
if (!match(')')) {
update = parseExpression();
}
}
expect(')');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
return (typeof left === 'undefined') ?
delegate.createForStatement(init, test, update, body) :
delegate.createForInStatement(left, right, body);
}
// 12.7 The continue statement
function parseContinueStatement() {
var label = null, key;
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(index) === 59) {
lex();
if (!state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return delegate.createContinueStatement(null);
}
if (peekLineTerminator()) {
if (!state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return delegate.createContinueStatement(null);
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError({}, Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return delegate.createContinueStatement(label);
}
// 12.8 The break statement
function parseBreakStatement() {
var label = null, key;
expectKeyword('break');
// Catch the very common case first: immediately a semicolon (char #59).
if (source.charCodeAt(index) === 59) {
lex();
if (!(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return delegate.createBreakStatement(null);
}
if (peekLineTerminator()) {
if (!(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return delegate.createBreakStatement(null);
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
key = '$' + label.name;
if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError({}, Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return delegate.createBreakStatement(label);
}
// 12.9 The return statement
function parseReturnStatement() {
var argument = null;
expectKeyword('return');
if (!state.inFunctionBody) {
throwErrorTolerant({}, Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(index) === 32) {
if (isIdentifierStart(source.charCodeAt(index + 1))) {
argument = parseExpression();
consumeSemicolon();
return delegate.createReturnStatement(argument);
}
}
if (peekLineTerminator()) {
return delegate.createReturnStatement(null);
}
if (!match(';')) {
if (!match('}') && lookahead.type !== Token.EOF) {
argument = parseExpression();
}
}
consumeSemicolon();
return delegate.createReturnStatement(argument);
}
// 12.10 The with statement
function parseWithStatement() {
var object, body;
if (strict) {
throwErrorTolerant({}, Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return delegate.createWithStatement(object, body);
}
// 12.10 The swith statement
function parseSwitchCase() {
var test,
consequent = [],
statement;
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (index < length) {
if (match('}') || matchKeyword('default') || matchKeyword('case')) {
break;
}
statement = parseStatement();
consequent.push(statement);
}
return delegate.createSwitchCase(test, consequent);
}
function parseSwitchStatement() {
var discriminant, cases, clause, oldInSwitch, defaultFound;
expectKeyword('switch');
expect('(');
discriminant = parseExpression();
expect(')');
expect('{');
if (match('}')) {
lex();
return delegate.createSwitchStatement(discriminant);
}
cases = [];
oldInSwitch = state.inSwitch;
state.inSwitch = true;
defaultFound = false;
while (index < length) {
if (match('}')) {
break;
}
clause = parseSwitchCase();
if (clause.test === null) {
if (defaultFound) {
throwError({}, Messages.MultipleDefaultsInSwitch);
}
defaultFound = true;
}
cases.push(clause);
}
state.inSwitch = oldInSwitch;
expect('}');
return delegate.createSwitchStatement(discriminant, cases);
}
// 12.13 The throw statement
function parseThrowStatement() {
var argument;
expectKeyword('throw');
if (peekLineTerminator()) {
throwError({}, Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return delegate.createThrowStatement(argument);
}
// 12.14 The try statement
function parseCatchClause() {
var param, body;
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpected(lookahead);
}
param = parseExpression();
// 12.14.1
if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) {
throwErrorTolerant({}, Messages.StrictCatchVariable);
}
expect(')');
body = parseBlock();
return delegate.createCatchClause(param, body);
}
function parseTryStatement() {
var block, handlers = [], finalizer = null;
expectKeyword('try');
block = parseBlock();
if (matchKeyword('catch')) {
handlers.push(parseCatchClause());
}
if (matchKeyword('finally')) {
lex();
finalizer = parseBlock();
}
if (handlers.length === 0 && !finalizer) {
throwError({}, Messages.NoCatchOrFinally);
}
return delegate.createTryStatement(block, [], handlers, finalizer);
}
// 12.15 The debugger statement
function parseDebuggerStatement() {
expectKeyword('debugger');
consumeSemicolon();
return delegate.createDebuggerStatement();
}
// 12 Statements
function parseStatement() {
var type = lookahead.type,
expr,
labeledBody,
key;
if (type === Token.EOF) {
throwUnexpected(lookahead);
}
if (type === Token.Punctuator) {
switch (lookahead.value) {
case ';':
return parseEmptyStatement();
case '{':
return parseBlock();
case '(':
return parseExpressionStatement();
default:
break;
}
}
if (type === Token.Keyword) {
switch (lookahead.value) {
case 'break':
return parseBreakStatement();
case 'continue':
return parseContinueStatement();
case 'debugger':
return parseDebuggerStatement();
case 'do':
return parseDoWhileStatement();
case 'for':
return parseForStatement();
case 'function':
return parseFunctionDeclaration();
case 'if':
return parseIfStatement();
case 'return':
return parseReturnStatement();
case 'switch':
return parseSwitchStatement();
case 'throw':
return parseThrowStatement();
case 'try':
return parseTryStatement();
case 'var':
return parseVariableStatement();
case 'while':
return parseWhileStatement();
case 'with':
return parseWithStatement();
default:
break;
}
}
expr = parseExpression();
// 12.12 Labelled Statements
if ((expr.type === Syntax.Identifier) && match(':')) {
lex();
key = '$' + expr.name;
if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
throwError({}, Messages.Redeclaration, 'Label', expr.name);
}
state.labelSet[key] = true;
labeledBody = parseStatement();
delete state.labelSet[key];
return delegate.createLabeledStatement(expr, labeledBody);
}
consumeSemicolon();
return delegate.createExpressionStatement(expr);
}
// 13 Function Definition
function parseFunctionSourceElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody;
expect('{');
while (index < length) {
if (lookahead.type !== Token.StringLiteral) {
break;
}
token = lookahead;
sourceElement = parseSourceElement();
sourceElements.push(sourceElement);
if (sourceElement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.range[0] + 1, token.range[1] - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
oldLabelSet = state.labelSet;
oldInIteration = state.inIteration;
oldInSwitch = state.inSwitch;
oldInFunctionBody = state.inFunctionBody;
state.labelSet = {};
state.inIteration = false;
state.inSwitch = false;
state.inFunctionBody = true;
while (index < length) {
if (match('}')) {
break;
}
sourceElement = parseSourceElement();
if (typeof sourceElement === 'undefined') {
break;
}
sourceElements.push(sourceElement);
}
expect('}');
state.labelSet = oldLabelSet;
state.inIteration = oldInIteration;
state.inSwitch = oldInSwitch;
state.inFunctionBody = oldInFunctionBody;
return delegate.createBlockStatement(sourceElements);
}
function parseParams(firstRestricted) {
var param, params = [], token, stricted, paramSet, key, message;
expect('(');
if (!match(')')) {
paramSet = {};
while (index < length) {
token = lookahead;
param = parseVariableIdentifier();
key = '$' + token.value;
if (strict) {
if (isRestrictedWord(token.value)) {
stricted = token;
message = Messages.StrictParamName;
}
if (Object.prototype.hasOwnProperty.call(paramSet, key)) {
stricted = token;
message = Messages.StrictParamDupe;
}
} else if (!firstRestricted) {
if (isRestrictedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictParamName;
} else if (isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictReservedWord;
} else if (Object.prototype.hasOwnProperty.call(paramSet, key)) {
firstRestricted = token;
message = Messages.StrictParamDupe;
}
}
params.push(param);
paramSet[key] = true;
if (match(')')) {
break;
}
expect(',');
}
}
expect(')');
return {
params: params,
stricted: stricted,
firstRestricted: firstRestricted,
message: message
};
}
function parseFunctionDeclaration() {
var id, params = [], body, token, stricted, tmp, firstRestricted, message, previousStrict;
expectKeyword('function');
token = lookahead;
id = parseVariableIdentifier();
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
if (isRestrictedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictFunctionName;
} else if (isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictReservedWord;
}
}
tmp = parseParams(firstRestricted);
params = tmp.params;
stricted = tmp.stricted;
firstRestricted = tmp.firstRestricted;
if (tmp.message) {
message = tmp.message;
}
previousStrict = strict;
body = parseFunctionSourceElements();
if (strict && firstRestricted) {
throwError(firstRestricted, message);
}
if (strict && stricted) {
throwErrorTolerant(stricted, message);
}
strict = previousStrict;
return delegate.createFunctionDeclaration(id, params, [], body);
}
function parseFunctionExpression() {
var token, id = null, stricted, firstRestricted, message, tmp, params = [], body, previousStrict;
expectKeyword('function');
if (!match('(')) {
token = lookahead;
id = parseVariableIdentifier();
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
if (isRestrictedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictFunctionName;
} else if (isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictReservedWord;
}
}
}
tmp = parseParams(firstRestricted);
params = tmp.params;
stricted = tmp.stricted;
firstRestricted = tmp.firstRestricted;
if (tmp.message) {
message = tmp.message;
}
previousStrict = strict;
body = parseFunctionSourceElements();
if (strict && firstRestricted) {
throwError(firstRestricted, message);
}
if (strict && stricted) {
throwErrorTolerant(stricted, message);
}
strict = previousStrict;
return delegate.createFunctionExpression(id, params, [], body);
}
// 14 Program
function parseSourceElement() {
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'const':
case 'let':
return parseConstLetDeclaration(lookahead.value);
case 'function':
return parseFunctionDeclaration();
default:
return parseStatement();
}
}
if (lookahead.type !== Token.EOF) {
return parseStatement();
}
}
function parseSourceElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted;
while (index < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
sourceElement = parseSourceElement();
sourceElements.push(sourceElement);
if (sourceElement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.range[0] + 1, token.range[1] - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
while (index < length) {
sourceElement = parseSourceElement();
if (typeof sourceElement === 'undefined') {
break;
}
sourceElements.push(sourceElement);
}
return sourceElements;
}
function parseProgram() {
var body;
strict = false;
peek();
body = parseSourceElements();
return delegate.createProgram(body);
}
// The following functions are needed only when the option to preserve
// the comments is active.
function addComment(type, value, start, end, loc) {
assert(typeof start === 'number', 'Comment must have valid position');
// Because the way the actual token is scanned, often the comments
// (if any) are skipped twice during the lexical analysis.
// Thus, we need to skip adding a comment if the comment array already
// handled it.
if (extra.comments.length > 0) {
if (extra.comments[extra.comments.length - 1].range[1] > start) {
return;
}
}
extra.comments.push({
type: type,
value: value,
range: [start, end],
loc: loc
});
}
function scanComment() {
var comment, ch, loc, start, blockComment, lineComment;
comment = '';
blockComment = false;
lineComment = false;
while (index < length) {
ch = source[index];
if (lineComment) {
ch = source[index++];
if (isLineTerminator(ch.charCodeAt(0))) {
loc.end = {
line: lineNumber,
column: index - lineStart - 1
};
lineComment = false;
addComment('Line', comment, start, index - 1, loc);
if (ch === '\r' && source[index] === '\n') {
++index;
}
++lineNumber;
lineStart = index;
comment = '';
} else if (index >= length) {
lineComment = false;
comment += ch;
loc.end = {
line: lineNumber,
column: length - lineStart
};
addComment('Line', comment, start, length, loc);
} else {
comment += ch;
}
} else if (blockComment) {
if (isLineTerminator(ch.charCodeAt(0))) {
if (ch === '\r' && source[index + 1] === '\n') {
++index;
comment += '\r\n';
} else {
comment += ch;
}
++lineNumber;
++index;
lineStart = index;
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
ch = source[index++];
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
comment += ch;
if (ch === '*') {
ch = source[index];
if (ch === '/') {
comment = comment.substr(0, comment.length - 1);
blockComment = false;
++index;
loc.end = {
line: lineNumber,
column: index - lineStart
};
addComment('Block', comment, start, index, loc);
comment = '';
}
}
}
} else if (ch === '/') {
ch = source[index + 1];
if (ch === '/') {
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
start = index;
index += 2;
lineComment = true;
if (index >= length) {
loc.end = {
line: lineNumber,
column: index - lineStart
};
lineComment = false;
addComment('Line', comment, start, index, loc);
}
} else if (ch === '*') {
start = index;
index += 2;
blockComment = true;
loc = {
start: {
line: lineNumber,
column: index - lineStart - 2
}
};
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
break;
}
} else if (isWhiteSpace(ch.charCodeAt(0))) {
++index;
} else if (isLineTerminator(ch.charCodeAt(0))) {
++index;
if (ch === '\r' && source[index] === '\n') {
++index;
}
++lineNumber;
lineStart = index;
} else {
break;
}
}
}
function filterCommentLocation() {
var i, entry, comment, comments = [];
for (i = 0; i < extra.comments.length; ++i) {
entry = extra.comments[i];
comment = {
type: entry.type,
value: entry.value
};
if (extra.range) {
comment.range = entry.range;
}
if (extra.loc) {
comment.loc = entry.loc;
}
comments.push(comment);
}
extra.comments = comments;
}
function collectToken() {
var start, loc, token, range, value;
skipComment();
start = index;
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
token = extra.advance();
loc.end = {
line: lineNumber,
column: index - lineStart
};
if (token.type !== Token.EOF) {
range = [token.range[0], token.range[1]];
value = source.slice(token.range[0], token.range[1]);
extra.tokens.push({
type: TokenName[token.type],
value: value,
range: range,
loc: loc
});
}
return token;
}
function collectRegex() {
var pos, loc, regex, token;
skipComment();
pos = index;
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
regex = extra.scanRegExp();
loc.end = {
line: lineNumber,
column: index - lineStart
};
// Pop the previous token, which is likely '/' or '/='
<span class="missing-if-branch" title="else path not taken"" >E</span>if (extra.tokens.length > 0) {
token = extra.tokens[extra.tokens.length - 1];
<span class="missing-if-branch" title="else path not taken"" >E</span>if (token.range[0] === pos && token.type === 'Punctuator') {
<span class="missing-if-branch" title="else path not taken"" >E</span>if (token.value === '/' || token.value === '/=') {
extra.tokens.pop();
}
}
}
extra.tokens.push({
type: 'RegularExpression',
value: regex.literal,
range: [pos, index],
loc: loc
});
return regex;
}
function filterTokenLocation() {
var i, entry, token, tokens = [];
for (i = 0; i < extra.tokens.length; ++i) {
entry = extra.tokens[i];
token = {
type: entry.type,
value: entry.value
};
if (extra.range) {
token.range = entry.range;
}
if (extra.loc) {
token.loc = entry.loc;
}
tokens.push(token);
}
extra.tokens = tokens;
}
function createLocationMarker() {
var marker = {};
marker.range = [index, index];
marker.loc = {
start: {
line: lineNumber,
column: index - lineStart
},
end: {
line: lineNumber,
column: index - lineStart
}
};
marker.end = function () {
this.range[1] = index;
this.loc.end.line = lineNumber;
this.loc.end.column = index - lineStart;
};
marker.applyGroup = function (node) {
<span class="missing-if-branch" title="else path not taken"" >E</span>if (extra.range) {
node.groupRange = [this.range[0], this.range[1]];
}
<span class="missing-if-branch" title="else path not taken"" >E</span>if (extra.loc) {
node.groupLoc = {
start: {
line: this.loc.start.line,
column: this.loc.start.column
},
end: {
line: this.loc.end.line,
column: this.loc.end.column
}
};
}
};
marker.apply = function (node) {
if (extra.range) {
node.range = [this.range[0], this.range[1]];
}
if (extra.loc) {
node.loc = {
start: {
line: this.loc.start.line,
column: this.loc.start.column
},
end: {
line: this.loc.end.line,
column: this.loc.end.column
}
};
}
};
return marker;
}
function trackGroupExpression() {
var marker, expr;
skipComment();
marker = createLocationMarker();
expect('(');
expr = parseExpression();
expect(')');
marker.end();
marker.applyGroup(expr);
return expr;
}
function trackLeftHandSideExpression() {
var marker, expr, property;
skipComment();
marker = createLocationMarker();
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[')) {
if (match('[')) {
property = parseComputedMember();
expr = delegate.createMemberExpression('[', expr, property);
marker.end();
marker.apply(expr);
} else {
property = parseNonComputedMember();
expr = delegate.createMemberExpression('.', expr, property);
marker.end();
marker.apply(expr);
}
}
return expr;
}
function trackLeftHandSideExpressionAllowCall() {
var marker, expr, args, property;
skipComment();
marker = createLocationMarker();
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || match('(')) {
if (match('(')) {
args = parseArguments();
expr = delegate.createCallExpression(expr, args);
marker.end();
marker.apply(expr);
} else if (match('[')) {
property = parseComputedMember();
expr = delegate.createMemberExpression('[', expr, property);
marker.end();
marker.apply(expr);
} else {
property = parseNonComputedMember();
expr = delegate.createMemberExpression('.', expr, property);
marker.end();
marker.apply(expr);
}
}
return expr;
}
function filterGroup(node) {
var n, i, entry;
n = (Object.prototype.toString.apply(node) === '[object Array]') ? [] : {};
for (i in node) {
if (node.hasOwnProperty(i) && i !== 'groupRange' && i !== 'groupLoc') {
entry = node[i];
if (entry === null || typeof entry !== 'object' || entry instanceof RegExp) {
n[i] = entry;
} else {
n[i] = filterGroup(entry);
}
}
}
return n;
}
function wrapTrackingFunction(range, loc) {
return function (parseFunction) {
function isBinary(node) {
return node.type === Syntax.LogicalExpression ||
node.type === Syntax.BinaryExpression;
}
function visit(node) {
var start, end;
if (isBinary(node.left)) {
visit(node.left);
}
if (isBinary(node.right)) {
visit(node.right);
}
<span class="missing-if-branch" title="else path not taken"" >E</span>if (range) {
if (node.left.groupRange || node.right.groupRange) {
start = node.left.groupRange ? node.left.groupRange[0] : node.left.range[0];
end = node.right.groupRange ? node.right.groupRange[1] : node.right.range[1];
node.range = [start, end];
} else if (typeof node.range === 'undefined') {
start = node.left.range[0];
end = node.right.range[1];
node.range = [start, end];
}
}
<span class="missing-if-branch" title="else path not taken"" >E</span>if (loc) {
if (node.left.groupLoc || node.right.groupLoc) {
start = node.left.groupLoc ? node.left.groupLoc.start : node.left.loc.start;
end = node.right.groupLoc ? node.right.groupLoc.end : node.right.loc.end;
node.loc = {
start: start,
end: end
};
} else if (typeof node.loc === 'undefined') {
node.loc = {
start: node.left.loc.start,
end: node.right.loc.end
};
}
}
}
return function () {
var marker, node;
skipComment();
marker = createLocationMarker();
node = parseFunction.apply(null, arguments);
marker.end();
if (range && typeof node.range === 'undefined') {
marker.apply(node);
}
if (loc && typeof node.loc === 'undefined') {
marker.apply(node);
}
if (isBinary(node)) {
visit(node);
}
return node;
};
};
}
function patch() {
var wrapTracking;
if (extra.comments) {
extra.skipComment = skipComment;
skipComment = scanComment;
}
if (extra.range || extra.loc) {
extra.parseGroupExpression = parseGroupExpression;
extra.parseLeftHandSideExpression = parseLeftHandSideExpression;
extra.parseLeftHandSideExpressionAllowCall = parseLeftHandSideExpressionAllowCall;
parseGroupExpression = trackGroupExpression;
parseLeftHandSideExpression = trackLeftHandSideExpression;
parseLeftHandSideExpressionAllowCall = trackLeftHandSideExpressionAllowCall;
wrapTracking = wrapTrackingFunction(extra.range, extra.loc);
extra.parseAssignmentExpression = parseAssignmentExpression;
extra.parseBinaryExpression = parseBinaryExpression;
extra.parseBlock = parseBlock;
extra.parseFunctionSourceElements = parseFunctionSourceElements;
extra.parseCatchClause = parseCatchClause;
extra.parseComputedMember = parseComputedMember;
extra.parseConditionalExpression = parseConditionalExpression;
extra.parseConstLetDeclaration = parseConstLetDeclaration;
extra.parseExpression = parseExpression;
extra.parseForVariableDeclaration = parseForVariableDeclaration;
extra.parseFunctionDeclaration = parseFunctionDeclaration;
extra.parseFunctionExpression = parseFunctionExpression;
extra.parseNewExpression = parseNewExpression;
extra.parseNonComputedProperty = parseNonComputedProperty;
extra.parseObjectProperty = parseObjectProperty;
extra.parseObjectPropertyKey = parseObjectPropertyKey;
extra.parsePostfixExpression = parsePostfixExpression;
extra.parsePrimaryExpression = parsePrimaryExpression;
extra.parseProgram = parseProgram;
extra.parsePropertyFunction = parsePropertyFunction;
extra.parseStatement = parseStatement;
extra.parseSwitchCase = parseSwitchCase;
extra.parseUnaryExpression = parseUnaryExpression;
extra.parseVariableDeclaration = parseVariableDeclaration;
extra.parseVariableIdentifier = parseVariableIdentifier;
parseAssignmentExpression = wrapTracking(extra.parseAssignmentExpression);
parseBinaryExpression = wrapTracking(extra.parseBinaryExpression);
parseBlock = wrapTracking(extra.parseBlock);
parseFunctionSourceElements = wrapTracking(extra.parseFunctionSourceElements);
parseCatchClause = wrapTracking(extra.parseCatchClause);
parseComputedMember = wrapTracking(extra.parseComputedMember);
parseConditionalExpression = wrapTracking(extra.parseConditionalExpression);
parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration);
parseExpression = wrapTracking(extra.parseExpression);
parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration);
parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration);
parseFunctionExpression = wrapTracking(extra.parseFunctionExpression);
parseLeftHandSideExpression = wrapTracking(parseLeftHandSideExpression);
parseNewExpression = wrapTracking(extra.parseNewExpression);
parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty);
parseObjectProperty = wrapTracking(extra.parseObjectProperty);
parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey);
parsePostfixExpression = wrapTracking(extra.parsePostfixExpression);
parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression);
parseProgram = wrapTracking(extra.parseProgram);
parsePropertyFunction = wrapTracking(extra.parsePropertyFunction);
parseStatement = wrapTracking(extra.parseStatement);
parseSwitchCase = wrapTracking(extra.parseSwitchCase);
parseUnaryExpression = wrapTracking(extra.parseUnaryExpression);
parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration);
parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier);
}
if (typeof extra.tokens !== 'undefined') {
extra.advance = advance;
extra.scanRegExp = scanRegExp;
advance = collectToken;
scanRegExp = collectRegex;
}
}
function unpatch() {
if (typeof extra.skipComment === 'function') {
skipComment = extra.skipComment;
}
if (extra.range || extra.loc) {
parseAssignmentExpression = extra.parseAssignmentExpression;
parseBinaryExpression = extra.parseBinaryExpression;
parseBlock = extra.parseBlock;
parseFunctionSourceElements = extra.parseFunctionSourceElements;
parseCatchClause = extra.parseCatchClause;
parseComputedMember = extra.parseComputedMember;
parseConditionalExpression = extra.parseConditionalExpression;
parseConstLetDeclaration = extra.parseConstLetDeclaration;
parseExpression = extra.parseExpression;
parseForVariableDeclaration = extra.parseForVariableDeclaration;
parseFunctionDeclaration = extra.parseFunctionDeclaration;
parseFunctionExpression = extra.parseFunctionExpression;
parseGroupExpression = extra.parseGroupExpression;
parseLeftHandSideExpression = extra.parseLeftHandSideExpression;
parseLeftHandSideExpressionAllowCall = extra.parseLeftHandSideExpressionAllowCall;
parseNewExpression = extra.parseNewExpression;
parseNonComputedProperty = extra.parseNonComputedProperty;
parseObjectProperty = extra.parseObjectProperty;
parseObjectPropertyKey = extra.parseObjectPropertyKey;
parsePrimaryExpression = extra.parsePrimaryExpression;
parsePostfixExpression = extra.parsePostfixExpression;
parseProgram = extra.parseProgram;
parsePropertyFunction = extra.parsePropertyFunction;
parseStatement = extra.parseStatement;
parseSwitchCase = extra.parseSwitchCase;
parseUnaryExpression = extra.parseUnaryExpression;
parseVariableDeclaration = extra.parseVariableDeclaration;
parseVariableIdentifier = extra.parseVariableIdentifier;
}
if (typeof extra.scanRegExp === 'function') {
advance = extra.advance;
scanRegExp = extra.scanRegExp;
}
}
function parse(code, options) {
var program, toString;
toString = String;
if (typeof code !== 'string' && !(code instanceof String)) {
code = toString(code);
}
delegate = SyntaxTreeDelegate;
source = code;
index = 0;
lineNumber = (source.length > 0) ? 1 : 0;
lineStart = 0;
length = source.length;
lookahead = null;
state = {
allowIn: true,
labelSet: {},
inFunctionBody: false,
inIteration: false,
inSwitch: false
};
extra = {};
if (typeof options !== 'undefined') {
extra.range = (typeof options.range === 'boolean') && options.range;
extra.loc = (typeof options.loc === 'boolean') && options.loc;
if (typeof options.tokens === 'boolean' && options.tokens) {
extra.tokens = [];
}
if (typeof options.comment === 'boolean' && options.comment) {
extra.comments = [];
}
if (typeof options.tolerant === 'boolean' && options.tolerant) {
extra.errors = [];
}
}
if (length > 0) {
<span class="missing-if-branch" title="if path not taken"" >I</span>if (typeof source[0] === 'undefined') {
// Try first to convert to a string. This is good as fast path
// for old IE which understands string indexing for string
// literals only and not for string object.
<span class="cstat-no" title="statement not covered" > if (code instanceof String) {</span>
<span class="cstat-no" title="statement not covered" > source = code.valueOf();</span>
}
}
}
patch();
try {
program = parseProgram();
if (typeof extra.comments !== 'undefined') {
filterCommentLocation();
program.comments = extra.comments;
}
if (typeof extra.tokens !== 'undefined') {
filterTokenLocation();
program.tokens = extra.tokens;
}
if (typeof extra.errors !== 'undefined') {
program.errors = extra.errors;
}
if (extra.range || extra.loc) {
program.body = filterGroup(program.body);
}
} catch (e) {
throw e;
} finally {
unpatch();
extra = {};
}
return program;
}
// Sync with package.json and component.json.
exports.version = '1.1.0-dev';
exports.parse = parse;
// Deep copy.
exports.Syntax = (function () {
var name, types = {};
<span class="missing-if-branch" title="else path not taken"" >E</span>if (typeof Object.create === 'function') {
types = Object.create(null);
}
for (name in Syntax) {
<span class="missing-if-branch" title="else path not taken"" >E</span>if (Syntax.hasOwnProperty(name)) {
types[name] = Syntax[name];
}
}
<span class="missing-if-branch" title="else path not taken"" >E</span>if (typeof Object.freeze === 'function') {
Object.freeze(types);
}
return types;
}());
}));
/* vim: set sw=4 ts=4 et tw=80 : */
</pre></td></tr>
</table></pre>
</div>
<div class='footer'>
</div>
</body>
<script src="../prettify.js"></script>
<script src="path_to_url"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</html>
``` | /content/code_sandbox/node_modules/esprima-fb/test/esprima.js.html | html | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 94,867 |
```javascript
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint browser: true node: true */
/*global load:true, print:true */
var setupBenchmarks,
fullFixture,
quickFixture;
fullFixture = [
'Underscore 1.4.1',
'Backbone 0.9.2',
'CodeMirror 2.34',
'MooTools 1.4.1',
'jQuery 1.8.2',
'jQuery.Mobile 1.2.0',
'Angular 1.0.2',
'three.js r51'
];
quickFixture = [
'Backbone 0.9.2',
'jQuery 1.8.2',
'Angular 1.0.2'
];
function slug(name) {
'use strict';
return name.toLowerCase().replace(/\.js/g, 'js').replace(/\s/g, '-');
}
function kb(bytes) {
'use strict';
return (bytes / 1024).toFixed(1);
}
if (typeof window !== 'undefined') {
// Run all tests in a browser environment.
setupBenchmarks = function () {
'use strict';
function id(i) {
return document.getElementById(i);
}
function setText(id, str) {
var el = document.getElementById(id);
if (typeof el.innerText === 'string') {
el.innerText = str;
} else {
el.textContent = str;
}
}
function enableRunButtons() {
id('runquick').disabled = false;
id('runfull').disabled = false;
}
function disableRunButtons() {
id('runquick').disabled = true;
id('runfull').disabled = true;
}
function createTable() {
var str = '',
index,
test,
name;
str += '<table>';
str += '<thead><tr><th>Source</th><th>Size (KiB)</th>';
str += '<th>Time (ms)</th><th>Variance</th></tr></thead>';
str += '<tbody>';
for (index = 0; index < fullFixture.length; index += 1) {
test = fullFixture[index];
name = slug(test);
str += '<tr>';
str += '<td>' + test + '</td>';
str += '<td id="' + name + '-size"></td>';
str += '<td id="' + name + '-time"></td>';
str += '<td id="' + name + '-variance"></td>';
str += '</tr>';
}
str += '<tr><td><b>Total</b></td>';
str += '<td id="total-size"></td>';
str += '<td id="total-time"></td>';
str += '<td></td></tr>';
str += '</tbody>';
str += '</table>';
id('result').innerHTML = str;
}
function loadTests() {
var index = 0,
totalSize = 0;
function load(test, callback) {
var xhr = new XMLHttpRequest(),
src = '3rdparty/' + test + '.js';
window.data = window.data || {};
window.data[test] = '';
try {
xhr.timeout = 30000;
xhr.open('GET', src, true);
xhr.ontimeout = function () {
setText('status', 'Error: time out while loading ' + test);
callback.apply();
};
xhr.onreadystatechange = function () {
var success = false,
size = 0;
if (this.readyState === XMLHttpRequest.DONE) {
if (this.status === 200) {
window.data[test] = this.responseText;
size = this.responseText.length;
totalSize += size;
success = true;
}
}
if (success) {
setText(test + '-size', kb(size));
} else {
setText('status', 'Please wait. Error loading ' + src);
setText(test + '-size', 'Error');
}
callback.apply();
};
xhr.send(null);
} catch (e) {
setText('status', 'Please wait. Error loading ' + src);
callback.apply();
}
}
function loadNextTest() {
var test;
if (index < fullFixture.length) {
test = fullFixture[index];
index += 1;
setText('status', 'Please wait. Loading ' + test +
' (' + index + ' of ' + fullFixture.length + ')');
window.setTimeout(function () {
load(slug(test), loadNextTest);
}, 100);
} else {
setText('total-size', kb(totalSize));
setText('status', 'Ready.');
enableRunButtons();
}
}
loadNextTest();
}
function runBenchmarks(suite) {
var index = 0,
totalTime = 0;
function reset() {
var i, name;
for (i = 0; i < fullFixture.length; i += 1) {
name = slug(fullFixture[i]);
setText(name + '-time', '');
setText(name + '-variance', '');
}
setText('total-time', '');
}
function run() {
var el, test, source, benchmark;
if (index >= suite.length) {
setText('total-time', (1000 * totalTime).toFixed(1));
setText('status', 'Ready.');
enableRunButtons();
return;
}
test = slug(suite[index]);
el = id(test);
source = window.data[test];
setText(test + '-time', 'Running...');
// Force the result to be held in this array, thus defeating any
// possible "dead core elimination" optimization.
window.tree = [];
benchmark = new window.Benchmark(test, function (o) {
var syntax = window.esprima.parse(source);
window.tree.push(syntax.body.length);
}, {
'onComplete': function () {
setText(this.name + '-time', (1000 * this.stats.mean).toFixed(1));
setText(this.name + '-variance', (1000 * this.stats.variance).toFixed(1));
totalTime += this.stats.mean;
}
});
window.setTimeout(function () {
benchmark.run();
index += 1;
window.setTimeout(run, 211);
}, 211);
}
disableRunButtons();
setText('status', 'Please wait. Running benchmarks...');
reset();
run();
}
id('runquick').onclick = function () {
runBenchmarks(quickFixture);
};
id('runfull').onclick = function () {
runBenchmarks(fullFixture);
};
setText('benchmarkjs-version', ' version ' + window.Benchmark.version);
setText('version', window.esprima.version);
createTable();
disableRunButtons();
loadTests();
};
} else {
(function (global) {
'use strict';
var Benchmark,
esprima,
dirname,
option,
fs,
readFileSync,
log;
if (typeof require === 'undefined') {
dirname = 'test';
load(dirname + '/3rdparty/benchmark.js');
load(dirname + '/../esprima.js');
Benchmark = global.Benchmark;
esprima = global.esprima;
readFileSync = global.read;
log = print;
} else {
Benchmark = require('./3rdparty/benchmark');
esprima = require('../esprima');
fs = require('fs');
option = process.argv[2];
readFileSync = function readFileSync(filename) {
return fs.readFileSync(filename, 'utf-8');
};
dirname = __dirname;
log = console.log.bind(console);
}
function runTests(tests) {
var index,
tree = [],
totalTime = 0,
totalSize = 0;
tests.reduce(function (suite, filename) {
var source = readFileSync(dirname + '/3rdparty/' + slug(filename) + '.js'),
size = source.length;
totalSize += size;
return suite.add(filename, function () {
var syntax = esprima.parse(source);
tree.push(syntax.body.length);
}, {
'onComplete': function (event, bench) {
log(this.name +
' size ' + kb(size) +
' time ' + (1000 * this.stats.mean).toFixed(1) +
' variance ' + (1000 * 1000 * this.stats.variance).toFixed(1));
totalTime += this.stats.mean;
}
});
}, new Benchmark.Suite()).on('complete', function () {
log('Total size ' + kb(totalSize) +
' time ' + (1000 * totalTime).toFixed(1));
}).run();
}
if (option === 'quick') {
runTests(quickFixture);
} else {
runTests(fullFixture);
}
}(this));
}
/* vim: set sw=4 ts=4 et tw=80 : */
``` | /content/code_sandbox/node_modules/esprima-fb/test/benchmarks.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,176 |
```html
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Esprima: Unit Tests</title>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="../assets/style.css">
<link rel="stylesheet" href="../assets/foundation/foundation.min.css">
<style>iframe { border: solid 1px #ddd; }</style>
</head>
<body>
<!-- Navigation bar -->
<div class="row">
<div class="twelve columns">
<nav class="top-bar">
<ul>
<li class="name">
<h1><a href="../index.html">Esprima</a></h1>
</li>
</ul>
<section>
<ul class="right">
<li class="divider show-for-medium-and-up"></li>
<li class="has-dropdown">
<a href="../demo/index.html">Demo</a>
<ul class="dropdown">
<li><label>Static Analysis</label></li>
<li><a href="../demo/parse.html">Online Parsing</a></li>
<li><a href="../demo/validate.html">Syntax Validator</a></li>
<li><a href="../demo/precedence.html">Operator Precedence</a></li>
<li><a href="../demo/collector.html">Regex Collector</a></li>
<li><label>Dynamic Tracing</label></li>
<li><a href="../demo/functiontrace.html">Function Instrumentation</a></li>
<li><label>Code Transformation</label></li>
<li><a href="../demo/rewrite.html">Source Rewrite</a></li>
<li><a href="../demo/minify.html">Minifiy & Obfuscate</a></li>
<li><label>Editing Tools</label></li>
<li><a href="../demo/highlight.html">Identifier Highlight</a></li>
<li><a href="../demo/autocomplete.html">Autocomplete</a></li>
</ul>
</li>
<li class="has-dropdown">
<a href="#">Project</a>
<ul class="dropdown">
<li><a href="path_to_url">Git Repository</a></li>
<li><a href="path_to_url">Continuous Integration</a></li>
<li><a href="path_to_url">Mailing List</a></li>
<li><a href="path_to_url">Issue Tracker</a></li>
<li class="divider"></li>
<li><label>QA</label></li>
<li><a href="../test/index.html">Unit Tests</a></li>
<li><a href="../test/benchmarks.html">Benchmarks Suite</a></li>
<li><a href="../test/compat.html">Compatibility Tests</a></li>
<li><a href="../test/compare.html">Speed Comparison</a></li>
<li><a href="../test/module.html">Module Loading</a></li>
<li><a href="../test/coverage.html">Coverage Analysis</a></li>
</ul>
</li>
<li><a href="../doc/index.html">Documentation</a></li>
</ul>
</section>
</nav>
</div>
</div>
<!-- Title and subtitle -->
<div class="row">
<div class="twelve columns">
<h3 class="subheader"><strong>Coverage Analysis</strong> ensures systematic exercise of the parser</h3>
</div>
</div>
<!-- Main content -->
<div class="row">
<div class="twelve columns">
<p><strong>Note</strong>: This is not a live (in-browser) code coverage report.
The analysis is <a href="../doc/index.html#coverage"> offline</a>
(using <a href="path_to_url">Istanbul</a>).</p>
<iframe src="esprima.js.html" width="100%" height="800px"></iframe>
</div>
</div>
<!-- Footer -->
<div class="row copyright">
<div class="six columns">
<p>Esprima is created and mantained by <a href="path_to_url">Ariya Hidayat</a>.</p>
</div>
<div class="six columns">
<ul class="link-list right">
<li><a href="path_to_url">@Esprima</a></li>
<li><a href="path_to_url">GitHub</a></li>
</ul>
</div>
</div>
<script src="../esprima.js"></script>
<script src="../assets/json2.js"></script>
<script src="test.js"></script>
<script src="runner.js"></script>
<script>
/*jslint browser: true */
window.onload = window.runTests;
</script>
</body>
</html>
``` | /content/code_sandbox/node_modules/esprima-fb/test/coverage.html | html | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,131 |
```javascript
var testFixture;
var fbTestFixture = {
'XJS': {
'<a />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: true,
attributes: [],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
children: [],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'<n:a n:v />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
namespace: "n",
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
}
},
selfClosing: true,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "v",
namespace: "n",
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
},
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
}
],
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
children: [],
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'<a n:foo="bar"> {value} <b><c /></b></a>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: false,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "foo",
namespace: "n",
range: [3, 8],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 8 }
}
},
value: {
type: "Literal",
value: "bar",
raw: "\"bar\"",
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
range: [3, 14],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 14 }
}
}
],
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [38, 39],
loc: {
start: { line: 1, column: 38 },
end: { line: 1, column: 39 }
}
},
range: [36, 40],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 40 }
}
},
children: [
{
type: "Literal",
value: " ",
raw: " ",
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
{
type: "XJSExpressionContainer",
expression: {
type: "Identifier",
name: "value",
range: [17, 22],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 22 }
}
},
range: [16, 23],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 23 }
}
},
{
type: "Literal",
value: " ",
raw: " ",
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
{
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "b",
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
selfClosing: false,
attributes: [],
range: [24, 27],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 27 }
}
},
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "b",
range: [34, 35],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 35 }
}
},
range: [32, 36],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 36 }
}
},
children: [
{
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "c",
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
},
selfClosing: true,
attributes: [],
range: [27, 32],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 32 }
}
},
children: [],
range: [27, 32],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 32 }
}
}
],
range: [24, 36],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 36 }
}
}
],
range: [0, 40],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 40 }
}
},
range: [0, 40],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 40 }
}
},
'<a b={" "} c=" " d="&" />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: true,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "b",
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: "XJSExpressionContainer",
expression: {
type: "Literal",
value: " ",
raw: "\" \"",
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
range: [5, 10],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
range: [3, 10],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 10 }
}
},
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "c",
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
value: {
type: "Literal",
value: " ",
raw: "\" \"",
range: [13, 16],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 16 }
}
},
range: [11, 16],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 16 }
}
},
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "d",
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
value: {
type: "Literal",
value: "&",
raw: "\"&\"",
range: [19, 26],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 26 }
}
},
range: [17, 26],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 26 }
}
}
],
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
children: [],
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'<a\n/>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [
1,
2
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 2
}
}
},
selfClosing: true,
attributes: [],
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 2,
column: 2
}
}
},
children: [],
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 2,
column: 2
}
}
},
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 2,
column: 2
}
}
},
'<></>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "",
range: [
1,
4
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 4
}
}
},
selfClosing: false,
attributes: [],
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 5
}
}
},
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "",
range: [
7,
10
],
loc: {
start: {
line: 1,
column: 7
},
end: {
line: 1,
column: 10
}
}
},
range: [
5,
11
],
loc: {
start: {
line: 1,
column: 5
},
end: {
line: 1,
column: 11
}
}
},
children: [],
range: [
0,
11
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 11
}
}
},
range: [
0,
11
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 11
}
}
},
'<AbC-def\n test="&&">\nbar\nbaz\n</AbC-def>': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "AbC-def",
range: [
1,
8
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 8
}
}
},
selfClosing: false,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "test",
range: [
11,
15
],
loc: {
start: {
line: 2,
column: 2
},
end: {
line: 2,
column: 6
}
}
},
value: {
type: "Literal",
value: "&&",
raw: "\"&&\"",
range: [
16,
31
],
loc: {
start: {
line: 2,
column: 7
},
end: {
line: 2,
column: 22
}
}
},
range: [
11,
31
],
loc: {
start: {
line: 2,
column: 2
},
end: {
line: 2,
column: 22
}
}
}
],
range: [
0,
32
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 2,
column: 23
}
}
},
closingElement: {
type: "XJSClosingElement",
name: {
type: "XJSIdentifier",
name: "AbC-def",
range: [
43,
50
],
loc: {
start: {
line: 5,
column: 2
},
end: {
line: 5,
column: 9
}
}
},
range: [
41,
51
],
loc: {
start: {
line: 5,
column: 0
},
end: {
line: 5,
column: 10
}
}
},
children: [
{
type: "Literal",
value: "\nbar\nbaz\n",
raw: "\nbar\nbaz\n",
range: [
32,
41
],
loc: {
start: {
line: 2,
column: 23
},
end: {
line: 5,
column: 0
}
}
}
],
range: [
0,
51
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 5,
column: 10
}
}
},
range: [
0,
51
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 5,
column: 10
}
}
},
'<a b={x ? <c /> : <d />} />': {
type: "ExpressionStatement",
expression: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "a",
range: [
1,
2
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 2
}
}
},
selfClosing: true,
attributes: [
{
type: "XJSAttribute",
name: {
type: "XJSIdentifier",
name: "b",
range: [
3,
4
],
loc: {
start: {
line: 1,
column: 3
},
end: {
line: 1,
column: 4
}
}
},
value: {
type: "XJSExpressionContainer",
expression: {
type: "ConditionalExpression",
test: {
type: "Identifier",
name: "x",
range: [
6,
7
],
loc: {
start: {
line: 1,
column: 6
},
end: {
line: 1,
column: 7
}
}
},
consequent: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "c",
range: [
11,
12
],
loc: {
start: {
line: 1,
column: 11
},
end: {
line: 1,
column: 12
}
}
},
selfClosing: true,
attributes: [],
range: [
10,
15
],
loc: {
start: {
line: 1,
column: 10
},
end: {
line: 1,
column: 15
}
}
},
children: [],
range: [
10,
15
],
loc: {
start: {
line: 1,
column: 10
},
end: {
line: 1,
column: 15
}
}
},
alternate: {
type: "XJSElement",
openingElement: {
type: "XJSOpeningElement",
name: {
type: "XJSIdentifier",
name: "d",
range: [
19,
20
],
loc: {
start: {
line: 1,
column: 19
},
end: {
line: 1,
column: 20
}
}
},
selfClosing: true,
attributes: [],
range: [
18,
23
],
loc: {
start: {
line: 1,
column: 18
},
end: {
line: 1,
column: 23
}
}
},
children: [],
range: [
18,
23
],
loc: {
start: {
line: 1,
column: 18
},
end: {
line: 1,
column: 23
}
}
},
range: [
6,
23
],
loc: {
start: {
line: 1,
column: 6
},
end: {
line: 1,
column: 23
}
}
},
range: [
5,
24
],
loc: {
start: {
line: 1,
column: 5
},
end: {
line: 1,
column: 24
}
}
},
range: [
3,
24
],
loc: {
start: {
line: 1,
column: 3
},
end: {
line: 1,
column: 24
}
}
}
],
range: [
0,
27
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 27
}
}
},
children: [],
range: [
0,
27
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 27
}
}
},
range: [
0,
27
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 27
}
}
},
'<a>{}</a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: false,
attributes: [],
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [5, 9],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 9 }
}
},
children: [{
type: 'XJSExpressionContainer',
expression: {
type: 'XJSEmptyExpression',
range: [4, 4],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 4 }
}
},
range: [3, 5],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 5 }
}
}],
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'<a>{/* this is a comment */}</a>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
selfClosing: false,
attributes: [],
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'a',
range: [30, 31],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 31 }
}
},
range: [28, 32],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 32 }
}
},
children: [{
type: 'XJSExpressionContainer',
expression: {
type: 'XJSEmptyExpression',
range: [4, 27],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 27 }
}
},
range: [3, 28],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 28 }
}
}],
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
'<div>@test content</div>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
}
},
selfClosing: false,
attributes: [],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [20, 23],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 23 }
}
},
range: [18, 24],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 24 }
}
},
children: [{
type: 'Literal',
value: '@test content',
raw: '@test content',
range: [5, 18],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 18 }
}
}],
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'<div><br />7x invalid-js-identifier</div>': {
type: 'ExpressionStatement',
expression: {
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [
1,
4
],
loc: {
start: {
line: 1,
column: 1
},
end: {
line: 1,
column: 4
}
}
},
selfClosing: false,
attributes: [],
range: [
0,
5
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 5
}
}
},
closingElement: {
type: 'XJSClosingElement',
name: {
type: 'XJSIdentifier',
name: 'div',
range: [
37,
40
],
loc: {
start: {
line: 1,
column: 37
},
end: {
line: 1,
column: 40
}
}
},
range: [
35,
41
],
loc: {
start: {
line: 1,
column: 35
},
end: {
line: 1,
column: 41
}
}
},
children: [{
type: 'XJSElement',
openingElement: {
type: 'XJSOpeningElement',
name: {
type: 'XJSIdentifier',
name: 'br',
range: [
6,
8
],
loc: {
start: {
line: 1,
column: 6
},
end: {
line: 1,
column: 8
}
}
},
selfClosing: true,
attributes: [],
range: [
5,
11
],
loc: {
start: {
line: 1,
column: 5
},
end: {
line: 1,
column: 11
}
}
},
children: [],
range: [
5,
11
],
loc: {
start: {
line: 1,
column: 5
},
end: {
line: 1,
column: 11
}
}
}, {
type: 'Literal',
value: '7x invalid-js-identifier',
raw: '7x invalid-js-identifier',
range: [
11,
35
],
loc: {
start: {
line: 1,
column: 11
},
end: {
line: 1,
column: 35
}
}
}],
range: [
0,
41
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 41
}
}
},
range: [
0,
41
],
loc: {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 41
}
}
},
'<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />': {
"type": "ExpressionStatement",
"expression": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "LeftRight",
"range": [
1,
10
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 10
}
}
},
"selfClosing": true,
"attributes": [
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "left",
"range": [
11,
15
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 15
}
}
},
"value": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "a",
"range": [
17,
18
],
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 18
}
}
},
"selfClosing": true,
"attributes": [],
"range": [
16,
21
],
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 21
}
}
},
"children": [],
"range": [
16,
21
],
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 21
}
}
},
"range": [
11,
21
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 21
}
}
},
{
"type": "XJSAttribute",
"name": {
"type": "XJSIdentifier",
"name": "right",
"range": [
22,
27
],
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 27
}
}
},
"value": {
"type": "XJSElement",
"openingElement": {
"type": "XJSOpeningElement",
"name": {
"type": "XJSIdentifier",
"name": "b",
"range": [
29,
30
],
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 30
}
}
},
"selfClosing": false,
"attributes": [],
"range": [
28,
31
],
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 31
}
}
},
"closingElement": {
"type": "XJSClosingElement",
"name": {
"type": "XJSIdentifier",
"name": "b",
"range": [
52,
53
],
"loc": {
"start": {
"line": 1,
"column": 52
},
"end": {
"line": 1,
"column": 53
}
}
},
"range": [
50,
54
],
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 54
}
}
},
"children": [
{
"type": "Literal",
"value": "monkeys /> gorillas",
"raw": "monkeys /> gorillas",
"range": [
31,
50
],
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 50
}
}
}
],
"range": [
28,
54
],
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 54
}
}
},
"range": [
22,
54
],
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 54
}
}
}
],
"range": [
0,
57
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
}
},
"children": [],
"range": [
0,
57
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
}
},
"range": [
0,
57
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
}
}
},
'Invalid XJS Syntax': {
'</>': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token /',
description: 'Unexpected token /'
},
'<a: />': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: XJS tag name can not be empty'
},
'<:a />': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token :',
description: 'Unexpected token :'
},
'<a b=d />': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: XJS value should be either an expression or a quoted XJS text'
},
'<a>': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected end of input'
},
'<a></b>': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Expected corresponding XJS closing tag for a'
},
'<a foo="bar': {
index: 11,
lineNumber: 1,
column: 12,
message: "Error: Line 1: Unexpected token ILLEGAL"
},
'<a:b></b>': {
index: 9,
lineNumber: 1,
column: 10,
message: "Error: Line 1: Expected corresponding XJS closing tag for a:b",
},
'<a><a />': {
index: 8,
lineNumber: 1,
column: 9,
message: 'Error: Line 1: Unexpected end of input'
},
'<a b={}>': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: XJS attributes must only be assigned a non-empty expression'
},
'<a>{"str";}</a>': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token ;',
description: 'Unexpected token ;'
},
'<span className="a", id="b" />': {
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Unexpected token ,',
description: 'Unexpected token ,'
},
'<div className"app">': {
index: 14,
lineNumber: 1,
column: 15,
message: 'Error: Line 1: Unexpected string',
description: 'Unexpected string'
}
},
'Type Annotations': {
'function foo(numVal: number){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'numVal',
range: [13, 19],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 19 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [21, 27],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 27 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
},
range: [13, 27],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 27 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [28, 30],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 30 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
'function foo(numVal: number, strVal: string){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'numVal',
range: [13, 19],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 19 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [21, 27],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 27 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
},
range: [13, 27],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 27 }
}
}, {
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'strVal',
range: [29, 35],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 35 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'string',
range: [37, 43],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 43 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [35, 43],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 43 }
}
},
range: [29, 43],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 43 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [44, 46],
loc: {
start: { line: 1, column: 44 },
end: { line: 1, column: 46 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 46],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 46 }
}
},
'function foo(numVal: number, untypedVal){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'numVal',
range: [13, 19],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 19 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [21, 27],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 27 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
},
range: [13, 27],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 27 }
}
}, {
type: 'Identifier',
name: 'untypedVal',
range: [29, 39],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 39 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [40, 42],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 42 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 42],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 42 }
}
},
'function foo(untypedVal, numVal: number){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'Identifier',
name: 'untypedVal',
range: [13, 23],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 23 }
}
}, {
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'numVal',
range: [25, 31],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 31 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [33, 39],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 39 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [31, 39],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 39 }
}
},
range: [25, 39],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 39 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [40, 42],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 42 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 42],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 42 }
}
},
'function foo(nullableNum: ?number){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'nullableNum',
range: [13, 24],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 24 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [27, 33],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 33 }
}
},
paramTypes: null,
returnType: null,
nullable: true,
range: [24, 33],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 33 }
}
},
range: [13, 33],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 33 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'function foo(callback: () => void){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'callback',
range: [13, 21],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
annotation: {
type: 'TypeAnnotation',
id: null,
paramTypes: [],
returnType: null,
nullable: false,
range: [21, 33],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 33 }
}
},
range: [13, 33],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 33 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'function foo(callback: () => number){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'callback',
range: [13, 21],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
annotation: {
type: 'TypeAnnotation',
id: null,
paramTypes: [],
returnType: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [29, 35],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 35 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [29, 35],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 35 }
}
},
nullable: false,
range: [21, 35],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 35 }
}
},
range: [13, 35],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 35 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [36, 38],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 38 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'function foo(callback: (bool) => number){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'callback',
range: [13, 21],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
annotation: {
type: 'TypeAnnotation',
id: null,
paramTypes: [{
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'bool',
range: [24, 28],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 28 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [24, 28],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 28 }
}
}],
returnType: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [33, 39],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 39 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [33, 39],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 39 }
}
},
nullable: false,
range: [21, 39],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 39 }
}
},
range: [13, 39],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 39 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [40, 42],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 42 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 42],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 42 }
}
},
'function foo(callback: (bool, string) => number){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'callback',
range: [13, 21],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
annotation: {
type: 'TypeAnnotation',
id: null,
paramTypes: [{
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'bool',
range: [24, 28],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 28 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [24, 28],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 28 }
}
}, {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'string',
range: [30, 36],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 36 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [30, 36],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 36 }
}
}],
returnType: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [41, 47],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 47 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [41, 47],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 47 }
}
},
nullable: false,
range: [21, 47],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 47 }
}
},
range: [13, 47],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 47 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [48, 50],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 50 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 50],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 50 }
}
},
'function foo():number{}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [21, 23],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 23 }
}
},
rest: null,
generator: false,
expression: false,
returnType: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [15, 21],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 21 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [14, 21],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 21 }
}
},
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
'function foo():() => void{}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [25, 27],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 27 }
}
},
rest: null,
generator: false,
expression: false,
returnType: {
type: 'TypeAnnotation',
id: null,
paramTypes: [],
returnType: null,
nullable: false,
range: [14, 25],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 25 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'function foo():(bool) => number{}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [31, 33],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 33 }
}
},
rest: null,
generator: false,
expression: false,
returnType: {
type: 'TypeAnnotation',
id: null,
paramTypes: [{
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'bool',
range: [16, 20],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 20 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [16, 20],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 20 }
}
}],
returnType: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [25, 31],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 31 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [25, 31],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 31 }
}
},
nullable: false,
range: [14, 31],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 31 }
}
},
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
},
'a={set fooProp(value:number){}}': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'a',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'fooProp',
range: [7, 14],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'value',
range: [15, 20],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 20 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [21, 27],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 27 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
},
range: [15, 27],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 27 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [28, 30],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 30 }
}
},
rest: null,
generator: false,
expression: false,
range: [28, 30],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 30 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [3, 30],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 30 }
}
}],
range: [2, 31],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'class Foo {set fooProp(value:number){}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'Foo',
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'fooProp',
range: [15, 22],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 22 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'value',
range: [23, 28],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 28 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [29, 35],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 35 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [28, 35],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 35 }
}
},
range: [23, 35],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 35 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [36, 38],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 38 }
}
},
rest: null,
generator: false,
expression: false,
range: [36, 38],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 38 }
}
},
kind: 'set',
'static': false,
range: [11, 38],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 38 }
}
}],
range: [10, 39],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 39 }
}
},
range: [0, 39],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 39 }
}
},
'var numVal:number;': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'numVal',
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [11, 17],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 17 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [10, 17],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 17 }
}
},
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
init: null,
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
}],
kind: 'var',
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'var numVal:number = otherNumVal;': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'TypeAnnotatedIdentifier',
id: {
type: 'Identifier',
name: 'numVal',
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
annotation: {
type: 'TypeAnnotation',
id: {
type: 'Identifier',
name: 'number',
range: [11, 17],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 17 }
}
},
paramTypes: null,
returnType: null,
nullable: false,
range: [10, 17],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 17 }
}
},
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
init: {
type: 'Identifier',
name: 'otherNumVal',
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
},
range: [4, 31],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 31 }
}
}],
kind: 'var',
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
}
}
};
// Merge fbTestFixture in to testFixture
(function () {
'use strict';
var i, fixtures;
for (i in fbTestFixture) {
if (fbTestFixture.hasOwnProperty(i)) {
fixtures = fbTestFixture[i];
if (i !== 'Syntax' && testFixture.hasOwnProperty(i)) {
throw new Error('FB test should not replace existing test for ' + i);
}
testFixture[i] = fixtures;
}
}
}());
``` | /content/code_sandbox/node_modules/esprima-fb/test/fbtest.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 18,538 |
```html
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Esprima: Benchmarks</title>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="../assets/style.css">
<link rel="stylesheet" href="../assets/foundation/foundation.min.css">
</style>
</head>
<body>
<!-- Navigation bar -->
<div class="row">
<div class="twelve columns">
<nav class="top-bar">
<ul>
<li class="name">
<h1><a href="../index.html">Esprima</a></h1>
</li>
</ul>
<section>
<ul class="right">
<li class="divider show-for-medium-and-up"></li>
<li class="has-dropdown">
<a href="../demo/index.html">Demo</a>
<ul class="dropdown">
<li><label>Static Analysis</label></li>
<li><a href="../demo/parse.html">Online Parsing</a></li>
<li><a href="../demo/validate.html">Syntax Validator</a></li>
<li><a href="../demo/precedence.html">Operator Precedence</a></li>
<li><a href="../demo/collector.html">Regex Collector</a></li>
<li><label>Dynamic Tracing</label></li>
<li><a href="../demo/functiontrace.html">Function Instrumentation</a></li>
<li><label>Code Transformation</label></li>
<li><a href="../demo/rewrite.html">Source Rewrite</a></li>
<li><a href="../demo/minify.html">Minifiy & Obfuscate</a></li>
<li><label>Editing Tools</label></li>
<li><a href="../demo/highlight.html">Identifier Highlight</a></li>
<li><a href="../demo/autocomplete.html">Autocomplete</a></li>
</ul>
</li>
<li class="has-dropdown">
<a href="#">Project</a>
<ul class="dropdown">
<li><a href="path_to_url">Git Repository</a></li>
<li><a href="path_to_url">Continuous Integration</a></li>
<li><a href="path_to_url">Mailing List</a></li>
<li><a href="path_to_url">Issue Tracker</a></li>
<li class="divider"></li>
<li><label>QA</label></li>
<li><a href="../test/index.html">Unit Tests</a></li>
<li><a href="../test/benchmarks.html">Benchmarks Suite</a></li>
<li><a href="../test/compat.html">Compatibility Tests</a></li>
<li><a href="../test/compare.html">Speed Comparison</a></li>
<li><a href="../test/module.html">Module Loading</a></li>
<li><a href="../test/coverage.html">Coverage Analysis</a></li>
</ul>
</li>
<li><a href="../doc/index.html">Documentation</a></li>
</ul>
</section>
</nav>
</div>
</div>
<!-- Title and subtitle -->
<div class="row">
<div class="twelve columns">
<h3 class="subheader"><strong>Benchmarks</strong> show the true speed</h3>
</div>
</div>
<!-- Main content -->
<div class="row">
<div class="eight columns">
<p>
<input id="runquick" class="medium radius button secondary" type="submit" value="Run quick benchmarks" disabled/>
<input id="runfull" class="medium radius button" type="submit" value="Run full benchmarks" disabled/>
</p>
<p id="result"></p>
<div id="status" class="alert-box secondary">Please wait...</div>
</div>
<div class="four columns">
<div class="panel">
<p><strong>Note</strong>: On a modern machine and up-to-date web browsers,
the <strong>full</strong> benchmarks suite takes ~1 minute.
For the quick benchmarks, the running time is only ~15 seconds.</p>
<p>Version being tested: <strong><span id="version"></span></strong>.</p>
</div>
<p>Time measurement is carried out using <a href="path_to_url" target="_blank">Benchmark.js</a><span id="benchmarkjs-version"></span>.</p>
</div>
</div>
<!-- Footer -->
<div class="row copyright">
<div class="six columns">
<p>Esprima is created and mantained by <a href="path_to_url">Ariya Hidayat</a>.</p>
</div>
<div class="six columns">
<ul class="link-list right">
<li><a href="path_to_url">@Esprima</a></li>
<li><a href="path_to_url">GitHub</a></li>
</ul>
</div>
</div>
<script src="../esprima.js"></script>
<script src="../assets/json2.js"></script>
<script src="benchmarks.js"></script>
<script src="3rdparty/benchmark.js"></script>
<script src="3rdparty/XMLHttpRequest.js"></script>
<script>
/*jslint browser:true, sloppy:true */
/*global setupBenchmarks:true*/
window.onload = function () {
window.setTimeout(setupBenchmarks, 211);
};
</script>
</body>
</html>
``` | /content/code_sandbox/node_modules/esprima-fb/test/benchmarks.html | html | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,287 |
```javascript
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint node:true */
(function () {
'use strict';
var child = require('child_process'),
nodejs = '"' + process.execPath + '"',
ret = 0,
suites,
index;
suites = [
'runner',
'compat'
];
function nextTest() {
var suite = suites[index];
if (index < suites.length) {
child.exec(nodejs + ' ./test/' + suite + '.js', function (err, stdout, stderr) {
if (stdout) {
process.stdout.write(suite + ': ' + stdout);
}
if (stderr) {
process.stderr.write(suite + ': ' + stderr);
}
if (err) {
ret = err.code;
}
index += 1;
nextTest();
});
} else {
process.exit(ret);
}
}
index = 0;
nextTest();
}());
``` | /content/code_sandbox/node_modules/esprima-fb/test/run.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 446 |
```javascript
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint node: true */
/*global document: true, window:true, esprima: true, testReflect: true */
var runTests;
function getContext(esprima, reportCase, reportFailure) {
'use strict';
var Reflect, Pattern;
// Maps Mozilla Reflect object to our Esprima parser.
Reflect = {
parse: function (code) {
var result;
reportCase(code);
try {
result = esprima.parse(code);
} catch (error) {
result = error;
}
return result;
}
};
// This is used by Reflect test suite to match a syntax tree.
Pattern = function (obj) {
var pattern;
// Poor man's deep object cloning.
pattern = JSON.parse(JSON.stringify(obj));
// Special handling for regular expression literal since we need to
// convert it to a string literal, otherwise it will be decoded
// as object "{}" and the regular expression would be lost.
if (obj.type && obj.type === 'Literal') {
if (obj.value instanceof RegExp) {
pattern = {
type: obj.type,
value: obj.value.toString()
};
}
}
// Special handling for branch statement because SpiderMonkey
// prefers to put the 'alternate' property before 'consequent'.
if (obj.type && obj.type === 'IfStatement') {
pattern = {
type: pattern.type,
test: pattern.test,
consequent: pattern.consequent,
alternate: pattern.alternate
};
}
// Special handling for do while statement because SpiderMonkey
// prefers to put the 'test' property before 'body'.
if (obj.type && obj.type === 'DoWhileStatement') {
pattern = {
type: pattern.type,
body: pattern.body,
test: pattern.test
};
}
function adjustRegexLiteralAndRaw(key, value) {
if (key === 'value' && value instanceof RegExp) {
value = value.toString();
} else if (key === 'raw' && typeof value === "string") {
// Ignore Esprima-specific 'raw' property.
return undefined;
}
return value;
}
if (obj.type && (obj.type === 'Program')) {
pattern.assert = function (tree) {
var actual, expected;
actual = JSON.stringify(tree, adjustRegexLiteralAndRaw, 4);
expected = JSON.stringify(obj, null, 4);
if (expected !== actual) {
reportFailure(expected, actual);
}
};
}
return pattern;
};
return {
Reflect: Reflect,
Pattern: Pattern
};
}
if (typeof window !== 'undefined') {
// Run all tests in a browser environment.
runTests = function () {
'use strict';
var total = 0,
failures = 0;
function setText(el, str) {
if (typeof el.innerText === 'string') {
el.innerText = str;
} else {
el.textContent = str;
}
}
function reportCase(code) {
var report, e;
report = document.getElementById('report');
e = document.createElement('pre');
e.setAttribute('class', 'code');
setText(e, code);
report.appendChild(e);
total += 1;
}
function reportFailure(expected, actual) {
var report, e;
failures += 1;
report = document.getElementById('report');
e = document.createElement('p');
setText(e, 'Expected');
report.appendChild(e);
e = document.createElement('pre');
e.setAttribute('class', 'expected');
setText(e, expected);
report.appendChild(e);
e = document.createElement('p');
setText(e, 'Actual');
report.appendChild(e);
e = document.createElement('pre');
e.setAttribute('class', 'actual');
setText(e, actual);
report.appendChild(e);
}
setText(document.getElementById('version'), esprima.version);
window.setTimeout(function () {
var tick, context = getContext(esprima, reportCase, reportFailure);
tick = new Date();
testReflect(context.Reflect, context.Pattern);
tick = (new Date()) - tick;
if (failures > 0) {
document.getElementById('status').className = 'alert-box alert';
setText(document.getElementById('status'), total + ' tests. ' +
'Failures: ' + failures + '. ' + tick + ' ms');
} else {
document.getElementById('status').className = 'alert-box success';
setText(document.getElementById('status'), total + ' tests. ' +
'No failure. ' + tick + ' ms');
}
}, 11);
};
} else {
(function (global) {
'use strict';
var esprima = require('../esprima'),
tick,
total = 0,
failures = [],
header,
current,
context;
function reportCase(code) {
total += 1;
current = code;
}
function reportFailure(expected, actual) {
failures.push({
source: current,
expected: expected.toString(),
actual: actual.toString()
});
}
context = getContext(esprima, reportCase, reportFailure);
tick = new Date();
require('./reflect').testReflect(context.Reflect, context.Pattern);
tick = (new Date()) - tick;
header = total + ' tests. ' + failures.length + ' failures. ' +
tick + ' ms';
if (failures.length) {
console.error(header);
failures.forEach(function (failure) {
console.error(failure.source + ': Expected\n ' +
failure.expected.split('\n').join('\n ') +
'\nto match\n ' + failure.actual);
});
} else {
console.log(header);
}
process.exit(failures.length === 0 ? 0 : 1);
}(this));
}
/* vim: set sw=4 ts=4 et tw=80 : */
``` | /content/code_sandbox/node_modules/esprima-fb/test/compat.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,537 |
```javascript
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var testFixture;
var harmonyTestFixture = {
'ES6 Unicode Code Point Escape Sequence': {
'"\\u{714E}\\u{8336}"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: '',
raw: '"\\u{714E}\\u{8336}"',
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'"\\u{20BB7}\\u{91CE}\\u{5BB6}"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: '\ud842\udfb7\u91ce\u5bb6',
raw: '"\\u{20BB7}\\u{91CE}\\u{5BB6}"',
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
}
},
// ECMAScript 6th Syntax, 7.8.3 Numeric Literals
'ES6: Numeric Literal': {
'00': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '00',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'0o0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0o0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'function test() {\'use strict\'; 0o0; }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'test',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\'use strict\'',
range: [17, 29],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 29 }
}
},
range: [17, 30],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 30 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0o0',
range: [31, 34],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 34 }
}
},
range: [31, 35],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 35 }
}
}],
range: [16, 37],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
}
},
'0o2': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0o2',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0o12': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 10,
raw: '0o12',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0O0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0O0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'function test() {\'use strict\'; 0O0; }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'test',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\'use strict\'',
range: [17, 29],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 29 }
}
},
range: [17, 30],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 30 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0O0',
range: [31, 34],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 34 }
}
},
range: [31, 35],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 35 }
}
}],
range: [16, 37],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
}
},
'0O2': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0O2',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0O12': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 10,
raw: '0O12',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0b0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0b0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0b1': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 1,
raw: '0b1',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0b10': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0b10',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0B0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0B0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0B1': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 1,
raw: '0B1',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0B10': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '0B10',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}
},
// ECMAScript 6th Syntax, 11.1. 9 Template Literals
'ES6 Template Strings': {
'`42`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '42',
cooked: '42'
},
tail: true,
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}],
expressions: [],
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'raw`42`': {
type: 'ExpressionStatement',
expression: {
type: 'TaggedTemplateExpression',
tag: {
type: 'Identifier',
name: 'raw',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
quasi: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '42',
cooked: '42'
},
tail: true,
range: [3, 7],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 7 }
}
}],
expressions: [],
range: [3, 7],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'raw`hello ${name}`': {
type: 'ExpressionStatement',
expression: {
type: 'TaggedTemplateExpression',
tag: {
type: 'Identifier',
name: 'raw',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
quasi: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: 'hello ',
cooked: 'hello '
},
tail: false,
range: [3, 12],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 12 }
}
}, {
type: 'TemplateElement',
value: {
raw: '',
cooked: ''
},
tail: true,
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
}],
expressions: [{
type: 'Identifier',
name: 'name',
range: [12, 16],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 16 }
}
}],
range: [3, 18],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'`$`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '$',
cooked: '$'
},
tail: true,
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}],
expressions: [],
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '\\n\\r\\b\\v\\t\\f\\\n\\\r\n',
cooked: '\n\r\b\v\t\f'
},
tail: true,
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 19 }
}
}],
expressions: [],
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 19 }
}
},
'`\n\r\n`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '\n\r\n',
cooked: '\n\n'
},
tail: true,
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 5 }
}
}],
expressions: [],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 3, column: 5 }
}
},
'`\\u{000042}\\u0042\\x42\\u0\\102\\A`': {
type: 'ExpressionStatement',
expression: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '\\u{000042}\\u0042\\x42\\u0\\102\\A',
cooked: 'BBBu0BA'
},
tail: true,
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
}],
expressions: [],
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'new raw`42`': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'TaggedTemplateExpression',
tag: {
type: 'Identifier',
name: 'raw',
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
quasi: {
type: 'TemplateLiteral',
quasis: [{
type: 'TemplateElement',
value: {
raw: '42',
cooked: '42'
},
tail: true,
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
}],
expressions: [],
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
'arguments': [],
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
}
},
// ECMAScript 6th Syntax, 12.11 The switch statement
'ES6: Switch Case Declaration': {
'switch (answer) { case 42: let t = 42; break; }': {
type: 'SwitchStatement',
discriminant: {
type: 'Identifier',
name: 'answer',
range: [8, 14],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 14 }
}
},
cases: [{
type: 'SwitchCase',
test: {
type: 'Literal',
value: 42,
raw: '42',
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
consequent: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 't',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [35, 37],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 37 }
}
},
range: [31, 37],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 37 }
}
}],
kind: 'let',
range: [27, 38],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 38 }
}
}, {
type: 'BreakStatement',
label: null,
range: [39, 45],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 45 }
}
}],
range: [18, 45],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 45 }
}
}],
range: [0, 47],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 47 }
}
}
},
// ECMAScript 6th Syntax, 13.2 Arrow Function Definitions
'ES6: Arrow Function': {
'() => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'e => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [5, 11],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 11 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'(e) => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [7, 13],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 13 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'(a, b) => "test"': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}, {
type: 'Identifier',
name: 'b',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 'test',
raw: '"test"',
range: [10, 16],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 16 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'e => { 42; }': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [7, 9],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 9 }
}
},
range: [7, 10],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 10 }
}
}],
range: [5, 12],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 12 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'e => ({ property: 42 })': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'property',
range: [8, 16],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 16 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [8, 20],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 20 }
}
}],
range: [6, 22],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
// Not an object!
'e => { label: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'e',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'label',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
range: [14, 17],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 17 }
}
},
range: [7, 17],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 17 }
}
}],
range: [5, 18],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 18 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'(a, b) => { 42; }': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}, {
type: 'Identifier',
name: 'b',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [12, 15],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 15 }
}
}],
range: [10, 17],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'([a, , b]) => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
}, null, {
type: 'Identifier',
name: 'b',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
range: [1, 9],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 9 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'([a.a]) => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ArrayPattern',
elements: [{
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'a',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
},
property: {
type: 'Identifier',
name: 'a',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [2, 5],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 5 }
}
}],
range: [1, 6],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 6 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'(x=1) => x * x': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [{
type: 'Literal',
value: 1,
raw: '1',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
}],
body: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
right: {
type: 'Identifier',
name: 'x',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
// not strict mode, using eval
'eval => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'eval',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [8, 10],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 10 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
// not strict mode, using arguments
'arguments => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'arguments',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
// not strict mode, using octals
'(a) => 00': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 0,
raw: '00',
range: [7, 9],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 9 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
// not strict mode, using eval, IsSimpleParameterList is true
'(eval, a) => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'eval',
range: [1, 5],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 5 }
}
}, {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
// not strict mode, assigning to eval
'(eval = 10) => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'eval',
range: [1, 5],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 5 }
}
}],
defaults: [{
type: 'Literal',
value: 10,
raw: '10',
range: [8, 10],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 10 }
}
}],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
// not strict mode, using eval, IsSimpleParameterList is false
'(eval, a = 10) => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'eval',
range: [1, 5],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 5 }
}
}, {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
defaults: [null, {
type: 'Literal',
value: 10,
raw: '10',
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
}],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'(x => x)': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [],
body: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
rest: null,
generator: false,
expression: true,
range: [1, 7],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 7 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'x => y => 42': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
defaults: [],
body: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
rest: null,
generator: false,
expression: true,
range: [5, 12],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 12 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'(x) => ((y, z) => (x, y, z))': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [],
body: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'y',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}, {
type: 'Identifier',
name: 'z',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
}],
defaults: [],
body: {
type: 'SequenceExpression',
expressions: [{
type: 'Identifier',
name: 'x',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
}, {
type: 'Identifier',
name: 'y',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
}, {
type: 'Identifier',
name: 'z',
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
}],
range: [19, 26],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 26 }
}
},
rest: null,
generator: false,
expression: true,
range: [8, 27],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 27 }
}
},
rest: null,
generator: false,
expression: true,
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
},
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
},
'foo(() => {})': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'arguments': [{
type: 'ArrowFunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
rest: null,
generator: false,
expression: false,
range: [4, 12],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 12 }
}
}],
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'foo((x, y) => {})': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'arguments': [{
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'x',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}, {
type: 'Identifier',
name: 'y',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
rest: null,
generator: false,
expression: false,
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
}],
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
}
},
// ECMAScript 6th Syntax, 13.13 Method Definitions
'ES6: Method Definition': {
'x = { method() { } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'method',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [15, 18],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 18 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 18],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 18 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [6, 18],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 18 }
}
}],
range: [4, 20],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'x = { method(test) { } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'method',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'test',
range: [13, 17],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 17 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [19, 22],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [19, 22],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 22 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [6, 22],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 22 }
}
}],
range: [4, 24],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'x = { \'method\'() { } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 'method',
raw: '\'method\'',
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
},
rest: null,
generator: false,
expression: false,
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [6, 20],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 20 }
}
}],
range: [4, 22],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'x = { get() { } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'get',
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [12, 15],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 15 }
}
},
rest: null,
generator: false,
expression: false,
range: [12, 15],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 15 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'x = { set() { } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'set',
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [12, 15],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 15 }
}
},
rest: null,
generator: false,
expression: false,
range: [12, 15],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 15 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'x = { method() 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'method',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: true,
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [6, 17],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 17 }
}
}],
range: [4, 19],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'x = { get method() 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'method',
range: [10, 16],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 16 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'Literal',
value: 42,
raw: '42',
range: [19, 21],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 21 }
}
},
rest: null,
generator: false,
expression: true,
range: [19, 21],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 21 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 21],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 21 }
}
}],
range: [4, 23],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 23 }
}
},
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
'x = { set method(val) v = val }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'method',
range: [10, 16],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 16 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'val',
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
}],
defaults: [],
body: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'v',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
right: {
type: 'Identifier',
name: 'val',
range: [26, 29],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 29 }
}
},
range: [22, 29],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 29 }
}
},
rest: null,
generator: false,
expression: true,
range: [22, 29],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 29 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 29],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 29 }
}
}],
range: [4, 31],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
}
},
'Array Comprehension': {
'[[x,b,c] for (x in []) for (b in []) if (b && c)]' : {
type: 'ExpressionStatement',
expression: {
type: 'ComprehensionExpression',
filter: {
type: 'LogicalExpression',
operator: '&&',
left: {
type: 'Identifier',
name: 'b',
range: [41, 42],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 42 }
}
},
right: {
type: 'Identifier',
name: 'c',
range: [46, 47],
loc: {
start: { line: 1, column: 46 },
end: { line: 1, column: 47 }
}
},
range: [41, 47],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 47 }
}
},
blocks: [{
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'x',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [19, 21],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 21 }
}
},
each: false,
of: false
}, {
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'b',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [33, 35],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 35 }
}
},
each: false,
of: false
}],
body: {
type: 'ArrayExpression',
elements: [{
type: 'Identifier',
name: 'x',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
name: 'b',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Identifier',
name: 'c',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}],
range: [1, 8],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 8 }
}
},
range: [0, 49],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 49 }
}
},
range: [0, 49],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 49 }
}
},
'[x for (a in [])]' : {
type: 'ExpressionStatement',
expression: {
type: 'ComprehensionExpression',
filter: null,
blocks: [{
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'a',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
each: false,
of: false
}],
body: {
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'[1 for (x in [])]' : {
type: 'ExpressionStatement',
expression: {
type: 'ComprehensionExpression',
filter: null,
blocks: [{
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
each: false,
of: false
}],
body: {
type: 'Literal',
value: 1,
raw: '1',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'[(x,1) for (x in [])]' : {
type: 'ExpressionStatement',
expression: {
type: 'ComprehensionExpression',
filter: null,
blocks: [{
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'x',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
each: false,
of: false
}],
body: {
type: 'SequenceExpression',
expressions: [{
type: 'Identifier',
name: 'x',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
}, {
type: 'Literal',
value: 1,
raw: '1',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
range: [2, 5],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 5 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'[x for (x of array)]': {
type: 'ExpressionStatement',
expression: {
type: 'ComprehensionExpression',
filter: null,
blocks: [{
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
right: {
type: 'Identifier',
name: 'array',
range: [13, 18],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 18 }
}
},
of: true
}],
body: {
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'[x for (x of array) for (y of array2) if (x === test)]': {
type: 'ExpressionStatement',
expression: {
type: 'ComprehensionExpression',
filter: {
type: 'BinaryExpression',
operator: '===',
left: {
type: 'Identifier',
name: 'x',
range: [42, 43],
loc: {
start: { line: 1, column: 42 },
end: { line: 1, column: 43 }
}
},
right: {
type: 'Identifier',
name: 'test',
range: [48, 52],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 52 }
}
},
range: [42, 52],
loc: {
start: { line: 1, column: 42 },
end: { line: 1, column: 52 }
}
},
blocks: [{
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
right: {
type: 'Identifier',
name: 'array',
range: [13, 18],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 18 }
}
},
of: true
}, {
type: 'ComprehensionBlock',
left: {
type: 'Identifier',
name: 'y',
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
right: {
type: 'Identifier',
name: 'array2',
range: [30, 36],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 36 }
}
},
of: true
}],
body: {
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 54],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 54 }
}
},
range: [0, 54],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 54 }
}
}
},
// path_to_url#object_literal_property_value_shorthand
'Harmony: Object Literal Property Value Shorthand': {
'x = { y, z }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'y',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
value: {
type: 'Identifier',
name: 'y',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'z',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
value: {
type: 'Identifier',
name: 'z',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}],
range: [4, 12],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
}
},
// path_to_url
'Harmony: Destructuring': {
'[a, b] = [b, a]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}, {
type: 'Identifier',
name: 'b',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Identifier',
name: 'b',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
}, {
type: 'Identifier',
name: 'a',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
range: [9, 15],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'({ responseText: text }) = res': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'responseText',
range: [3, 15],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'Identifier',
name: 'text',
range: [17, 21],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 21 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [3, 21],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 21 }
}
}],
range: [1, 23],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 23 }
}
},
right: {
type: 'Identifier',
name: 'res',
range: [27, 30],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 30 }
}
},
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
'const {a} = {}': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
}],
kind: 'const',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'const [a] = []': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'ArrayExpression',
elements: [],
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
}],
kind: 'const',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'let {a} = {}': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [4, 12],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 12 }
}
}],
kind: 'let',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'let [a] = []': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'ArrayExpression',
elements: [],
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [4, 12],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 12 }
}
}],
kind: 'let',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'var {a} = {}': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [4, 12],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 12 }
}
}],
kind: 'var',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'var [a] = []': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'ArrayExpression',
elements: [],
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [4, 12],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 12 }
}
}],
kind: 'var',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'const {a:b} = {}': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [7, 10],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 10 }
}
}],
range: [6, 11],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 11 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
range: [6, 16],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 16 }
}
}],
kind: 'const',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'let {a:b} = {}': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
}],
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [4, 14],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 14 }
}
}],
kind: 'let',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'var {a:b} = {}': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
}],
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [4, 14],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 14 }
}
}],
kind: 'var',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
}
},
// path_to_url
'Harmony: Modules': {
'module "crypto" {}': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [7, 15],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 15 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [],
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'module crypto from "crypto";': {
type: 'ModuleDeclaration',
id: {
type: 'Identifier',
name: 'crypto',
range: [7, 13],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 13 }
}
},
source: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
},
body: null,
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
},
'module "crypto/e" {}': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'crypto/e',
raw: '"crypto/e"',
range: [7, 17],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 17 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [],
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'export var document': {
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [ 11, 19 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
},
init: null,
range: [ 11, 19 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
}],
kind: 'var',
range: [ 7, 19 ],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 19 }
}
},
specifiers: null,
source: null,
range: [ 0, 19 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'export var document = { }': {
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [ 11, 19 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [ 22, 25 ],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 25 }
}
},
range: [ 11, 25 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 25 }
}
}],
kind: 'var',
range: [ 7, 25 ],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 25 }
}
},
specifiers: null,
source: null,
range: [ 0, 25 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'export let document': {
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [ 11, 19 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
},
init: null,
range: [ 11, 19 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
}],
kind: 'let',
range: [ 7, 19 ],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 19 }
}
},
specifiers: null,
source: null,
range: [ 0, 19 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'export let document = { }': {
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [ 11, 19 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [ 22, 25 ],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 25 }
}
},
range: [ 11, 25 ],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 25 }
}
}],
kind: 'let',
range: [ 7, 25 ],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 25 }
}
},
specifiers: null,
source: null,
range: [ 0, 25 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'export const document = { }': {
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [ 13, 21 ],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [ 24, 27 ],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 27 }
}
},
range: [ 13, 27 ],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 27 }
}
}],
kind: 'const',
range: [ 7, 27 ],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 27 }
}
},
specifiers: null,
source: null,
range: [ 0, 27 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'export function parse() { }': {
type: 'ExportDeclaration',
declaration: {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'parse',
range: [ 16, 21 ],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 21 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [ 24, 27 ],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 27 }
}
},
rest: null,
generator: false,
expression: false,
range: [ 7, 27 ],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 27 }
}
},
specifiers: null,
source: null,
range: [ 0, 27 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'export class Class {}': {
type: 'ExportDeclaration',
declaration: {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'Class',
range: [ 13, 18 ],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 18 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [],
range: [ 19, 21 ],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 21 }
}
},
range: [ 7, 21 ],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 21 }
}
},
specifiers: null,
source: null,
range: [ 0, 21 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'export default = 42': {
type: 'ExportDeclaration',
declaration: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'default',
range: [7, 14],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 14 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
range: [7, 19],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 19 }
}
}],
specifiers: null,
source: null,
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'export *': {
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportBatchSpecifier',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
source: null,
range: [ 0, 8 ],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'export * from "crypto"': {
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportBatchSpecifier',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
source: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [14, 22],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'export { encrypt }': {
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
},
name: null,
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
}],
source: null,
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'export { encrypt, decrypt }': {
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
},
name: null,
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
}, {
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'decrypt',
range: [18, 25],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 25 }
}
},
name: null,
range: [18, 25],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 25 }
}
}],
source: null,
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'export { encrypt as default }': {
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
},
name: {
type: 'Identifier',
name: 'default',
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
},
range: [9, 27],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 27 }
}
}],
source: null,
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'export { encrypt, decrypt as dec }': {
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
},
name: null,
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
}, {
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'decrypt',
range: [18, 25],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 25 }
}
},
name: {
type: 'Identifier',
name: 'dec',
range: [29, 32],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 32 }
}
},
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
}],
source: null,
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'module "lib" { export var document }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [26, 34],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 34 }
}
},
init: null,
range: [26, 34],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 34 }
}
}],
kind: 'var',
range: [22, 35],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 35 }
}
},
specifiers: null,
source: null,
range: [15, 35],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 35 }
}
}],
range: [13, 36],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'module "lib" { export var document = { } }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [26, 34],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 34 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [37, 40],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 40 }
}
},
range: [26, 40],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 40 }
}
}],
kind: 'var',
range: [22, 41],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 41 }
}
},
specifiers: null,
source: null,
range: [15, 41],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 41 }
}
}],
range: [13, 42],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 42 }
}
},
range: [0, 42],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 42 }
}
},
'module "lib" { export let document }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [26, 34],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 34 }
}
},
init: null,
range: [26, 34],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 34 }
}
}],
kind: 'let',
range: [22, 35],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 35 }
}
},
specifiers: null,
source: null,
range: [15, 35],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 35 }
}
}],
range: [13, 36],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'module "lib" { export let document = { } }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [26, 34],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 34 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [37, 40],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 40 }
}
},
range: [26, 40],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 40 }
}
}],
kind: 'let',
range: [22, 41],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 41 }
}
},
specifiers: null,
source: null,
range: [15, 41],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 41 }
}
}],
range: [13, 42],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 42 }
}
},
range: [0, 42],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 42 }
}
},
'module "lib" { export const document = { } }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'document',
range: [28, 36],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 36 }
}
},
init: {
type: 'ObjectExpression',
properties: [],
range: [39, 42],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 42 }
}
},
range: [28, 42],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 42 }
}
}],
kind: 'const',
range: [22, 43],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 43 }
}
},
specifiers: null,
source: null,
range: [15, 43],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 43 }
}
}],
range: [13, 44],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 44 }
}
},
range: [0, 44],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 44 }
}
},
'module "lib" { export function parse() { } }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'parse',
range: [31, 36],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 36 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [39, 42],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 42 }
}
},
rest: null,
generator: false,
expression: false,
range: [22, 42],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 42 }
}
},
specifiers: null,
source: null,
range: [15, 42],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 42 }
}
}],
range: [13, 44],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 44 }
}
},
range: [0, 44],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 44 }
}
},
'module "lib" { export class Class {} }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'Class',
range: [28, 33],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 33 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [],
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
range: [22, 36],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 36 }
}
},
specifiers: null,
source: null,
range: [15, 36],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 36 }
}
}],
range: [13, 38],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 38 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'module "lib" { export * }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'lib',
raw: '"lib"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportBatchSpecifier',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
}],
source: null,
range: [15, 24],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 24 }
}
}],
range: [13, 25],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 25 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'module "security" { export * from "crypto" }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'security',
raw: '"security"',
range: [7, 17],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 17 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportBatchSpecifier',
range: [27, 28],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 28 }
}
}],
source: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [34, 42],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 42 }
}
},
range: [20, 43],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 43 }
}
}],
range: [18, 44],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 44 }
}
},
range: [0, 44],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 44 }
}
},
'module "crypto" { export { encrypt } }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [7, 15],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 15 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
name: null,
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
}],
source: null,
range: [18, 37],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 37 }
}
}],
range: [16, 38],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 38 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'module "crypto" { export { encrypt, decrypt } }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [7, 15],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 15 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
name: null,
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
}, {
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'decrypt',
range: [36, 43],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 43 }
}
},
name: null,
range: [36, 43],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 43 }
}
}],
source: null,
range: [18, 46],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 46 }
}
}],
range: [16, 47],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 47 }
}
},
range: [0, 47],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 47 }
}
},
'module "crypto" { export { encrypt, decrypt as dec } }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [7, 15],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 15 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExportDeclaration',
declaration: null,
specifiers: [{
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
name: null,
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
}, {
type: 'ExportSpecifier',
id: {
type: 'Identifier',
name: 'decrypt',
range: [36, 43],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 43 }
}
},
name: {
type: 'Identifier',
name: 'dec',
range: [47, 50],
loc: {
start: { line: 1, column: 47 },
end: { line: 1, column: 50 }
}
},
range: [36, 50],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 50 }
}
}],
source: null,
range: [18, 53],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 53 }
}
}],
range: [16, 54],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 54 }
}
},
range: [0, 54],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 54 }
}
},
'import "jquery"': {
type: 'ImportDeclaration',
specifiers: [],
source: {
type: 'Literal',
value: 'jquery',
raw: '"jquery"',
range: [7, 15],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'import $ from "jquery"': {
type: 'ImportDeclaration',
specifiers: [{
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: '$',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
name: null,
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
kind: 'default',
source: {
type: 'Literal',
value: 'jquery',
raw: '"jquery"',
range: [14, 22],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'import { encrypt, decrypt } from "crypto"': {
type: 'ImportDeclaration',
specifiers: [{
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
},
name: null,
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
}, {
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'decrypt',
range: [18, 25],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 25 }
}
},
name: null,
range: [18, 25],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 25 }
}
}],
kind: 'named',
source: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [33, 41],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 41 }
}
},
range: [0, 41],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 41 }
}
},
'import { encrypt as enc } from "crypto"': {
type: 'ImportDeclaration',
specifiers: [{
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
},
name: {
type: 'Identifier',
name: 'enc',
range: [20, 23],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 23 }
}
},
range: [9, 23],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 23 }
}
}],
kind: 'named',
source: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [31, 39],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 39 }
}
},
range: [0, 39],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 39 }
}
},
'import { decrypt, encrypt as enc } from "crypto"': {
type: 'ImportDeclaration',
specifiers: [{
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'decrypt',
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
},
name: null,
range: [9, 16],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 16 }
}
}, {
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'encrypt',
range: [18, 25],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 25 }
}
},
name: {
type: 'Identifier',
name: 'enc',
range: [29, 32],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 32 }
}
},
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
}],
kind: 'named',
source: {
type: 'Literal',
value: 'crypto',
raw: '"crypto"',
range: [40, 48],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 48 }
}
},
range: [0, 48],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 48 }
}
},
'import default from "foo"': {
type: 'ImportDeclaration',
specifiers: [{
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'default',
range: [7, 14],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 14 }
}
},
name: null,
range: [7, 14],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 14 }
}
}],
kind: 'default',
source: {
type: 'Literal',
value: 'foo',
raw: '"foo"',
range: [20, 25],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 25 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'import { null as nil } from "bar"': {
type: 'ImportDeclaration',
specifiers: [{
type: 'ImportSpecifier',
id: {
type: 'Identifier',
name: 'null',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
name: {
type: 'Identifier',
name: 'nil',
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
},
range: [9, 20],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 20 }
}
}],
kind: 'named',
source: {
type: 'Literal',
value: 'bar',
raw: '"bar"',
range: [28, 33],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 33 }
}
},
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
},
'module "security" { import "cryto" }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'security',
raw: '"security"',
range: [7, 17],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 17 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ImportDeclaration',
specifiers: [],
source: {
type: 'Literal',
value: 'cryto',
raw: '"cryto"',
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
range: [20, 35],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 35 }
}
}],
range: [18, 36],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'module()': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'module',
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'arguments': [],
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'module "foo" { module() }': {
type: 'ModuleDeclaration',
id: {
type: 'Literal',
value: 'foo',
raw: '"foo"',
range: [7, 12],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 12 }
}
},
source: null,
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'module',
range: [15, 21],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 21 }
}
},
'arguments': [],
range: [15, 23],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 23 }
}
},
range: [15, 24],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 24 }
}
}],
range: [13, 25],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 25 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
}
},
// path_to_url
'Harmony: Yield Expression': {
'(function* () { yield v })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'YieldExpression',
argument: {
type: 'Identifier',
name: 'v',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
delegate: false,
range: [16, 23],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 23 }
}
},
range: [16, 24],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 24 }
}
}],
range: [14, 25],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 25 }
}
},
rest: null,
generator: true,
expression: false,
range: [1, 25],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 25 }
}
},
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'(function* () { yield *v })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'YieldExpression',
argument: {
type: 'Identifier',
name: 'v',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
delegate: true,
range: [16, 24],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 24 }
}
},
range: [16, 25],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 25 }
}
}],
range: [14, 26],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 26 }
}
},
rest: null,
generator: true,
expression: false,
range: [1, 26],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 26 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'function* test () { yield *v }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'test',
range: [10, 14],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 14}
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'YieldExpression',
argument: {
type: 'Identifier',
name: 'v',
range: [27, 28],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 28 }
}
},
delegate: true,
range: [20, 28],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 28 }
}
},
range: [20, 29],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 29 }
}
}],
range: [18, 30],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 30 }
}
},
rest: null,
generator: true,
expression: false,
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
'var x = { *test () { yield *v } };': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'test',
range: [11, 15],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'YieldExpression',
argument: {
type: 'Identifier',
name: 'v',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
},
delegate: true,
range: [21, 29],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 29 }
}
},
range: [21, 30],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 30 }
}
}],
range: [19, 31],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 31 }
}
},
rest: null,
generator: true,
expression: false,
range: [19, 31],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 31 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [10, 31],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 31 }
}
}],
range: [8, 33],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 33 }
}
},
range: [4, 33],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 33 }
}
}],
kind: 'var',
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'function* t() {}': {
type: 'Program',
body: [{
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 't',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
rest: null,
generator: true,
expression: false,
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
}],
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
},
errors: [{
index: 16,
lineNumber: 1,
column: 17,
message: 'Error: Line 1: Missing yield in generator'
}]
},
'(function* () { yield yield 10 })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'YieldExpression',
argument: {
type: 'YieldExpression',
argument: {
type: 'Literal',
value: 10,
raw: '10',
range: [28, 30],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 30 }
}
},
delegate: false,
range: [22, 30],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 30 }
}
},
delegate: false,
range: [16, 30],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 30 }
}
},
range: [16, 31],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 31 }
}
}],
range: [14, 32],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 32 }
}
},
rest: null,
generator: true,
expression: false,
range: [1, 32],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 32 }
}
},
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
}
},
// path_to_url
'Harmony: Iterators': {
'for(x of list) process(x);': {
type: 'ForOfStatement',
left: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [15, 22],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 22 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
}],
range: [15, 25],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 25 }
}
},
range: [15, 26],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 26 }
}
},
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'for (var x of list) process(x);': {
type: 'ForOfStatement',
left: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
init: null,
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}],
kind: 'var',
range: [5, 10],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
}],
range: [20, 30],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 30 }
}
},
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'for (var x = 42 of list) process(x);': {
type: 'ForOfStatement',
left: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
range: [9, 15],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 15 }
}
}],
kind: 'var',
range: [5, 15],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 15 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [19, 23],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 23 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [25, 32],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 32 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [33, 34],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 34 }
}
}],
range: [25, 35],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 35 }
}
},
range: [25, 36],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'for (let x of list) process(x);': {
type: 'ForOfStatement',
left: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
init: null,
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}],
kind: 'let',
range: [5, 10],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
}],
range: [20, 30],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 30 }
}
},
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
}
},
// path_to_url
'Harmony: Class (strawman)': {
'var A = class extends B {}': {
type: "VariableDeclaration",
declarations: [
{
type: "VariableDeclarator",
id: {
type: "Identifier",
name: "A",
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: "ClassExpression",
superClass: {
type: "Identifier",
name: "B",
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
body: {
type: "ClassBody",
body: [],
range: [24, 26],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 26 }
}
},
range: [8, 26],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 26 }
}
},
range: [4, 26],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 26 }
}
}
],
kind: "var",
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'class A extends class B extends C {} {}': {
type: "ClassDeclaration",
id: {
type: "Identifier",
name: "A",
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: {
type: "ClassExpression",
id: {
type: "Identifier",
name: "B",
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
superClass: null,
body: {
type: "ClassBody",
body: [],
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
superClass: {
type: "Identifier",
name: "C",
range: [32, 33],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 33 }
}
},
range: [16, 36],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 36 }
}
},
body: {
type: "ClassBody",
body: [],
range: [37, 39],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 39 }
}
},
range: [0, 39],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 39 }
}
},
'class A {get() {}}': {
type: "ClassDeclaration",
id: {
type: "Identifier",
name: "A",
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: "ClassBody",
body: [
{
type: "MethodDefinition",
key: {
type: "Identifier",
name: "get",
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
value: {
type: "FunctionExpression",
id: null,
params: [],
defaults: [],
body: {
type: "BlockStatement",
body: [],
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
kind: "",
'static': false,
range: [9, 17],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 17 }
}
}
],
range: [8, 18],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'class A { static get() {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'get',
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
rest: null,
generator: false,
expression: false,
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
kind: '',
'static': true,
range: [10, 25],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 25 }
}
}],
range: [8, 26],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 26 }
}
},
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'class A extends B {get foo() {}}': {
type: "ClassDeclaration",
id: {
type: "Identifier",
name: "A",
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: {
type: "Identifier",
name: "B",
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
body: {
type: "ClassBody",
body: [{
type: "MethodDefinition",
key: {
type: "Identifier",
name: "foo",
range: [23, 26],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 26 }
}
},
value: {
type: "FunctionExpression",
id: null,
params: [],
defaults: [],
body: {
type: "BlockStatement",
body: [],
range: [29, 31],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 31 }
}
},
rest: null,
generator: false,
expression: false,
range: [29, 31],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 31 }
}
},
kind: "get",
'static': false,
range: [19, 31],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 31 }
}
}],
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
},
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
'class A extends B { static get foo() {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: {
type: 'Identifier',
name: 'B',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [31, 34],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 34 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [37, 39],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 39 }
}
},
rest: null,
generator: false,
expression: false,
range: [37, 39],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 39 }
}
},
kind: 'get',
'static': true,
range: [20, 39],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 39 }
}
}],
range: [18, 40],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 40 }
}
},
range: [0, 40],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 40 }
}
},
'class A {set a(v) {}}': {
type: "ClassDeclaration",
id: {
type: "Identifier",
name: "A",
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: "ClassBody",
body: [
{
type: "MethodDefinition",
key: {
type: 'Identifier',
name: 'a',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
value: {
type: "FunctionExpression",
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}],
defaults: [],
body: {
type: "BlockStatement",
body: [],
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
kind: "set",
'static': false,
range: [9, 20],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 20 }
}
}
],
range: [8, 21],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'class A { static set a(v) {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'a',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [26, 28],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 28 }
}
},
rest: null,
generator: false,
expression: false,
range: [26, 28],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 28 }
}
},
kind: 'set',
'static': true,
range: [10, 28],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 28 }
}
}],
range: [8, 29],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 29 }
}
},
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'class A {set(v) {};}': {
type: "ClassDeclaration",
id: {
type: "Identifier",
name: "A",
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: "ClassBody",
body: [
{
type: "MethodDefinition",
key: {
type: "Identifier",
name: "set",
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
value: {
type: "FunctionExpression",
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
defaults: [],
body: {
type: "BlockStatement",
body: [],
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
},
rest: null,
generator: false,
expression: false,
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
},
kind: "",
'static': false,
range: [9, 18],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 18 }
}
}
],
range: [8, 20],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'class A { static set(v) {};}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'set',
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [24, 26],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 26 }
}
},
rest: null,
generator: false,
expression: false,
range: [24, 26],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 26 }
}
},
kind: '',
'static': true,
range: [10, 26],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 26 }
}
}],
range: [8, 28],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 28 }
}
},
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
},
'class A {*gen(v) { yield v; }}': {
type: "ClassDeclaration",
id: {
type: "Identifier",
name: "A",
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: "ClassBody",
body: [
{
type: "MethodDefinition",
key: {
type: "Identifier",
name: "gen",
range: [10, 13],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 13 }
}
},
value: {
type: "FunctionExpression",
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
}],
defaults: [],
body: {
type: "BlockStatement",
body: [{
type: 'ExpressionStatement',
expression: {
type: 'YieldExpression',
argument: {
type: 'Identifier',
name: 'v',
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
delegate: false,
range: [19, 26],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 26 }
}
},
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
}],
range: [17, 29],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 29 }
}
},
rest: null,
generator: true,
expression: false,
range: [17, 29],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 29 }
}
},
kind: "",
'static': false,
range: [9, 29],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 29 }
}
}
],
range: [8, 30],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 30 }
}
},
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
'class A { static *gen(v) { yield v; }}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'gen',
range: [18, 21],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 21 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'YieldExpression',
argument: {
type: 'Identifier',
name: 'v',
range: [33, 34],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 34 }
}
},
delegate: false,
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
range: [27, 35],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 35 }
}
}],
range: [25, 37],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: true,
expression: false,
range: [25, 37],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 37 }
}
},
kind: '',
'static': true,
range: [10, 37],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 37 }
}
}],
range: [8, 38],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 38 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'"use strict"; (class A {constructor() { super() }})': {
type: "Program",
body: [
{
type: "ExpressionStatement",
expression: {
type: "Literal",
value: "use strict",
raw: "\"use strict\"",
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
{
type: "ExpressionStatement",
expression: {
type: "ClassExpression",
id: {
type: "Identifier",
name: "A",
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
superClass: null,
body: {
type: "ClassBody",
body: [
{
type: "MethodDefinition",
key: {
type: "Identifier",
name: "constructor",
range: [24, 35],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 35 }
}
},
value: {
type: "FunctionExpression",
id: null,
params: [],
defaults: [],
body: {
type: "BlockStatement",
body: [
{
type: "ExpressionStatement",
expression: {
type: "CallExpression",
callee: {
type: "Identifier",
name: "super",
range: [40, 45],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 45 }
}
},
'arguments': [],
range: [40, 47],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 47 }
}
},
range: [40, 48],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 48 }
}
}
],
range: [38, 49],
loc: {
start: { line: 1, column: 38 },
end: { line: 1, column: 49 }
}
},
rest: null,
generator: false,
expression: false,
range: [38, 49],
loc: {
start: { line: 1, column: 38 },
end: { line: 1, column: 49 }
}
},
kind: "",
'static': false,
range: [24, 49],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 49 }
}
}
],
range: [23, 50],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 50 }
}
},
range: [15, 50],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 50 }
}
},
range: [14, 51],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 51 }
}
}
],
range: [0, 51],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 51 }
},
comments: []
},
'class A {static foo() {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7}
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [16, 19],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 19 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [22, 24],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 24}
}
},
rest: null,
generator: false,
expression: false,
range: [22, 24],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 24 }
}
},
kind: '',
'static': true,
range: [9, 24],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 24 }
}
}],
range: [8, 25],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 25 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'class A {foo() {} static bar() {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
kind: '',
'static': false,
range: [9, 17],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 17 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'bar',
range: [25, 28],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 28 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [31, 33],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 33 }
}
},
rest: null,
generator: false,
expression: false,
range: [31, 33],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 33 }
}
},
kind: '',
'static': true,
range: [18, 33],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 33 }
}
}],
range: [8, 34],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 34 }
}
},
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'"use strict"; (class A { static constructor() { super() }})': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'ClassExpression',
id: {
type: 'Identifier',
name: 'A',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'constructor',
range: [32, 43],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 43 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'super',
range: [48, 53],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 53 }
}
},
'arguments': [],
range: [48, 55],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 55 }
}
},
range: [48, 56],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 56 }
}
}],
range: [46, 57],
loc: {
start: { line: 1, column: 46 },
end: { line: 1, column: 57 }
}
},
rest: null,
generator: false,
expression: false,
range: [46, 57],
loc: {
start: { line: 1, column: 46 },
end: { line: 1, column: 57 }
}
},
kind: '',
'static': true,
range: [25, 57],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 57 }
}
}],
range: [23, 58],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 58 }
}
},
range: [15, 58],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 58 }
}
},
range: [14, 59],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 59 }
}
}],
range: [0, 59],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 59 }
},
comments: []
},
'class A { foo() {} bar() {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [10, 13],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 13 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
},
rest: null,
generator: false,
expression: false,
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
},
kind: '',
'static': false,
range: [10, 18],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 18 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'bar',
range: [19, 22],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 22 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [25, 27],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 27 }
}
},
rest: null,
generator: false,
expression: false,
range: [25, 27],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 27 }
}
},
kind: '',
'static': false,
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
}],
range: [8, 28],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 28 }
}
},
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
},
'class A { get foo() {} set foo(v) {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [14, 17],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 17 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
kind: 'get',
'static': false,
range: [10, 22],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 22 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [27, 30],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 30 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
rest: null,
generator: false,
expression: false,
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
kind: 'set',
'static': false,
range: [23, 36],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 36 }
}
}],
range: [8, 37],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 37 }
}
},
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
}
},
'class A { static get foo() {} get foo() {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [21, 24],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 24 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
rest: null,
generator: false,
expression: false,
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
kind: 'get',
'static': true,
range: [10, 29],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 29 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [34, 37],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 37 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [40, 42],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 42 }
}
},
rest: null,
generator: false,
expression: false,
range: [40, 42],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 42 }
}
},
kind: 'get',
'static': false,
range: [30, 42],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 42 }
}
}],
range: [8, 43],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 43 }
}
},
range: [0, 43],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 43 }
}
},
'class A { static get foo() {} static get bar() {} }': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [21, 24],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 24 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
rest: null,
generator: false,
expression: false,
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
kind: 'get',
'static': true,
range: [10, 29],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 29 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'bar',
range: [41, 44],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 44 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [47, 49],
loc: {
start: { line: 1, column: 47 },
end: { line: 1, column: 49 }
}
},
rest: null,
generator: false,
expression: false,
range: [47, 49],
loc: {
start: { line: 1, column: 47 },
end: { line: 1, column: 49 }
}
},
kind: 'get',
'static': true,
range: [30, 49],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 49 }
}
}],
range: [8, 51],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 51 }
}
},
range: [0, 51],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 51 }
}
},
'class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v) {}}': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [21, 24],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 24 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
rest: null,
generator: false,
expression: false,
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
kind: 'get',
'static': true,
range: [10, 29],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 29 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [41, 44],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 44 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [45, 46],
loc: {
start: { line: 1, column: 45 },
end: { line: 1, column: 46 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [48, 50],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 50 }
}
},
rest: null,
generator: false,
expression: false,
range: [48, 50],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 50 }
}
},
kind: 'set',
'static': true,
range: [30, 50],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 50 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [55, 58],
loc: {
start: { line: 1, column: 55 },
end: { line: 1, column: 58 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [61, 63],
loc: {
start: { line: 1, column: 61 },
end: { line: 1, column: 63 }
}
},
rest: null,
generator: false,
expression: false,
range: [61, 63],
loc: {
start: { line: 1, column: 61 },
end: { line: 1, column: 63 }
}
},
kind: 'get',
'static': false,
range: [51, 63],
loc: {
start: { line: 1, column: 51 },
end: { line: 1, column: 63 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [68, 71],
loc: {
start: { line: 1, column: 68 },
end: { line: 1, column: 71 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [72, 73],
loc: {
start: { line: 1, column: 72 },
end: { line: 1, column: 73 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [75, 77],
loc: {
start: { line: 1, column: 75 },
end: { line: 1, column: 77 }
}
},
rest: null,
generator: false,
expression: false,
range: [75, 77],
loc: {
start: { line: 1, column: 75 },
end: { line: 1, column: 77 }
}
},
kind: 'set',
'static': false,
range: [64, 77],
loc: {
start: { line: 1, column: 64 },
end: { line: 1, column: 77 }
}
}],
range: [8, 78],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 78 }
}
},
range: [0, 78],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 78 }
}
},
'class A { set foo(v) {} get foo() {} }': {
type: 'ClassDeclaration',
id: {
type: 'Identifier',
name: 'A',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
superClass: null,
body: {
type: 'ClassBody',
body: [{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [14, 17],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 17 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'v',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [21, 23],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 23 }
}
},
rest: null,
generator: false,
expression: false,
range: [21, 23],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 23 }
}
},
kind: 'set',
'static': false,
range: [10, 23],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 23 }
}
}, {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'foo',
range: [28, 31],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 31 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
rest: null,
generator: false,
expression: false,
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
kind: 'get',
'static': false,
range: [24, 36],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 36 }
}
}],
range: [8, 38],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 38 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'class A { get foo() {} get foo() {} }': {
index: 30,
lineNumber: 1,
column: 31,
message: 'Error: Line 1: Illegal duplicate property in class definition',
description: 'Illegal duplicate property in class definition'
},
'class A { set foo(v) {} set foo(v) {} }': {
index: 31,
lineNumber: 1,
column: 32,
message: 'Error: Line 1: Illegal duplicate property in class definition',
description: 'Illegal duplicate property in class definition'
},
'class A { get foo() {} foo() {} }': {
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Illegal duplicate property in class definition',
description: 'Illegal duplicate property in class definition'
},
'class A { foo() {} get foo() {} }': {
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Illegal duplicate property in class definition',
description: 'Illegal duplicate property in class definition'
},
'class A { set foo(v) {} foo() {} }': {
index: 27,
lineNumber: 1,
column: 28,
message: 'Error: Line 1: Illegal duplicate property in class definition',
description: 'Illegal duplicate property in class definition'
},
'class A { foo() {} set foo(v) {} }': {
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Illegal duplicate property in class definition',
description: 'Illegal duplicate property in class definition'
},
},
'ES6: Default parameters': {
'x = function(y = 1) {}': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'y',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
defaults: [{
type: 'Literal',
value: 1,
raw: '1',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
}],
body: {
type: 'BlockStatement',
body: [],
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [4, 22],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'function f(a = 1) {}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'f',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
params: [{
type: 'Identifier',
name: 'a',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
}],
defaults: [{
type: 'Literal',
value: 1,
raw: '1',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}],
body: {
type: 'BlockStatement',
body: [],
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'x = { f: function(a=1) {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'f',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
}],
defaults: [{
type: 'Literal',
value: 1,
raw: '1',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 }
}
}],
body: {
type: 'BlockStatement',
body: [],
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
rest: null,
generator: false,
expression: false,
range: [9, 25],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 25 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 25],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 25 }
}
}],
range: [4, 27],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 27 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'x = { f(a=1) {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'f',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
}],
defaults: [{
type: 'Literal',
value: 1,
raw: '1',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
}],
body: {
type: 'BlockStatement',
body: [],
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
rest: null,
generator: false,
expression: false,
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
}
},
// ECMAScript 6th Syntax, 13 - Rest parameters
// path_to_url
'ES6: Rest parameters': {
'function f(a, ...b) {}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'f',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
params: [{
type: 'Identifier',
name: 'a',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
rest: {
type: 'Identifier',
name: 'b',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
generator: false,
expression: false,
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
}
},
'ES6: Destructured Parameters': {
'function x([ a, b ]){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
params: [{
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}, {
type: 'Identifier',
name: 'b',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
}],
range: [11, 19],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'function x({ a, b }){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
}],
range: [11, 19],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 19 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'function x(a, { a }){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
params: [{
type: 'Identifier',
name: 'a',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
}, {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
}],
range: [14, 19],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 19 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'function x(...[ a, b ]){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
}, {
type: 'Identifier',
name: 'b',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
}],
range: [14, 22],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 22 }
}
},
generator: false,
expression: false,
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){}': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'w',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
value: {
type: 'Identifier',
name: 'w',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
value: {
type: 'Identifier',
name: 'x',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
}],
range: [16, 24],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 24 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [13, 24],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 24 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [26, 27],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 27 }
}
},
value: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'y',
range: [30, 31],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 31 }
}
}, {
type: 'Identifier',
name: 'z',
range: [33, 34],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 34 }
}
}],
range: [29, 35],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 35 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [26, 35],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 35 }
}
}],
range: [11, 37],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 37 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [52, 54],
loc: {
start: { line: 1, column: 52 },
end: { line: 1, column: 54 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [43, 44],
loc: {
start: { line: 1, column: 43 },
end: { line: 1, column: 44 }
}
}, {
type: 'Identifier',
name: 'b',
range: [46, 47],
loc: {
start: { line: 1, column: 46 },
end: { line: 1, column: 47 }
}
}, {
type: 'Identifier',
name: 'c',
range: [49, 50],
loc: {
start: { line: 1, column: 49 },
end: { line: 1, column: 50 }
}
}],
range: [42, 51],
loc: {
start: { line: 1, column: 42 },
end: { line: 1, column: 51 }
}
},
generator: false,
expression: false,
range: [0, 54],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 54 }
}
},
'(function x([ a, b ]){})': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'x',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
params: [{
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
}, {
type: 'Identifier',
name: 'b',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
}],
range: [12, 20],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 20 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [21, 23],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 23 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 23],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 23 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'(function x({ a, b }){})': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'x',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
}],
range: [12, 20],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 20 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [21, 23],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 23 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 23],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 23 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'(function x(...[ a, b ]){})': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'x',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [24, 26],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 26 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
}, {
type: 'Identifier',
name: 'b',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 }
}
}],
range: [15, 23],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 23 }
}
},
generator: false,
expression: false,
range: [1, 26],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 26 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'(function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){})': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'x',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'w',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
value: {
type: 'Identifier',
name: 'w',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
value: {
type: 'Identifier',
name: 'x',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
}],
range: [17, 25],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 25 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [14, 25],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 25 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [27, 28],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 28 }
}
},
value: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'y',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
}, {
type: 'Identifier',
name: 'z',
range: [34, 35],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 35 }
}
}],
range: [30, 36],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 36 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [27, 36],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 36 }
}
}],
range: [12, 38],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 38 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [53, 55],
loc: {
start: { line: 1, column: 53 },
end: { line: 1, column: 55 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [44, 45],
loc: {
start: { line: 1, column: 44 },
end: { line: 1, column: 45 }
}
}, {
type: 'Identifier',
name: 'b',
range: [47, 48],
loc: {
start: { line: 1, column: 47 },
end: { line: 1, column: 48 }
}
}, {
type: 'Identifier',
name: 'c',
range: [50, 51],
loc: {
start: { line: 1, column: 50 },
end: { line: 1, column: 51 }
}
}],
range: [43, 52],
loc: {
start: { line: 1, column: 43 },
end: { line: 1, column: 52 }
}
},
generator: false,
expression: false,
range: [1, 55],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 55 }
}
},
range: [0, 56],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 56 }
}
},
'({ x([ a, b ]){} })': {
type: 'ExpressionStatement',
expression: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}, {
type: 'Identifier',
name: 'b',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
}],
range: [5, 13],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 13 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [3, 16],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 16 }
}
}],
range: [1, 18],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 18 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'({ x(...[ a, b ]){} })': {
type: 'ExpressionStatement',
expression: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
}, {
type: 'Identifier',
name: 'b',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
range: [8, 16],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 16 }
}
},
generator: false,
expression: false,
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [3, 19],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 19 }
}
}],
range: [1, 21],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 21 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'({ x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){} })': {
type: 'ExpressionStatement',
expression: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
value: {
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'w',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
value: {
type: 'Identifier',
name: 'w',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
value: {
type: 'Identifier',
name: 'x',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}],
range: [10, 18],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 18 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [7, 18],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 18 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 }
}
},
value: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'y',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
}, {
type: 'Identifier',
name: 'z',
range: [27, 28],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 28 }
}
}],
range: [23, 29],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 29 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [20, 29],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 29 }
}
}],
range: [5, 31],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 31 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [46, 48],
loc: {
start: { line: 1, column: 46 },
end: { line: 1, column: 48 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [37, 38],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 38 }
}
}, {
type: 'Identifier',
name: 'b',
range: [40, 41],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 41 }
}
}, {
type: 'Identifier',
name: 'c',
range: [43, 44],
loc: {
start: { line: 1, column: 43 },
end: { line: 1, column: 44 }
}
}],
range: [36, 45],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 45 }
}
},
generator: false,
expression: false,
range: [46, 48],
loc: {
start: { line: 1, column: 46 },
end: { line: 1, column: 48 }
}
},
kind: 'init',
method: true,
shorthand: false,
range: [3, 48],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 48 }
}
}],
range: [1, 50],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 50 }
}
},
range: [0, 51],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 51 }
}
},
'(...a) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
rest: {
type: 'Identifier',
name: 'a',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
generator: false,
expression: false,
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'(a, ...b) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
rest: {
type: 'Identifier',
name: 'b',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
generator: false,
expression: false,
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'({ a }) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
}],
range: [1, 6],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 6 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'({ a }, ...b) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
}],
range: [1, 6],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 6 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
rest: {
type: 'Identifier',
name: 'b',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
generator: false,
expression: false,
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'(...[a, b]) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}, {
type: 'Identifier',
name: 'b',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
}],
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
generator: false,
expression: false,
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'(a, ...[b]) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'b',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
}],
range: [7, 10],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 10 }
}
},
generator: false,
expression: false,
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'({ a: [a, b] }, ...c) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}, {
type: 'Identifier',
name: 'b',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
}],
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [3, 12],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 12 }
}
}],
range: [1, 14],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 14 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [25, 27],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 27 }
}
},
rest: {
type: 'Identifier',
name: 'c',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
generator: false,
expression: false,
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'({ a: b, c }, [d, e], ...f) => {}': {
type: 'ExpressionStatement',
expression: {
type: 'ArrowFunctionExpression',
id: null,
params: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [3, 7],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 7 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'c',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
value: {
type: 'Identifier',
name: 'c',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}],
range: [1, 12],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 12 }
}
}, {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'd',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}, {
type: 'Identifier',
name: 'e',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
}],
range: [14, 20],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 20 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [31, 33],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 33 }
}
},
rest: {
type: 'Identifier',
name: 'f',
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
generator: false,
expression: false,
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
},
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
}
},
'ES6: SpreadElement': {
'[...a] = b': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'ArrayPattern',
elements: [{
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'a',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [1, 5],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 5 }
}
}],
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Identifier',
name: 'b',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
'[a, ...b] = c': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}, {
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'b',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [4, 8],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 8 }
}
}],
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
right: {
type: 'Identifier',
name: 'c',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'[{ a, b }, ...c] = d': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'ArrayPattern',
elements: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}],
range: [1, 9],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 9 }
}
}, {
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'c',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
range: [11, 15],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 15 }
}
}],
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
right: {
type: 'Identifier',
name: 'd',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'[a, ...[b, c]] = d': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
}, {
type: 'SpreadElement',
argument: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'b',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
}, {
type: 'Identifier',
name: 'c',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
}],
range: [7, 13],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 13 }
}
},
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
}],
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
right: {
type: 'Identifier',
name: 'd',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'var [...a] = b': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ArrayPattern',
elements: [{
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'a',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [5, 9],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 9 }
}
}],
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
init: {
type: 'Identifier',
name: 'b',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
range: [4, 14],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 14 }
}
}],
kind: 'var',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'var [a, ...b] = c': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}, {
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'b',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
range: [8, 12],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 12 }
}
}],
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
},
init: {
type: 'Identifier',
name: 'c',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
}],
kind: 'var',
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'var [{ a, b }, ...c] = d': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ArrayPattern',
elements: [{
type: 'ObjectPattern',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
value: {
type: 'Identifier',
name: 'a',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
value: {
type: 'Identifier',
name: 'b',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
kind: 'init',
method: false,
shorthand: true,
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
}],
range: [5, 13],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 13 }
}
}, {
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'c',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
range: [15, 19],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 19 }
}
}],
range: [4, 20],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 20 }
}
},
init: {
type: 'Identifier',
name: 'd',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
range: [4, 24],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 24 }
}
}],
kind: 'var',
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'var [a, ...[b, c]] = d': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}, {
type: 'SpreadElement',
argument: {
type: 'ArrayPattern',
elements: [{
type: 'Identifier',
name: 'b',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
}, {
type: 'Identifier',
name: 'c',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}],
range: [11, 17],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 17 }
}
},
range: [8, 17],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 17 }
}
}],
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
},
init: {
type: 'Identifier',
name: 'd',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
range: [4, 22],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 22 }
}
}],
kind: 'var',
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'func(...a)': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'func',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'arguments': [{
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'a',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [5, 9],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 9 }
}
}],
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
'func(a, ...b)': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'func',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'arguments': [{
type: 'Identifier',
name: 'a',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}, {
type: 'SpreadElement',
argument: {
type: 'Identifier',
name: 'b',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
range: [8, 12],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 12 }
}
}],
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}
},
'Harmony Invalid syntax': {
'0o': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0o1a': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0o9': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0o18': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0O': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0O1a': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0O9': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0O18': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0b': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0b1a': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0b9': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0b18': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0b12': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0B': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0B1a': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0B9': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0B18': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0B12': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'"\\u{110000}"': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'"\\u{}"': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'"\\u{FFFF"': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'"\\u{FFZ}"': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'[v] += ary': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'[2] = 42': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'({ obj:20 }) = 42': {
index: 12,
lineNumber: 1,
column: 13,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'( { get x() {} } ) = 0': {
index: 18,
lineNumber: 1,
column: 19,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'x \n is y': {
index: 7,
lineNumber: 2,
column: 5,
message: 'Error: Line 2: Unexpected identifier'
},
'x \n isnt y': {
index: 9,
lineNumber: 2,
column: 7,
message: 'Error: Line 2: Unexpected identifier'
},
'function default() {}': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token default'
},
'function hello() {\'use strict\'; ({ i: 10, s(eval) { } }); }': {
index: 44,
lineNumber: 1,
column: 45,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function a() { "use strict"; ({ b(t, t) { } }); }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'var super': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Unexpected reserved word'
},
'var default': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Unexpected token default'
},
'let default': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Unexpected token default'
},
'const default': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected token default'
},
'({ v: eval }) = obj': {
index: 13,
lineNumber: 1,
column: 14,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'({ v: arguments }) = obj': {
index: 18,
lineNumber: 1,
column: 19,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'for (var i = function() { return 10 in [] } in list) process(x);': {
index: 44,
lineNumber: 1,
column: 45,
message: 'Error: Line 1: Unexpected token in'
},
'for (let x = 42 in list) process(x);': {
index: 16,
lineNumber: 1,
column: 17,
message: 'Error: Line 1: Unexpected token in'
},
'for (let x = 42 of list) process(x);': {
index: 16,
lineNumber: 1,
column: 17,
message: 'Error: Line 1: Unexpected identifier'
},
'module\n"crypto" {}': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Illegal newline after module'
},
'module foo from bar': {
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Invalid module specifier'
},
'module 42': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected number'
},
'module foo bar': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Unexpected identifier'
},
'module "crypto" { module "e" {} }': {
index: 17,
lineNumber: 1,
column: 18,
message: 'Error: Line 1: Module declaration can not be nested'
},
'module "x" { export * from foo }': {
index: 30,
lineNumber: 1,
column: 31,
message: 'Error: Line 1: Invalid module specifier'
},
'import foo': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Missing from after import'
},
'import { foo, bar }': {
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Missing from after import'
},
'import foo from bar': {
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Invalid module specifier'
},
'((a)) => 42': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected token =>'
},
'(a, (b)) => 42': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token =>'
},
'"use strict"; (eval = 10) => 42': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode'
},
// strict mode, using eval when IsSimpleParameterList is true
'"use strict"; eval => 42': {
index: 24,
lineNumber: 1,
column: 25,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
// strict mode, using arguments when IsSimpleParameterList is true
'"use strict"; arguments => 42': {
index: 29,
lineNumber: 1,
column: 30,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
// strict mode, using eval when IsSimpleParameterList is true
'"use strict"; (eval, a) => 42': {
index: 29,
lineNumber: 1,
column: 30,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
// strict mode, using arguments when IsSimpleParameterList is true
'"use strict"; (arguments, a) => 42': {
index: 34,
lineNumber: 1,
column: 35,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
// strict mode, using eval when IsSimpleParameterList is false
'"use strict"; (eval, a = 10) => 42': {
index: 34,
lineNumber: 1,
column: 35,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'(a, a) => 42': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'"use strict"; (a, a) => 42': {
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'"use strict"; (a) => 00': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'() <= 42': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token <='
},
'(10) => 00': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected token =>'
},
'(10, 20) => 00': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token =>'
},
'yield v': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Illegal yield expression'
},
'yield 10': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Illegal yield expression'
},
'yield* 10': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Illegal yield expression'
},
'e => yield* 10': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Illegal yield expression'
},
'(function () { yield 10 })': {
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Illegal yield expression'
},
'(function () { yield* 10 })': {
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Illegal yield expression'
},
'(function* () { })': {
index: 17,
lineNumber: 1,
column: 18,
message: 'Error: Line 1: Missing yield in generator'
},
'function* test () { }': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Missing yield in generator'
},
'var obj = { *test() { } }': {
index: 23,
lineNumber: 1,
column: 24,
message: 'Error: Line 1: Missing yield in generator'
},
'var obj = { *test** }': {
index: 17,
lineNumber: 1,
column: 18,
message: 'Error: Line 1: Unexpected token *'
},
'class A extends yield B { }': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Illegal yield expression'
},
'class default': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected token default'
},
'`test': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'switch `test`': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected quasi test'
},
'`hello ${10 `test`': {
index: 18,
lineNumber: 1,
column: 19,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'`hello ${10;test`': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'function a() 1 // expression closure is not supported': {
index: 13,
lineNumber: 1,
column: 14,
message: 'Error: Line 1: Unexpected number'
},
'[a,b if (a)] // (a,b)': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Comprehension Error'
},
'for each (let x in {}) {};': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Each is not supported'
},
'[x for (let x in [])]': {
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Comprehension Error'
},
'[x for (const x in [])]': {
index: 22,
lineNumber: 1,
column: 23,
message: 'Error: Line 1: Comprehension Error'
},
'[x for (var x in [])]': {
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Comprehension Error'
},
'[a,b for (a in [])] // (a,b) ': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Comprehension Error'
},
'[x if (x)] // block required': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Comprehension must have at least one block'
},
'var a = [x if (x)]': {
index: 18,
lineNumber: 1,
column: 19,
message: 'Error: Line 1: Comprehension must have at least one block'
},
'[for (x in [])] // no espression': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Comprehension Error'
},
'({ "chance" }) = obj': {
index: 12,
lineNumber: 1,
column: 13,
message: 'Error: Line 1: Unexpected token }'
},
'({ 42 }) = obj': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected token }'
},
'function f(a, ...b, c)': {
index: 18,
lineNumber: 1,
column: 19,
message: 'Error: Line 1: Rest parameter must be final parameter of an argument list'
},
'function f(a, ...b = 0)': {
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Rest parameter can not have a default value'
},
'function x(...{ a }){}': {
index: 14,
lineNumber: 1,
column: 15,
message: 'Error: Line 1: Invalid rest parameter'
},
'"use strict"; function x(a, { a }){}': {
index: 36,
lineNumber: 1,
column: 37,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'"use strict"; function x({ b: { a } }, [{ b: { a } }]){}': {
index: 56,
lineNumber: 1,
column: 57,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'"use strict"; function x(a, ...[a]){}': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'(...a, b) => {}': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Rest parameter must be final parameter of an argument list'
},
'([ 5 ]) => {}': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Invalid left-hand side in formals list'
},
'({ 5 }) => {}': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected token }'
},
'(...[ 5 ]) => {}': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Invalid left-hand side in formals list'
},
'[...{ a }] = b': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Invalid spread argument'
},
'[...a, b] = c': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Spread must be the final element of an element list'
},
'func(...a, b)': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Spread must be the final element of an element list'
},
'({ t(eval) { "use strict"; } });': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'"use strict"; `${test}\\02`;': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'[...a, ] = b': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Spread must be the final element of an element list'
},
'if (b,...a, );': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Spread must be the final element of an element list'
},
'(b, ...a)': {
index: 8,
lineNumber: 1,
column: 9,
message: 'Error: Line 1: Illegal spread element'
},
'module "Universe" { ; ; ': {
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Unexpected end of input'
},
'switch (cond) { case 10: let a = 20; ': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Unexpected end of input'
},
'"use strict"; (eval) => 42': {
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'(eval) => { "use strict"; 42 }': {
index: 30,
lineNumber: 1,
column: 31,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'({ get test() { } }) => 42': {
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Invalid left-hand side in formals list'
}
}
};
// Merge both test fixtures.
(function () {
'use strict';
var i, fixtures;
for (i in harmonyTestFixture) {
if (harmonyTestFixture.hasOwnProperty(i)) {
fixtures = harmonyTestFixture[i];
if (i !== 'Syntax' && testFixture.hasOwnProperty(i)) {
throw new Error('Harmony test should not replace existing test for ' + i);
}
testFixture[i] = fixtures;
}
}
}());
``` | /content/code_sandbox/node_modules/esprima-fb/test/harmonytest.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 84,758 |
```html
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Esprima: Unit Tests</title>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="../assets/style.css">
<link rel="stylesheet" href="../assets/foundation/foundation.min.css">
</head>
<body>
<!-- Navigation bar -->
<div class="row">
<div class="twelve columns">
<nav class="top-bar">
<ul>
<li class="name">
<h1><a href="../index.html">Esprima</a></h1>
</li>
</ul>
<section>
<ul class="right">
<li class="divider show-for-medium-and-up"></li>
<li class="has-dropdown">
<a href="../demo/index.html">Demo</a>
<ul class="dropdown">
<li><label>Static Analysis</label></li>
<li><a href="../demo/parse.html">Online Parsing</a></li>
<li><a href="../demo/validate.html">Syntax Validator</a></li>
<li><a href="../demo/precedence.html">Operator Precedence</a></li>
<li><a href="../demo/collector.html">Regex Collector</a></li>
<li><label>Dynamic Tracing</label></li>
<li><a href="../demo/functiontrace.html">Function Instrumentation</a></li>
<li><label>Code Transformation</label></li>
<li><a href="../demo/rewrite.html">Source Rewrite</a></li>
<li><a href="../demo/minify.html">Minifiy & Obfuscate</a></li>
<li><label>Editing Tools</label></li>
<li><a href="../demo/highlight.html">Identifier Highlight</a></li>
<li><a href="../demo/autocomplete.html">Autocomplete</a></li>
</ul>
</li>
<li class="has-dropdown">
<a href="#">Project</a>
<ul class="dropdown">
<li><a href="path_to_url">Git Repository</a></li>
<li><a href="path_to_url">Continuous Integration</a></li>
<li><a href="path_to_url">Mailing List</a></li>
<li><a href="path_to_url">Issue Tracker</a></li>
<li class="divider"></li>
<li><label>QA</label></li>
<li><a href="../test/index.html">Unit Tests</a></li>
<li><a href="../test/benchmarks.html">Benchmarks Suite</a></li>
<li><a href="../test/compat.html">Compatibility Tests</a></li>
<li><a href="../test/compare.html">Speed Comparison</a></li>
<li><a href="../test/module.html">Module Loading</a></li>
<li><a href="../test/coverage.html">Coverage Analysis</a></li>
</ul>
</li>
<li><a href="../doc/index.html">Documentation</a></li>
</ul>
</section>
</nav>
</div>
</div>
<!-- Title and subtitle -->
<div class="row">
<div class="twelve columns">
<h3 class="subheader"><strong>Unit Tests</strong> ensures the correct implementation</h3>
</div>
</div>
<!-- Main content -->
<div class="row">
<div class="eight columns">
<div id="report"></div>
</div>
<div class="four columns">
<div id="status" class="alert-box secondary">Please wait...</div>
<div class="panel">
<p>A software project is only as good as its QA workflow. This set of unit tests
makes sure that no regression is ever sneaked in.</p>
<p>Version being tested: <strong><span id="version"></span></strong>.</p>
</div>
</div>
</div>
<!-- Footer -->
<div class="row copyright">
<div class="six columns">
<p>Esprima is created and mantained by <a href="path_to_url">Ariya Hidayat</a>.</p>
</div>
<div class="six columns">
<ul class="link-list right">
<li><a href="path_to_url">@Esprima</a></li>
<li><a href="path_to_url">GitHub</a></li>
</ul>
</div>
</div>
<script src="../esprima.js"></script>
<script src="../assets/json2.js"></script>
<script src="test.js"></script>
<script src="harmonytest.js"></script>
<script src="runner.js"></script>
<script>
/*jslint browser: true */
window.onload = window.runTests;
</script>
</body>
</html>
``` | /content/code_sandbox/node_modules/esprima-fb/test/index.html | html | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,151 |
```javascript
#!/usr/bin/env node
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint sloppy:true plusplus:true node:true rhino:true */
/*global phantom:true */
var fs, system, esprima, options, fnames, count;
if (typeof esprima === 'undefined') {
// PhantomJS can only require() relative files
if (typeof phantom === 'object') {
fs = require('fs');
system = require('system');
esprima = require('./esprima');
} else if (typeof require === 'function') {
fs = require('fs');
esprima = require('esprima');
} else if (typeof load === 'function') {
try {
load('esprima.js');
} catch (e) {
load('../esprima.js');
}
}
}
// Shims to Node.js objects when running under PhantomJS 1.7+.
if (typeof phantom === 'object') {
fs.readFileSync = fs.read;
process = {
argv: [].slice.call(system.args),
exit: phantom.exit
};
process.argv.unshift('phantomjs');
}
// Shims to Node.js objects when running under Rhino.
if (typeof console === 'undefined' && typeof process === 'undefined') {
console = { log: print };
fs = { readFileSync: readFile };
process = { argv: arguments, exit: quit };
process.argv.unshift('esvalidate.js');
process.argv.unshift('rhino');
}
function showUsage() {
console.log('Usage:');
console.log(' esvalidate [options] file.js');
console.log();
console.log('Available options:');
console.log();
console.log(' --format=type Set the report format, plain (default) or junit');
console.log(' -v, --version Print program version');
console.log();
process.exit(1);
}
if (process.argv.length <= 2) {
showUsage();
}
options = {
format: 'plain'
};
fnames = [];
process.argv.splice(2).forEach(function (entry) {
if (entry === '-h' || entry === '--help') {
showUsage();
} else if (entry === '-v' || entry === '--version') {
console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
console.log();
process.exit(0);
} else if (entry.slice(0, 9) === '--format=') {
options.format = entry.slice(9);
if (options.format !== 'plain' && options.format !== 'junit') {
console.log('Error: unknown report format ' + options.format + '.');
process.exit(1);
}
} else if (entry.slice(0, 2) === '--') {
console.log('Error: unknown option ' + entry + '.');
process.exit(1);
} else {
fnames.push(entry);
}
});
if (fnames.length === 0) {
console.log('Error: no input file.');
process.exit(1);
}
if (options.format === 'junit') {
console.log('<?xml version="1.0" encoding="UTF-8"?>');
console.log('<testsuites>');
}
count = 0;
fnames.forEach(function (fname) {
var content, timestamp, syntax, name;
try {
content = fs.readFileSync(fname, 'utf-8');
if (content[0] === '#' && content[1] === '!') {
content = '//' + content.substr(2, content.length);
}
timestamp = Date.now();
syntax = esprima.parse(content, { tolerant: true });
if (options.format === 'junit') {
name = fname;
if (name.lastIndexOf('/') >= 0) {
name = name.slice(name.lastIndexOf('/') + 1);
}
console.log('<testsuite name="' + fname + '" errors="0" ' +
' failures="' + syntax.errors.length + '" ' +
' tests="' + syntax.errors.length + '" ' +
' time="' + Math.round((Date.now() - timestamp) / 1000) +
'">');
syntax.errors.forEach(function (error) {
var msg = error.message;
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
' time="0">');
console.log(' <error type="SyntaxError" message="' + error.message + '">' +
error.message + '(' + name + ':' + error.lineNumber + ')' +
'</error>');
console.log(' </testcase>');
});
console.log('</testsuite>');
} else if (options.format === 'plain') {
syntax.errors.forEach(function (error) {
var msg = error.message;
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
msg = fname + ':' + error.lineNumber + ': ' + msg;
console.log(msg);
++count;
});
}
} catch (e) {
++count;
if (options.format === 'junit') {
console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
console.log(' <error type="ParseError" message="' + e.message + '">' +
e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
')</error>');
console.log(' </testcase>');
console.log('</testsuite>');
} else {
console.log('Error: ' + e.message);
}
}
});
if (options.format === 'junit') {
console.log('</testsuites>');
}
if (count > 0) {
process.exit(1);
}
if (count === 0 && typeof phantom === 'object') {
process.exit(0);
}
``` | /content/code_sandbox/node_modules/esprima-fb/bin/esvalidate.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,567 |
```javascript
#!/usr/bin/env node
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint sloppy:true node:true rhino:true */
var fs, esprima, fname, content, options, syntax;
if (typeof require === 'function') {
fs = require('fs');
esprima = require('esprima');
} else if (typeof load === 'function') {
try {
load('esprima.js');
} catch (e) {
load('../esprima.js');
}
}
// Shims to Node.js objects when running under Rhino.
if (typeof console === 'undefined' && typeof process === 'undefined') {
console = { log: print };
fs = { readFileSync: readFile };
process = { argv: arguments, exit: quit };
process.argv.unshift('esparse.js');
process.argv.unshift('rhino');
}
function showUsage() {
console.log('Usage:');
console.log(' esparse [options] file.js');
console.log();
console.log('Available options:');
console.log();
console.log(' --comment Gather all line and block comments in an array');
console.log(' --loc Include line-column location info for each syntax node');
console.log(' --range Include index-based range for each syntax node');
console.log(' --raw Display the raw value of literals');
console.log(' --tokens List all tokens in an array');
console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)');
console.log(' -v, --version Shows program version');
console.log();
process.exit(1);
}
if (process.argv.length <= 2) {
showUsage();
}
options = {};
process.argv.splice(2).forEach(function (entry) {
if (entry === '-h' || entry === '--help') {
showUsage();
} else if (entry === '-v' || entry === '--version') {
console.log('ECMAScript Parser (using Esprima version', esprima.version, ')');
console.log();
process.exit(0);
} else if (entry === '--comment') {
options.comment = true;
} else if (entry === '--loc') {
options.loc = true;
} else if (entry === '--range') {
options.range = true;
} else if (entry === '--raw') {
options.raw = true;
} else if (entry === '--tokens') {
options.tokens = true;
} else if (entry === '--tolerant') {
options.tolerant = true;
} else if (entry.slice(0, 2) === '--') {
console.log('Error: unknown option ' + entry + '.');
process.exit(1);
} else if (typeof fname === 'string') {
console.log('Error: more than one input file.');
process.exit(1);
} else {
fname = entry;
}
});
if (typeof fname !== 'string') {
console.log('Error: no input file.');
process.exit(1);
}
try {
content = fs.readFileSync(fname, 'utf-8');
syntax = esprima.parse(content, options);
console.log(JSON.stringify(syntax, null, 4));
} catch (e) {
console.log('Error: ' + e.message);
process.exit(1);
}
``` | /content/code_sandbox/node_modules/esprima-fb/bin/esparse.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 966 |
```javascript
// Usage: node detectnestedternary.js /path/to/some/directory
// For more details, please read path_to_url#nestedternary
/*jslint node:true sloppy:true plusplus:true */
var fs = require('fs'),
esprima = require('../esprima'),
dirname = process.argv[2];
// Executes visitor on the object and its children (recursively).
function traverse(object, visitor) {
var key, child;
visitor.call(null, object);
for (key in object) {
if (object.hasOwnProperty(key)) {
child = object[key];
if (typeof child === 'object' && child !== null) {
traverse(child, visitor);
}
}
}
}
// path_to_url
function walk(dir, done) {
var results = [];
fs.readdir(dir, function (err, list) {
if (err) {
return done(err);
}
var i = 0;
(function next() {
var file = list[i++];
if (!file) {
return done(null, results);
}
file = dir + '/' + file;
fs.stat(file, function (err, stat) {
if (stat && stat.isDirectory()) {
walk(file, function (err, res) {
results = results.concat(res);
next();
});
} else {
results.push(file);
next();
}
});
}());
});
}
walk(dirname, function (err, results) {
if (err) {
console.log('Error', err);
return;
}
results.forEach(function (filename) {
var shortname, first, content, syntax;
shortname = filename;
first = true;
if (shortname.substr(0, dirname.length) === dirname) {
shortname = shortname.substr(dirname.length + 1, shortname.length);
}
function report(node, problem) {
if (first === true) {
console.log(shortname + ': ');
first = false;
}
console.log(' Line', node.loc.start.line, ':', problem);
}
function checkConditional(node) {
var condition;
if (node.consequent.type === 'ConditionalExpression' ||
node.alternate.type === 'ConditionalExpression') {
condition = content.substring(node.test.range[0], node.test.range[1]);
if (condition.length > 20) {
condition = condition.substring(0, 20) + '...';
}
condition = '"' + condition + '"';
report(node, 'Nested ternary for ' + condition);
}
}
try {
content = fs.readFileSync(filename, 'utf-8');
syntax = esprima.parse(content, { tolerant: true, loc: true, range: true });
traverse(syntax, function (node) {
if (node.type === 'ConditionalExpression') {
checkConditional(node);
}
});
} catch (e) {
}
});
});
``` | /content/code_sandbox/node_modules/esprima-fb/examples/detectnestedternary.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 632 |
```javascript
// Usage: node findbooleantrap.js /path/to/some/directory
// For more details, please read path_to_url#booleantrap.
/*jslint node:true sloppy:true plusplus:true */
var fs = require('fs'),
esprima = require('../esprima'),
dirname = process.argv[2],
doubleNegativeList = [];
// Black-list of terms with double-negative meaning.
doubleNegativeList = [
'hidden',
'caseinsensitive',
'disabled'
];
// Executes visitor on the object and its children (recursively).
function traverse(object, visitor) {
var key, child;
if (visitor.call(null, object) === false) {
return;
}
for (key in object) {
if (object.hasOwnProperty(key)) {
child = object[key];
if (typeof child === 'object' && child !== null) {
traverse(child, visitor);
}
}
}
}
// path_to_url
function walk(dir, done) {
var results = [];
fs.readdir(dir, function (err, list) {
if (err) {
return done(err);
}
var i = 0;
(function next() {
var file = list[i++];
if (!file) {
return done(null, results);
}
file = dir + '/' + file;
fs.stat(file, function (err, stat) {
if (stat && stat.isDirectory()) {
walk(file, function (err, res) {
results = results.concat(res);
next();
});
} else {
results.push(file);
next();
}
});
}());
});
}
walk(dirname, function (err, results) {
if (err) {
console.log('Error', err);
return;
}
results.forEach(function (filename) {
var shortname, first, content, syntax;
shortname = filename;
first = true;
if (shortname.substr(0, dirname.length) === dirname) {
shortname = shortname.substr(dirname.length + 1, shortname.length);
}
function getFunctionName(node) {
if (node.callee.type === 'Identifier') {
return node.callee.name;
}
if (node.callee.type === 'MemberExpression') {
return node.callee.property.name;
}
}
function report(node, problem) {
if (first === true) {
console.log(shortname + ': ');
first = false;
}
console.log(' Line', node.loc.start.line, 'in function',
getFunctionName(node) + ':', problem);
}
function checkSingleArgument(node) {
var args = node['arguments'],
functionName = getFunctionName(node);
if ((args.length !== 1) || (typeof args[0].value !== 'boolean')) {
return;
}
// Check if the method is a setter, i.e. starts with 'set',
// e.g. 'setEnabled(false)'.
if (functionName.substr(0, 3) !== 'set') {
report(node, 'Boolean literal with a non-setter function');
}
// Does it contain a term with double-negative meaning?
doubleNegativeList.forEach(function (term) {
if (functionName.toLowerCase().indexOf(term.toLowerCase()) >= 0) {
report(node, 'Boolean literal with confusing double-negative');
}
});
}
function checkMultipleArguments(node) {
var args = node['arguments'],
literalCount = 0;
args.forEach(function (arg) {
if (typeof arg.value === 'boolean') {
literalCount++;
}
});
// At least two arguments must be Boolean literals.
if (literalCount >= 2) {
// Check for two different Boolean literals in one call.
if (literalCount === 2 && args.length === 2) {
if (args[0].value !== args[1].value) {
report(node, 'Confusing true vs false');
return;
}
}
report(node, 'Multiple Boolean literals');
}
}
function checkLastArgument(node) {
var args = node['arguments'];
if (args.length < 2) {
return;
}
if (typeof args[args.length - 1].value === 'boolean') {
report(node, 'Ambiguous Boolean literal as the last argument');
}
}
try {
content = fs.readFileSync(filename, 'utf-8');
syntax = esprima.parse(content, { tolerant: true, loc: true });
traverse(syntax, function (node) {
if (node.type === 'CallExpression') {
checkSingleArgument(node);
checkLastArgument(node);
checkMultipleArguments(node);
}
});
} catch (e) {
}
});
});
``` | /content/code_sandbox/node_modules/esprima-fb/examples/findbooleantrap.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,027 |
```javascript
/*jslint node:true */
var fs = require('fs'),
esprima = require('../esprima'),
files = process.argv.splice(2),
histogram,
type;
histogram = {
Boolean: 0,
Identifier: 0,
Keyword: 0,
Null: 0,
Numeric: 0,
Punctuator: 0,
RegularExpression: 0,
String: 0
};
files.forEach(function (filename) {
'use strict';
var content = fs.readFileSync(filename, 'utf-8'),
tokens = esprima.parse(content, { tokens: true }).tokens;
tokens.forEach(function (token) {
histogram[token.type] += 1;
});
});
for (type in histogram) {
if (histogram.hasOwnProperty(type)) {
console.log(type, histogram[type]);
}
}
``` | /content/code_sandbox/node_modules/esprima-fb/examples/tokendist.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 184 |
```html
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>Esprima Documentation</title>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" type="text/css" href="../assets/style.css"/>
<link rel="stylesheet" href="../assets/foundation/foundation.min.css">
<link rel="stylesheet" type="text/css" href="../assets/prettify/prettify.css"/>
<script type="text/javascript" src="../assets/prettify/prettify.js"></script>
<style>
pre.prettyprint {
border: 1px solid #ccc;
background-color: #f8f8f8;
border-radius: 3px;
padding: 6px 10px;
xfont-size: 13px;
xline-height: 19px;
margin-bottom: 14px;
}
</style>
</head>
<body onload="prettyPrint()">
<!-- Navigation bar -->
<div class="row">
<div class="twelve columns">
<nav class="top-bar">
<ul>
<li class="name">
<h1><a href="../index.html">Esprima</a></h1>
</li>
</ul>
<section>
<ul class="right">
<li class="divider show-for-medium-and-up"></li>
<li class="has-dropdown">
<a href="../demo/index.html">Demo</a>
<ul class="dropdown">
<li><label>Static Analysis</label></li>
<li><a href="../demo/parse.html">Online Parsing</a></li>
<li><a href="../demo/validate.html">Syntax Validator</a></li>
<li><a href="../demo/precedence.html">Operator Precedence</a></li>
<li><a href="../demo/collector.html">Regex Collector</a></li>
<li><label>Dynamic Tracing</label></li>
<li><a href="../demo/functiontrace.html">Function Instrumentation</a></li>
<li><label>Code Transformation</label></li>
<li><a href="../demo/rewrite.html">Source Rewrite</a></li>
<li><a href="../demo/minify.html">Minifiy & Obfuscate</a></li>
<li><label>Editing Tools</label></li>
<li><a href="../demo/highlight.html">Identifier Highlight</a></li>
<li><a href="../demo/autocomplete.html">Autocomplete</a></li>
</ul>
</li>
<li class="has-dropdown">
<a href="#">Project</a>
<ul class="dropdown">
<li><a href="path_to_url">Git Repository</a></li>
<li><a href="path_to_url">Continuous Integration</a></li>
<li><a href="path_to_url">Mailing List</a></li>
<li><a href="path_to_url">Issue Tracker</a></li>
<li class="divider"></li>
<li><label>QA</label></li>
<li><a href="../test/index.html">Unit Tests</a></li>
<li><a href="../test/benchmarks.html">Benchmarks Suite</a></li>
<li><a href="../test/compat.html">Compatibility Tests</a></li>
<li><a href="../test/compare.html">Speed Comparison</a></li>
<li><a href="../test/module.html">Module Loading</a></li>
<li><a href="../test/coverage.html">Coverage Analysis</a></li>
</ul>
</li>
<li><a href="../doc/index.html">Documentation</a></li>
</ul>
</section>
</nav>
</div>
</div>
<!-- Title and subtitle -->
<div class="row">
<div class="twelve columns">
<h3 class="subheader"><strong>Documentation</strong> on using Esprima</h3>
</div>
</div>
<!-- Main content -->
<div class="row">
<div class="eight columns">
<h4 id="usage">Basic Usage</h4>
<p>Esprima runs on web browsers (IE 6+, Firefox 1+, Safari 3+, Chrome 1+, Konqueror 4.6+, Opera 8+) as well as
<a href="path_to_url">Rhino</a> and <a href="path_to_url">Node.js</a>.</p>
<h5>In a web browser</h5>
<p>Just include the source file:</p>
<pre class="prettyprint lang-html">
<script src="esprima.js"></script>
</pre>
<p>The module <code>esprima</code> will be available as part of the global window object:</p>
<pre class="prettyprint lang-js">
var syntax = esprima.parse('var answer = 42');
</pre>
<p>Since Esprima supports <a href="path_to_url">AMD</a> (Asynchronous Module Definition), it can be loaded via a module loader such as <a href="path_to_url">RequireJS</a>:</p>
<pre class="prettyprint lang-js">
require(['esprima'], function (parser) {
// Do something with parser, e.g.
var syntax = parser.parse('var answer = 42');
console.log(JSON.stringify(syntax, null, 4));
});
</pre>
<p>Since Esprima is available as a <a href="path_to_url">Bower</a> component, it can be installed with:</p>
<pre class="prettyprint lang-bsh">
bower install esprima
</pre>
<p>Obviously, it can be used with <a href="path_to_url">Yeoman</a> as well:</p>
<pre class="prettyprint lang-bsh">
yeoman install esprima
</pre>
<h5>With Node.js</h5>
<p>Esprima is available as a Node.js <a href="path_to_url">package</a>, install it using npm:</p>
<pre class="prettyprint lang-bsh">
npm install esprima
</pre>
<p>Load the module with <code>require</code> and use it:</p>
<pre class="prettyprint lang-js">
var esprima = require('esprima');
console.log(JSON.stringify(esprima.parse('var answer = 42'), null, 4));
</pre>
<h5>With Rhino</h5>
<p>Load the source file from another script:</p>
<pre class="prettyprint lang-js">
load('/path/to/esprima.js');
</pre>
<p>The module <code>esprima</code> will be available as part of the global object:</p>
<pre class="prettyprint lang-js">
var syntax = esprima.parse('42');
print(JSON.stringify(syntax, null, 2));
</pre>
<h5>Parsing Interface</h5>
<p>Basic usage:
<pre class="prettyprint lang-js">
esprima.parse(code, options);
</pre>
<p>The output of the parser is the syntax tree formatted in <a href="path_to_url">JSON</a>, see the following <a href="#ast">Syntax Tree Format</a> section.</p>
<p>Available options so far (by default, every option <b>false</b>):</p>
<table>
<tr>
<th>Option</th>
<th>When set to true</th>
</tr>
<tr>
<td>loc</td>
<td>Nodes have line and column-based location info</td>
</tr>
<tr>
<td>range</td>
<td>Nodes have an index-based location range (array)</td>
</tr>
<tr>
<td>raw</td>
<td>Literals have extra property which stores the verbatim source</td>
</tr>
<tr>
<td>tokens</td>
<td>An extra array containing all found tokens</td>
</tr>
<tr>
<td>comment</td>
<td>An extra array containing all line and block comments</td>
</tr>
<tr>
<td>tolerant</td>
<td>An extra array containing all errors found,
attempts to continue parsing when an error is encountered</td>
</tr>
</table>
<p>The easiest way to see the different output based on various option settings is to use the <a href="../demo/parse.html">online parser demo</a>.
<p><b>Note</b>: In version > 1.0, <code>raw</code> is ignored since literals always include the verbatim source.</p>
<h4 id="examples">Examples</h4>
<h5 id="nestedternary">Detect Nested Ternary Conditionals</h5>
<p>The script <code>detectnestedternary.js</code> in the <code>examples/</code> subdirectory is using Esprima to look for a ternary conditional, i.e. <a href="path_to_url">operator ?:</a>, which is immediately followed (in one of its code paths) by another ternary conditional. The script can be invoked from the command-line with Node.js:</p>
<pre class="prettyprint lang-bsh">
node detectnestedternary.js /some/path
</pre>
<p>An example code fragment which will be flagged by this script as having a nested ternary conditional:</p>
<pre class="prettyprint lang-js">
var str = (age < 1) ? "baby" :
(age < 5) ? "toddler" :
(age < 18) ? "child": "adult";
</pre>
<p>which will yield the following report:</p>
<pre>
Line 1 : Nested ternary for "age < 1"
Line 2 : Nested ternary for "age < 5"
</pre>
<h5 id="booleantrap">Find Possible Boolean Traps</h5>
<p>The script <code>findbooleantrap.js</code> in the <code>examples/</code> subdirectory is using Esprima to detect some possible cases of Boolean trap, i.e. the use of Boolean literal which may lead to ambiguities and lack of readability. The script can be invoked from command-line with Node.js:</p>
<pre class="prettyprint lang-bsh">
node findbooleantrap.js /some/path
</pre>
It will search for all files (recursively) in the given path, try to parse each file, and then look for signs of Boolean traps:
<ul>
<li>Literal used with a non-setter function (assumption: setter starts with the "set" prefix):</li>
<pre class="prettyprint lang-js">this.refresh(true);</pre>
<li>Literal used with a function whose name may have a double-negative interpretation:</li>
<pre class="prettyprint lang-js">item.setHidden(false);</pre>
<li>Two different literals in a single function call:</li>
<pre class="prettyprint lang-js">element.stop(true, false);</pre>
<li>Multiple literals in a single function invocation:</li>
<pre class="prettyprint lang-js">event.initKeyEvent("keypress", true, true, null, null,
false, false, false, false, 9, 0);</pre>
<li>Ambiguous Boolean literal as the last argument:</li>
<pre class="prettyprint lang-js">return getSomething(obj, false);</pre>
</ul>
For some more info, read also the blog post on <a href="path_to_url">Boolean trap</a>.
<h4 id="ast">Syntax Tree Format</h4>
<p>The output of the parser is expected to be compatible with Mozilla SpiderMonkey <a href="path_to_url">Parser API</a>.
The best way to understand various different constructs is the online <a href="../demo/parse.html">parser demo</a> which shows the syntax tree (formatted with JSON.stringify) corresponding to the typed code.
The simplest example is as follows. If the following code is executed:
<pre class="prettyprint lang-js">
esprima.parse('var answer = 42;');
</pre>
then the return value will be (JSON formatted):
<pre class="prettyprint lang-js">
{
type: 'Program',
body: [
{
type: 'VariableDeclaration',
declarations: [
{
type: 'AssignmentExpression',
operator: =,
left: {
type: 'Identifier',
name: 'answer'
},
right: {
type: 'Literal',
value: 42
}
}
]
}
]
}
</pre>
<h4 id="contribution">Contribution Guide</h4>
<h5>Guidelines</h5>
<p>Contributors are mandated to follow the guides described in the following sections. Any contribution which do not conform to the guides may be rejected.</p>
<h4>Laundry list</h4>
<p>Before creating <a href="path_to_url">pull requests</a>, make sure the following applies.</p>
<p>There is a corresponding issue. If there is no issue yet, <a href="path_to_url">create one</a> in the issue tracker.</p>
<p>The commit log links the corresponding issue (usually as the last line).</p>
<p>No functional regression. Run all <a href="#unittests">unit tests</a>.</p>
<p>No coverage regression. Run the <a href="#coverage">code coverage analysis</a>.</p>
<p>Each commit must be granular. Big changes should be splitted into smaller commits.</p>
<p>Write understandable code. No need to be too terse (or even obfuscated).</p>
<p><a href="path_to_url">JSLint</a> does not complain.</p>
<p>A new feature must be accompanied with unit tests. No compromise.</p>
<p>A new feature should not cause performance loss. Verify with the <a href="#benchmark">benchmark tests</a>.</p>
<p>Performance improvement should be backed up by actual conclusive speed-up in the benchmark suite.</p>
<h4>Coding style</h4>
<p>Indentation is 4 spaces.</p>
<p>Open curly brace is at the end of the line.</p>
<p>String literal uses single quote (') and not double quote (").</p>
<h4>Commit message</h4>
<p>Bad:</p>
<pre>
Fix a problem with Firefox.
</pre>
<p>The above commit is too short and useless in the long term.</p>
<p>Good:</p>
<pre>
Add support for labeled statement.
It is covered in ECMAScript Language Specification Section 12.12.
This also fixes parsing MooTools and JSLint code.
Running the benchmarks suite show negligible performance loss.
path_to_url
path_to_url
path_to_url
</pre>
<p><strong>Important aspects</strong>:</p>
<ul>
<li>The first line is the short description, useful for per-line commit view and thus keep it under 80 characters.</li>
<li>The next paragraphs should provide more explanation (if needed).</li>
<li>Describe the testing situation (new unit/benchmark test, change in performance, etc).</li>
<li>Put the link to the issues for cross-ref.</li>
</ul>
<h4>Baseline syntax tree as the expected result</h4>
<p>The test suite contains a collection of a pair of code and its syntax tree. To generate the syntax tree suitably formatted for the test fixture, use the included helper script <code>tools/generate-test-fixture.js</code> (with Node.js), e.g.:
<pre class="prettyprint lang-bsh">
node tools/generate-test-fixture.js "var answer = 42"
</pre>
The syntax tree will be printed out to the console. This can be used in the test fixture.
<h5 id="tests">Test Workflow</h5>
<p>Before running the tests, prepare the tools via:</p>
<pre class="prettyprint lang-bsh">
npm install
</pre>
<h4 id="unittests">Unit tests</h4>
<p>Browser-based unit testing is available by opening <code>test/index.html</code> in the source tree. The online version is <a href="path_to_url">esprima.org/test</a>.</p>
<p>Command-line testing using Node.js:</p>
<pre class="prettyprint">npm test</pre>
<h4 id="coverage">Code coverage test</h4>
<p>Note: you need to use Node.js 0.6 or later version.</p>
<p>Install istanbul:</p>
<pre class="prettyprint lang-bsh">sudo npm install -g istanbul</pre>
<p>Run it in Esprima source tree:</p>
<pre class="prettyprint lang-bsh">istanbul cover test/runner.js</pre>
<p>To get the detailed report, open <code>coverage/lcov-report/index.html</code> file and choose <code>esprima.js</code> from the list.</p>
<h4 id="benchmark">Benchmark tests</h4>
<p>Available by opening <code>test/benchmarks.html</code> in the source tree. The online version is <a href="path_to_url">esprima.org/test/benchmarks.html</a>.</p>
<p>Note: Because the corpus is fetched via XML HTTP Request, the benchmarks test needs to be served via a web server and not local file.</p>
<p>It is important to run this with various browsers to cover different JavaScript engines.</p>
<p>Command-line benchmark using Node.js:</p>
<pre class="prettyprint lang-bsh">node test/benchmark.js</pre>
<p>Command-line benchmark using V8 shell:</p>
<pre class="prettyprint lang-bsh">/path/to/v8/shell test/benchmark.js</pre>
<h4>Speed comparison tests</h4>
<p>Available by opening <code>test/compare.html</code>. The online version is <a href="path_to_url">esprima.org/test/compare.html</a>.</p>
<p>Note: Because the corpus is fetched via XML HTTP Request, the benchmarks test needs to be served via a web server and not local file.</p>
<p><strong>Warning</strong>: Since each parser has a different format for the syntax tree, the speed is not fully comparable (the cost of constructing different result is not taken into account). These tests exist only to ensure that Esprima parser is not ridiculously slow, e.g. one magnitude slower compare to other parsers.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<ul class="square">
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
</ul>
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
</div>
<div class="four columns">
<div class="panel">
<p><b>Contents</b></p>
<ol>
<li><a href="#usage">Basic Usage</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#ast">Syntax Tree Format</a></li>
<li><a href="#contribution">Contribution Guide</a></li>
</ol>
</div>
</div>
</div>
<!-- Footer -->
<div class="row copyright">
<div class="six columns">
<p>Esprima is created and mantained by <a href="path_to_url">Ariya Hidayat</a>.</p>
</div>
<div class="six columns">
<ul class="link-list right">
<li><a href="path_to_url">@Esprima</a></li>
<li><a href="path_to_url">GitHub</a></li>
</ul>
</div>
</div>
</body>
</html>
``` | /content/code_sandbox/node_modules/esprima-fb/doc/index.html | html | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 4,557 |
```javascript
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var testFixture = {
'Primary Expression': {
'this\n': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'ThisExpression',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
}
}],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
},
tokens: [{
type: 'Keyword',
value: 'this',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}]
},
'null\n': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: null,
raw: 'null',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
}
}],
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 0 }
},
tokens: [{
type: 'Null',
value: 'null',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}]
},
'\n 42\n\n': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
},
range: [5, 9],
loc: {
start: { line: 2, column: 4 },
end: { line: 4, column: 0 }
}
}],
range: [5, 9],
loc: {
start: { line: 2, column: 4 },
end: { line: 4, column: 0 }
},
tokens: [{
type: 'Numeric',
value: '42',
range: [5, 7],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
}]
},
'(1 + 2 ) * 3': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 1,
raw: '1',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'Literal',
value: 2,
raw: '2',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [1, 6],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Literal',
value: 3,
raw: '3',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
}
},
'Grouping Operator': {
'(1) + (2 ) + 3': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 1,
raw: '1',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'Literal',
value: 2,
raw: '2',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
right: {
type: 'Literal',
value: 3,
raw: '3',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'4 + 5 << (6)': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<<',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 4,
raw: '4',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 5,
raw: '5',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Literal',
value: 6,
raw: '6',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
}
},
'Array Initializer': {
'x = []': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
}],
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
},
tokens: [{
type: 'Identifier',
value: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}, {
type: 'Punctuator',
value: '=',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
}, {
type: 'Punctuator',
value: '[',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: ']',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
}]
},
'x = [ ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x = [ 42 ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 42,
raw: '42',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
}],
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
'x = [ 42, ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 42,
raw: '42',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
}],
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'x = [ ,, 42 ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [
null,
null,
{
type: 'Literal',
value: 42,
raw: '42',
range: [9, 11],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 11 }
}
}],
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'x = [ 1, 2, 3, ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 1,
raw: '1',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'Literal',
value: 2,
raw: '2',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}, {
type: 'Literal',
value: 3,
raw: '3',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
}],
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'x = [ 1, 2,, 3, ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 1,
raw: '1',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'Literal',
value: 2,
raw: '2',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}, null, {
type: 'Literal',
value: 3,
raw: '3',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'x = [ "finally", "for" ]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 'finally',
raw: '"finally"',
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}, {
type: 'Literal',
value: 'for',
raw: '"for"',
range: [17, 22],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 22 }
}
}],
range: [4, 24],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
' = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: '',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'T\u203F = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'T\u203F',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'T\u200C = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'T\u200C',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'T\u200D = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'T\u200D',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'\u2163\u2161 = []': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: '\u2163\u2161',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'\u2163\u2161\u200A=\u2009[]': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: '\u2163\u2161',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'[",", "second"]': {
type: 'ExpressionStatement',
expression: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: ',',
raw: '","',
range: [1, 4],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 4 }
}
}, {
type: 'Literal',
value: 'second',
raw: '"second"',
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
}],
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'["notAToken", "if"]': {
type: 'ExpressionStatement',
expression: {
type: 'ArrayExpression',
elements: [{
type: 'Literal',
value: 'notAToken',
raw: '"notAToken"',
range: [1, 12],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 12 }
}
}, {
type: 'Literal',
value: 'if',
raw: '"if"',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
}],
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
}
},
'Object Initializer': {
'x = {}': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [],
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x = { }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x = { answer: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'answer',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [14, 16],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 16 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 16],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 16 }
}
}],
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'x = { if: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'if',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
}],
range: [4, 14],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'x = { true: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'true',
range: [6, 10],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 10 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
}],
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'x = { false: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'false',
range: [6, 11],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 11 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [13, 15],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 15 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'x = { null: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'null',
range: [6, 10],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 10 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
}],
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'x = { "answer": 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 'answer',
raw: '"answer"',
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [16, 18],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 18 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 18],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 18 }
}
}],
range: [4, 20],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'x = { x: 1, x: 2 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [
{
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
value: {
type: 'Literal',
value: 1,
raw: '1',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 10],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 10 }
}
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'x',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
value: {
type: 'Literal',
value: 2,
raw: '2',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [12, 16],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 16 }
}
}
],
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'x = { get width() { return m_width } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'width',
range: [10, 15],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ReturnStatement',
argument: {
type: 'Identifier',
name: 'm_width',
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
range: [20, 35],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 35 }
}
}],
range: [18, 36],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 36 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 36],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 36 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 36],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 36 }
}
}],
range: [4, 38],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 38 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'x = { get undef() {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'undef',
range: [10, 15],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 20],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 20 }
}
}],
range: [4, 22],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'x = { get if() {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'if',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 17],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 17 }
}
}],
range: [4, 19],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'x = { get true() {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'true',
range: [10, 14],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
rest: null,
generator: false,
expression: false,
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 19],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 19 }
}
}],
range: [4, 21],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'x = { get false() {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'false',
range: [10, 15],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 20],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 20 }
}
}],
range: [4, 22],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'x = { get null() {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'null',
range: [10, 14],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
rest: null,
generator: false,
expression: false,
range: [17, 19],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 19 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 19],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 19 }
}
}],
range: [4, 21],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'x = { get "undef"() {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 'undef',
raw: '"undef"',
range: [10, 17],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 17 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 22],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 22 }
}
}],
range: [4, 24],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'x = { get 10() {} }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 10,
raw: '10',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 17],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 17 }
}
}],
range: [4, 19],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'x = { set width(w) { m_width = w } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'width',
range: [10, 15],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'w',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_width',
range: [21, 28],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 28 }
}
},
right: {
type: 'Identifier',
name: 'w',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
},
range: [21, 32],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 32 }
}
},
range: [21, 33],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 33 }
}
}],
range: [19, 34],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 34 }
}
},
rest: null,
generator: false,
expression: false,
range: [19, 34],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 34 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 34],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 34 }
}
}],
range: [4, 36],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'x = { set if(w) { m_if = w } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'if',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'w',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_if',
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
},
right: {
type: 'Identifier',
name: 'w',
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
range: [18, 26],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 26 }
}
},
range: [18, 27],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 27 }
}
}],
range: [16, 28],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 28 }
}
},
rest: null,
generator: false,
expression: false,
range: [16, 28],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 28 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 28],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 28 }
}
}],
range: [4, 30],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 30 }
}
},
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
'x = { set true(w) { m_true = w } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'true',
range: [10, 14],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'w',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_true',
range: [20, 26],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 26 }
}
},
right: {
type: 'Identifier',
name: 'w',
range: [29, 30],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 30 }
}
},
range: [20, 30],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 30 }
}
},
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
}],
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 32],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 32 }
}
}],
range: [4, 34],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 34 }
}
},
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'x = { set false(w) { m_false = w } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'false',
range: [10, 15],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'w',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_false',
range: [21, 28],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 28 }
}
},
right: {
type: 'Identifier',
name: 'w',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
},
range: [21, 32],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 32 }
}
},
range: [21, 33],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 33 }
}
}],
range: [19, 34],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 34 }
}
},
rest: null,
generator: false,
expression: false,
range: [19, 34],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 34 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 34],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 34 }
}
}],
range: [4, 36],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'x = { set null(w) { m_null = w } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'null',
range: [10, 14],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 14 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'w',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_null',
range: [20, 26],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 26 }
}
},
right: {
type: 'Identifier',
name: 'w',
range: [29, 30],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 30 }
}
},
range: [20, 30],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 30 }
}
},
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
}],
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 32],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 32 }
}
}],
range: [4, 34],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 34 }
}
},
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'x = { set "null"(w) { m_null = w } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 'null',
raw: '"null"',
range: [10, 16],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 16 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'w',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_null',
range: [22, 28],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 28 }
}
},
right: {
type: 'Identifier',
name: 'w',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
},
range: [22, 32],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 32 }
}
},
range: [22, 33],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 33 }
}
}],
range: [20, 34],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 34 }
}
},
rest: null,
generator: false,
expression: false,
range: [20, 34],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 34 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 34],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 34 }
}
}],
range: [4, 36],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'x = { set 10(w) { m_null = w } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 10,
raw: '10',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'w',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_null',
range: [18, 24],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 24 }
}
},
right: {
type: 'Identifier',
name: 'w',
range: [27, 28],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 28 }
}
},
range: [18, 28],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 28 }
}
},
range: [18, 29],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 29 }
}
}],
range: [16, 30],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 30 }
}
},
rest: null,
generator: false,
expression: false,
range: [16, 30],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 30 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [6, 30],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 30 }
}
}],
range: [4, 32],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 32 }
}
},
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
'x = { get: 42 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'get',
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 13],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 13 }
}
}],
range: [4, 15],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'x = { set: 43 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'set',
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
value: {
type: 'Literal',
value: 43,
raw: '43',
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 13],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 13 }
}
}],
range: [4, 15],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'x = { __proto__: 2 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: '__proto__',
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'Literal',
value: 2,
raw: '2',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [6, 18],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 18 }
}
}],
range: [4, 20],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'x = {"__proto__": 2 }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: '__proto__',
raw: '"__proto__"',
range: [5, 16],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 16 }
}
},
value: {
type: 'Literal',
value: 2,
raw: '2',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [5, 19],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 19 }
}
}],
range: [4, 21],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'x = { get width() { return m_width }, set width(width) { m_width = width; } }': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'width',
range: [10, 15],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ReturnStatement',
argument: {
type: 'Identifier',
name: 'm_width',
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
range: [20, 35],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 35 }
}
}],
range: [18, 36],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 36 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 36],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 36 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [6, 36],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 36 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'width',
range: [42, 47],
loc: {
start: { line: 1, column: 42 },
end: { line: 1, column: 47 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'width',
range: [48, 53],
loc: {
start: { line: 1, column: 48 },
end: { line: 1, column: 53 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'm_width',
range: [57, 64],
loc: {
start: { line: 1, column: 57 },
end: { line: 1, column: 64 }
}
},
right: {
type: 'Identifier',
name: 'width',
range: [67, 72],
loc: {
start: { line: 1, column: 67 },
end: { line: 1, column: 72 }
}
},
range: [57, 72],
loc: {
start: { line: 1, column: 57 },
end: { line: 1, column: 72 }
}
},
range: [57, 73],
loc: {
start: { line: 1, column: 57 },
end: { line: 1, column: 73 }
}
}],
range: [55, 75],
loc: {
start: { line: 1, column: 55 },
end: { line: 1, column: 75 }
}
},
rest: null,
generator: false,
expression: false,
range: [55, 75],
loc: {
start: { line: 1, column: 55 },
end: { line: 1, column: 75 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [38, 75],
loc: {
start: { line: 1, column: 38 },
end: { line: 1, column: 75 }
}
}],
range: [4, 77],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 77 }
}
},
range: [0, 77],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 77 }
}
},
range: [0, 77],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 77 }
}
}
},
'Comments': {
'/* block comment */ 42': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
range: [20, 22],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 22 }
}
},
'42 /*The*/ /*Answer*/': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
}],
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
},
comments: [{
type: 'Block',
value: 'The',
range: [3, 10],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 10 }
}
}, {
type: 'Block',
value: 'Answer',
range: [11, 21],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 21 }
}
}]
},
'42 /*the*/ /*answer*/': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [0, 2]
},
range: [0, 21]
}],
range: [0, 21],
comments: [{
type: 'Block',
value: 'the',
range: [3, 10]
}, {
type: 'Block',
value: 'answer',
range: [11, 21]
}]
},
'42 /* the * answer */': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'42 /* The * answer */': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
}],
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
},
comments: [{
type: 'Block',
value: ' The * answer ',
range: [3, 21],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 21 }
}
}]
},
'/* multiline\ncomment\nshould\nbe\nignored */ 42': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [42, 44],
loc: {
start: { line: 5, column: 11 },
end: { line: 5, column: 13 }
}
},
range: [42, 44],
loc: {
start: { line: 5, column: 11 },
end: { line: 5, column: 13 }
}
},
'/*a\r\nb*/ 42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [9, 11],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
},
range: [9, 11],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
}],
range: [9, 11],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
},
comments: [{
type: 'Block',
value: 'a\r\nb',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 3 }
}
}]
},
'/*a\rb*/ 42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [8, 10],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
},
range: [8, 10],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
}],
range: [8, 10],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
},
comments: [{
type: 'Block',
value: 'a\rb',
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 3 }
}
}]
},
'/*a\nb*/ 42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [8, 10],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
},
range: [8, 10],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
}],
range: [8, 10],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
},
comments: [{
type: 'Block',
value: 'a\nb',
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 3 }
}
}]
},
'/*a\nc*/ 42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
},
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
}
}],
loc: {
start: { line: 2, column: 4 },
end: { line: 2, column: 6 }
},
comments: [{
type: 'Block',
value: 'a\nc',
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 3 }
}
}]
},
'// line comment\n42': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [16, 18],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
},
range: [16, 18],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
},
'42 // line comment': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
}],
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
},
comments: [{
type: 'Line',
value: ' line comment',
range: [3, 18],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 18 }
}
}]
},
'// Hello, world!\n42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [17, 19],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
},
range: [17, 19],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
}],
range: [17, 19],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
},
comments: [{
type: 'Line',
value: ' Hello, world!',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
}]
},
'// Hello, world!\n': {
type: 'Program',
body: [],
range: [17, 17],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 0 }
},
comments: [{
type: 'Line',
value: ' Hello, world!',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
}]
},
'// Hallo, world!\n': {
type: 'Program',
body: [],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 0 }
},
comments: [{
type: 'Line',
value: ' Hallo, world!',
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
}]
},
'//\n42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [3, 5],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
},
range: [3, 5],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
}],
range: [3, 5],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
},
comments: [{
type: 'Line',
value: '',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
}]
},
'//': {
type: 'Program',
body: [],
range: [2, 2],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 2 }
},
comments: [{
type: 'Line',
value: '',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
}]
},
'// ': {
type: 'Program',
body: [],
range: [3, 3],
comments: [{
type: 'Line',
value: ' ',
range: [0, 3]
}]
},
'/**/42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
}],
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
},
comments: [{
type: 'Block',
value: '',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}]
},
'// Hello, world!\n\n// Another hello\n42': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [37, 39],
loc: {
start: { line: 4, column: 0 },
end: { line: 4, column: 2 }
}
},
range: [37, 39],
loc: {
start: { line: 4, column: 0 },
end: { line: 4, column: 2 }
}
}],
range: [37, 39],
loc: {
start: { line: 4, column: 0 },
end: { line: 4, column: 2 }
},
comments: [{
type: 'Line',
value: ' Hello, world!',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
}, {
type: 'Line',
value: ' Another hello',
range: [18, 36],
loc: {
start: { line: 3, column: 0 },
end: { line: 3, column: 18 }
}
}]
},
'if (x) { // Some comment\ndoThat(); }': {
type: 'Program',
body: [{
type: 'IfStatement',
test: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
consequent: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'doThat',
range: [25, 31],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 6 }
}
},
'arguments': [],
range: [25, 33],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 8 }
}
},
range: [25, 34],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 9 }
}
}],
range: [7, 36],
loc: {
start: { line: 1, column: 7 },
end: { line: 2, column: 11 }
}
},
alternate: null,
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 11 }
}
}],
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 11 }
},
comments: [{
type: 'Line',
value: ' Some comment',
range: [9, 24],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 24 }
}
}]
},
'switch (answer) { case 42: /* perfect */ bingo() }': {
type: 'Program',
body: [{
type: 'SwitchStatement',
discriminant: {
type: 'Identifier',
name: 'answer',
range: [8, 14],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 14 }
}
},
cases: [{
type: 'SwitchCase',
test: {
type: 'Literal',
value: 42,
raw: '42',
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
consequent: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'bingo',
range: [41, 46],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 46 }
}
},
'arguments': [],
range: [41, 48],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 48 }
}
},
range: [41, 49],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 49 }
}
}],
range: [18, 49],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 49 }
}
}],
range: [0, 50],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 50 }
}
}],
range: [0, 50],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 50 }
},
comments: [{
type: 'Block',
value: ' perfect ',
range: [27, 40],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 40 }
}
}]
}
},
'Numeric Literals': {
'0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
'42': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'3': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 3,
raw: '3',
range: [0, 1]
},
range: [0, 1]
}],
range: [0, 1],
tokens: [{
type: 'Numeric',
value: '3',
range: [0, 1]
}]
},
'5': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 5,
raw: '5',
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
},
tokens: [{
type: 'Numeric',
value: '5',
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}]
},
'.14': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0.14,
raw: '.14',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'3.14159': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 3.14159,
raw: '3.14159',
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'6.02214179e+23': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 6.02214179e+23,
raw: '6.02214179e+23',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'1.492417830e-10': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 1.49241783e-10,
raw: '1.492417830e-10',
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'0x0': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0x0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0x0;': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0x0',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0e+100 ': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0e+100',
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'0e+100': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0,
raw: '0e+100',
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'0xabc': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0xabc,
raw: '0xabc',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'0xdef': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0xdef,
raw: '0xdef',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'0X1A': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0x1A,
raw: '0X1A',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0x10': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0x10,
raw: '0x10',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'0x100': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0x100,
raw: '0x100',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'0X04': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 0X04,
raw: '0X04',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'02': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 2,
raw: '02',
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'012': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 10,
raw: '012',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'0012': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 10,
raw: '0012',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
}
},
'String Literals': {
'"Hello"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello',
raw: '"Hello"',
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'"\\n\\r\\t\\v\\b\\f\\\\\\\'\\"\\0"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: '\n\r\t\x0B\b\f\\\'"\x00',
raw: '"\\n\\r\\t\\v\\b\\f\\\\\\\'\\"\\0"',
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'"\\u0061"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'a',
raw: '"\\u0061"',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'"\\x61"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'a',
raw: '"\\x61"',
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'"\\u00"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'u00',
raw: '"\\u00"',
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'"\\xt"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'xt',
raw: '"\\xt"',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'"Hello\\nworld"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\nworld',
raw: '"Hello\\nworld"',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'"Hello\\\nworld"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Helloworld',
raw: '"Hello\\\nworld"',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 14 }
}
},
'"Hello\\02World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\u0002World',
raw: '"Hello\\02World"',
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'"Hello\\012World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\u000AWorld',
raw: '"Hello\\012World"',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'"Hello\\122World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\122World',
raw: '"Hello\\122World"',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'"Hello\\0122World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\u000A2World',
raw: '"Hello\\0122World"',
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'"Hello\\312World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\u00CAWorld',
raw: '"Hello\\312World"',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'"Hello\\412World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\412World',
raw: '"Hello\\412World"',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'"Hello\\812World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello812World',
raw: '"Hello\\812World"',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'"Hello\\712World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\712World',
raw: '"Hello\\712World"',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'"Hello\\0World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\u0000World',
raw: '"Hello\\0World"',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'"Hello\\\r\nworld"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Helloworld',
raw: '"Hello\\\r\nworld"',
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 15 }
}
},
'"Hello\\1World"': {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'Hello\u0001World',
raw: '"Hello\\1World"',
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
}
},
'Regular Expression Literals': {
'var x = /[a-z]/i': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: '/[a-z]/i',
raw: '/[a-z]/i',
range: [8, 16],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 16 }
}
},
range: [4, 16],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
}],
kind: 'var',
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
}],
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
},
tokens: [{
type: 'Keyword',
value: 'var',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
value: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: '=',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'RegularExpression',
value: '/[a-z]/i',
range: [8, 16],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 16 }
}
}]
},
'var x = /[x-z]/i': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5]
},
init: {
type: 'Literal',
value: '/[x-z]/i',
raw: '/[x-z]/i',
range: [8, 16]
},
range: [4, 16]
}],
kind: 'var',
range: [0, 16]
}],
range: [0, 16],
tokens: [{
type: 'Keyword',
value: 'var',
range: [0, 3]
}, {
type: 'Identifier',
value: 'x',
range: [4, 5]
}, {
type: 'Punctuator',
value: '=',
range: [6, 7]
}, {
type: 'RegularExpression',
value: '/[x-z]/i',
range: [8, 16]
}]
},
'var x = /[a-c]/i': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: '/[a-c]/i',
raw: '/[a-c]/i',
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 16 }
}
},
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 16 }
}
}],
kind: 'var',
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
}],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
},
tokens: [{
type: 'Keyword',
value: 'var',
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
value: 'x',
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: '=',
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'RegularExpression',
value: '/[a-c]/i',
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 16 }
}
}]
},
'var x = /[P QR]/i': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: '/[P QR]/i',
raw: '/[P QR]/i',
range: [8, 17],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 17 }
}
},
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
}],
kind: 'var',
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
}],
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
},
tokens: [{
type: 'Keyword',
value: 'var',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
value: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: '=',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'RegularExpression',
value: '/[P QR]/i',
range: [8, 17],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 17 }
}
}]
},
'var x = /foo\\/bar/': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: '/foo\\/bar/',
raw: '/foo\\/bar/',
range: [8, 18],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 18 }
}
},
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
}],
kind: 'var',
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
}],
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
},
tokens: [{
type: 'Keyword',
value: 'var',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
value: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: '=',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'RegularExpression',
value: '/foo\\/bar/',
range: [8, 18],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 18 }
}
}]
},
'var x = /=([^=\\s])+/g': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: '/=([^=\\s])+/g',
raw: '/=([^=\\s])+/g',
range: [8, 21],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 21 }
}
},
range: [4, 21],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 21 }
}
}],
kind: 'var',
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
}],
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
},
tokens: [{
type: 'Keyword',
value: 'var',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
value: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: '=',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'RegularExpression',
value: '/=([^=\\s])+/g',
range: [8, 21],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 21 }
}
}]
},
'var x = /[P QR]/\\u0067': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: '/[P QR]/g',
raw: '/[P QR]/\\u0067',
range: [8, 22],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 22 }
}
},
range: [4, 22],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 22 }
}
}],
kind: 'var',
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
}],
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
},
tokens: [{
type: 'Keyword',
value: 'var',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
value: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: '=',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'RegularExpression',
value: '/[P QR]/\\u0067',
range: [8, 22],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 22 }
}
}]
},
'var x = /[P QR]/\\g': {
type: 'Program',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: '/[P QR]/g',
raw: '/[P QR]/\\g',
range: [8, 18],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 18 }
}
},
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
}],
kind: 'var',
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
}],
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
},
tokens: [{
type: 'Keyword',
value: 'var',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
}, {
type: 'Identifier',
value: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'Punctuator',
value: '=',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}, {
type: 'RegularExpression',
value: '/[P QR]/\\g',
range: [8, 18],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 18 }
}
}]
},
'var x = /42/g.test': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Literal',
value: '/42/g',
raw: '/42/g',
range: [8, 13],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 13 }
}
},
property: {
type: 'Identifier',
name: 'test',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
range: [8, 18],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 18 }
}
},
range: [4, 18],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 18 }
}
}],
kind: 'var',
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
}
},
'Left-Hand-Side Expression': {
'new Button': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'Identifier',
name: 'Button',
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
'arguments': [],
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
'new Button()': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'Identifier',
name: 'Button',
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
},
'arguments': [],
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'new new foo': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'NewExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [8, 11],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 11 }
}
},
'arguments': [],
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
'arguments': [],
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'new new foo()': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'NewExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [8, 11],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 11 }
}
},
'arguments': [],
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
},
'arguments': [],
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'new foo().bar()': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'NewExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
'arguments': [],
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
property: {
type: 'Identifier',
name: 'bar',
range: [10, 13],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'arguments': [],
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
},
'new foo[bar]': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'MemberExpression',
computed: true,
object: {
type: 'Identifier',
name: 'foo',
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
property: {
type: 'Identifier',
name: 'bar',
range: [8, 11],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 11 }
}
},
range: [4, 12],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 12 }
}
},
'arguments': [],
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'new foo.bar()': {
type: 'ExpressionStatement',
expression: {
type: 'NewExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'foo',
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
property: {
type: 'Identifier',
name: 'bar',
range: [8, 11],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 11 }
}
},
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
'arguments': [],
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'( new foo).bar()': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'NewExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [6, 9],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 9 }
}
},
'arguments': [],
range: [2, 9],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 9 }
}
},
property: {
type: 'Identifier',
name: 'bar',
range: [11, 14],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'arguments': [],
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'foo(bar, baz)': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'arguments': [{
type: 'Identifier',
name: 'bar',
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
}, {
type: 'Identifier',
name: 'baz',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
}],
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'( foo )()': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'foo',
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
},
'arguments': [],
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'universe.milkyway': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'milkyway',
range: [9, 17],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'universe.milkyway.solarsystem': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'milkyway',
range: [9, 17],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
property: {
type: 'Identifier',
name: 'solarsystem',
range: [18, 29],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 29 }
}
},
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'universe.milkyway.solarsystem.Earth': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'milkyway',
range: [9, 17],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
property: {
type: 'Identifier',
name: 'solarsystem',
range: [18, 29],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 29 }
}
},
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
property: {
type: 'Identifier',
name: 'Earth',
range: [30, 35],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 35 }
}
},
range: [0, 35],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 35 }
}
},
range: [0, 35],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 35 }
}
},
'universe[galaxyName, otherUselessName]': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: true,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'SequenceExpression',
expressions: [{
type: 'Identifier',
name: 'galaxyName',
range: [9, 19],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 19 }
}
}, {
type: 'Identifier',
name: 'otherUselessName',
range: [21, 37],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 37 }
}
}],
range: [9, 37],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 37 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'universe[galaxyName]': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: true,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'galaxyName',
range: [9, 19],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 19 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'universe[42].galaxies': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: true,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Literal',
value: 42,
raw: '42',
range: [9, 11],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 11 }
}
},
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
property: {
type: 'Identifier',
name: 'galaxies',
range: [13, 21],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'universe(42).galaxies': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'arguments': [{
type: 'Literal',
value: 42,
raw: '42',
range: [9, 11],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 11 }
}
}],
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
property: {
type: 'Identifier',
name: 'galaxies',
range: [13, 21],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'universe(42).galaxies(14, 3, 77).milkyway': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'arguments': [{
type: 'Literal',
value: 42,
raw: '42',
range: [9, 11],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 11 }
}
}],
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
property: {
type: 'Identifier',
name: 'galaxies',
range: [13, 21],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 21 }
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'arguments': [{
type: 'Literal',
value: 14,
raw: '14',
range: [22, 24],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 24 }
}
}, {
type: 'Literal',
value: 3,
raw: '3',
range: [26, 27],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 27 }
}
}, {
type: 'Literal',
value: 77,
raw: '77',
range: [29, 31],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 31 }
}
}],
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
property: {
type: 'Identifier',
name: 'milkyway',
range: [33, 41],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 41 }
}
},
range: [0, 41],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 41 }
}
},
range: [0, 41],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 41 }
}
},
'earth.asia.Indonesia.prepareForElection(2014)': {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'earth',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
property: {
type: 'Identifier',
name: 'asia',
range: [6, 10],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
property: {
type: 'Identifier',
name: 'Indonesia',
range: [11, 20],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
property: {
type: 'Identifier',
name: 'prepareForElection',
range: [21, 39],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 39 }
}
},
range: [0, 39],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 39 }
}
},
'arguments': [{
type: 'Literal',
value: 2014,
raw: '2014',
range: [40, 44],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 44 }
}
}],
range: [0, 45],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 45 }
}
},
range: [0, 45],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 45 }
}
},
'universe.if': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'if',
range: [9, 11],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'universe.true': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'true',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'universe.false': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'false',
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'universe.null': {
type: 'ExpressionStatement',
expression: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'universe',
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
property: {
type: 'Identifier',
name: 'null',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}
},
'Postfix Expressions': {
'x++': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
prefix: false,
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'x--': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
prefix: false,
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'eval++': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'eval',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
prefix: false,
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'eval--': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'eval',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
prefix: false,
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'arguments++': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'arguments',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
prefix: false,
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'arguments--': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'arguments',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
prefix: false,
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
}
},
'Unary Operators': {
'++x': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'x',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
},
prefix: true,
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'--x': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'x',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
},
prefix: true,
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
range: [0, 3],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 3 }
}
},
'++eval': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'eval',
range: [2, 6],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 6 }
}
},
prefix: true,
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'--eval': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'eval',
range: [2, 6],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 6 }
}
},
prefix: true,
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'++arguments': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'arguments',
range: [2, 11],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 11 }
}
},
prefix: true,
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'--arguments': {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'arguments',
range: [2, 11],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 11 }
}
},
prefix: true,
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'+x': {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: '+',
argument: {
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'-x': {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: '-',
argument: {
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'~x': {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: '~',
argument: {
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'!x': {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: '!',
argument: {
type: 'Identifier',
name: 'x',
range: [1, 2],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
},
'void x': {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: 'void',
argument: {
type: 'Identifier',
name: 'x',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'delete x': {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: 'delete',
argument: {
type: 'Identifier',
name: 'x',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'typeof x': {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: 'typeof',
argument: {
type: 'Identifier',
name: 'x',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
}
},
'Multiplicative Operators': {
'x * y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'x / y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '/',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'x % y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '%',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
}
},
'Additive Operators': {
'x + y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'x - y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '-',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'"use strict" + 42': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
}
},
'Bitwise Shift Operator': {
'x << y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<<',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x >> y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '>>',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x >>> y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '>>>',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
}
},
'Relational Operators': {
'x < y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'x > y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '>',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'x <= y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x >= y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '>=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x in y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: 'in',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x instanceof y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: 'instanceof',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'x < y < z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
}
},
'Equality Operators': {
'x == y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '==',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x != y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '!=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x === y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '===',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x !== y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '!==',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
}
},
'Binary Bitwise Operators': {
'x & y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '&',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'x ^ y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '^',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'x | y': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '|',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
}
},
'Binary Expressions': {
'x + y + z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x - y + z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'BinaryExpression',
operator: '-',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x + y - z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '-',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x - y - z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '-',
left: {
type: 'BinaryExpression',
operator: '-',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x + y * z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x + y / z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'BinaryExpression',
operator: '/',
left: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x - y % z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '-',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'BinaryExpression',
operator: '%',
left: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x * y * z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x * y / z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '/',
left: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x * y % z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '%',
left: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x % y * z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'BinaryExpression',
operator: '%',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x << y << z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '<<',
left: {
type: 'BinaryExpression',
operator: '<<',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'x | y | z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '|',
left: {
type: 'BinaryExpression',
operator: '|',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x & y & z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '&',
left: {
type: 'BinaryExpression',
operator: '&',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x ^ y ^ z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '^',
left: {
type: 'BinaryExpression',
operator: '^',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x & y | z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '|',
left: {
type: 'BinaryExpression',
operator: '&',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x | y ^ z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '|',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'BinaryExpression',
operator: '^',
left: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x | y & z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '|',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'BinaryExpression',
operator: '&',
left: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
}
},
'Binary Logical Operators': {
'x || y': {
type: 'ExpressionStatement',
expression: {
type: 'LogicalExpression',
operator: '||',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x && y': {
type: 'ExpressionStatement',
expression: {
type: 'LogicalExpression',
operator: '&&',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'x || y || z': {
type: 'ExpressionStatement',
expression: {
type: 'LogicalExpression',
operator: '||',
left: {
type: 'LogicalExpression',
operator: '||',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'x && y && z': {
type: 'ExpressionStatement',
expression: {
type: 'LogicalExpression',
operator: '&&',
left: {
type: 'LogicalExpression',
operator: '&&',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'x || y && z': {
type: 'ExpressionStatement',
expression: {
type: 'LogicalExpression',
operator: '||',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'LogicalExpression',
operator: '&&',
left: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
range: [5, 11],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'x || y ^ z': {
type: 'ExpressionStatement',
expression: {
type: 'LogicalExpression',
operator: '||',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'BinaryExpression',
operator: '^',
left: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'Identifier',
name: 'z',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
range: [5, 10],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
}
},
'Conditional Operator': {
'y ? 1 : 2': {
type: 'ExpressionStatement',
expression: {
type: 'ConditionalExpression',
test: {
type: 'Identifier',
name: 'y',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
consequent: {
type: 'Literal',
value: 1,
raw: '1',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
alternate: {
type: 'Literal',
value: 2,
raw: '2',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x && y ? 1 : 2': {
type: 'ExpressionStatement',
expression: {
type: 'ConditionalExpression',
test: {
type: 'LogicalExpression',
operator: '&&',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
consequent: {
type: 'Literal',
value: 1,
raw: '1',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
alternate: {
type: 'Literal',
value: 2,
raw: '2',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
}
},
'Assignment Operators': {
'x = 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'eval = 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'eval',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [7, 9],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'arguments = 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'arguments',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'x *= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '*=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x /= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '/=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x %= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '%=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x += 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '+=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x -= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '-=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x <<= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '<<=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'x >>= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '>>=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [6, 8],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'x >>>= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '>>>=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [7, 9],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'x &= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '&=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x ^= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '^=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'x |= 42': {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '|=',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [5, 7],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
}
},
'Complex Expression': {
'a || b && c | d ^ e & f == g < h >>> i + j * k': {
type: 'ExpressionStatement',
expression: {
type: 'LogicalExpression',
operator: '||',
left: {
type: 'Identifier',
name: 'a',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
right: {
type: 'LogicalExpression',
operator: '&&',
left: {
type: 'Identifier',
name: 'b',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
right: {
type: 'BinaryExpression',
operator: '|',
left: {
type: 'Identifier',
name: 'c',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
right: {
type: 'BinaryExpression',
operator: '^',
left: {
type: 'Identifier',
name: 'd',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
right: {
type: 'BinaryExpression',
operator: '&',
left: {
type: 'Identifier',
name: 'e',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
right: {
type: 'BinaryExpression',
operator: '==',
left: {
type: 'Identifier',
name: 'f',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
right: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'g',
range: [27, 28],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 28 }
}
},
right: {
type: 'BinaryExpression',
operator: '>>>',
left: {
type: 'Identifier',
name: 'h',
range: [31, 32],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 32 }
}
},
right: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'i',
range: [37, 38],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 38 }
}
},
right: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'j',
range: [41, 42],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 42 }
}
},
right: {
type: 'Identifier',
name: 'k',
range: [45, 46],
loc: {
start: { line: 1, column: 45 },
end: { line: 1, column: 46 }
}
},
range: [41, 46],
loc: {
start: { line: 1, column: 41 },
end: { line: 1, column: 46 }
}
},
range: [37, 46],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 46 }
}
},
range: [31, 46],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 46 }
}
},
range: [27, 46],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 46 }
}
},
range: [22, 46],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 46 }
}
},
range: [18, 46],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 46 }
}
},
range: [14, 46],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 46 }
}
},
range: [10, 46],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 46 }
}
},
range: [5, 46],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 46 }
}
},
range: [0, 46],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 46 }
}
},
range: [0, 46],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 46 }
}
}
},
'Block': {
'{ foo }': {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'foo',
range: [2, 5],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 5 }
}
},
range: [2, 6],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 6 }
}
}],
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'{ doThis(); doThat(); }': {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'doThis',
range: [2, 8],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 8 }
}
},
'arguments': [],
range: [2, 10],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 10 }
}
},
range: [2, 11],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 11 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'doThat',
range: [12, 18],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 18 }
}
},
'arguments': [],
range: [12, 20],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 20 }
}
},
range: [12, 21],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 21 }
}
}],
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
'{}': {
type: 'BlockStatement',
body: [],
range: [0, 2],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 2 }
}
}
},
'Variable Statement': {
'var x': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: null,
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
kind: 'var',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'var x, y;': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: null,
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'y',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
init: null,
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
}],
kind: 'var',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'var x = 42': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [8, 10],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 10 }
}
},
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
}],
kind: 'var',
range: [0, 10],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 10 }
}
},
'var eval = 42, arguments = 42': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'eval',
range: [4, 8],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 8 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'arguments',
range: [15, 24],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 24 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
range: [15, 29],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 29 }
}
}],
kind: 'var',
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'var x = 14, y = 3, z = 1977': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: {
type: 'Literal',
value: 14,
raw: '14',
range: [8, 10],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 10 }
}
},
range: [4, 10],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 10 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'y',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
init: {
type: 'Literal',
value: 3,
raw: '3',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
range: [12, 17],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 17 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'z',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
init: {
type: 'Literal',
value: 1977,
raw: '1977',
range: [23, 27],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 27 }
}
},
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
}],
kind: 'var',
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'var implements, interface, package': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'implements',
range: [4, 14],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 14 }
}
},
init: null,
range: [4, 14],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 14 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'interface',
range: [16, 25],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 25 }
}
},
init: null,
range: [16, 25],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 25 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'package',
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
},
init: null,
range: [27, 34],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 34 }
}
}],
kind: 'var',
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'var private, protected, public, static': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'private',
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
init: null,
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'protected',
range: [13, 22],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 22 }
}
},
init: null,
range: [13, 22],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 22 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'public',
range: [24, 30],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 30 }
}
},
init: null,
range: [24, 30],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 30 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'static',
range: [32, 38],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 38 }
}
},
init: null,
range: [32, 38],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 38 }
}
}],
kind: 'var',
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
}
},
'Let Statement': {
'let x': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: null,
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
kind: 'let',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
'{ let x }': {
type: 'BlockStatement',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
init: null,
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
}],
kind: 'let',
range: [2, 8],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 8 }
}
}],
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'{ let x = 42 }': {
type: 'BlockStatement',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
}],
kind: 'let',
range: [2, 13],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 13 }
}
}],
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'{ let x = 14, y = 3, z = 1977 }': {
type: 'BlockStatement',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'Literal',
value: 14,
raw: '14',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'y',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
init: {
type: 'Literal',
value: 3,
raw: '3',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
range: [14, 19],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 19 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'z',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
init: {
type: 'Literal',
value: 1977,
raw: '1977',
range: [25, 29],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 29 }
}
},
range: [21, 29],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 29 }
}
}],
kind: 'let',
range: [2, 30],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 30 }
}
}],
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
}
},
'Const Statement': {
'const x = 42': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
}],
kind: 'const',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
'{ const x = 42 }': {
type: 'BlockStatement',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'Literal',
value: 42,
raw: '42',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [8, 14],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 14 }
}
}],
kind: 'const',
range: [2, 15],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 15 }
}
}],
range: [0, 16],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 16 }
}
},
'{ const x = 14, y = 3, z = 1977 }': {
type: 'BlockStatement',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'Literal',
value: 14,
raw: '14',
range: [12, 14],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 14 }
}
},
range: [8, 14],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 14 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'y',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
init: {
type: 'Literal',
value: 3,
raw: '3',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 }
}
},
range: [16, 21],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 21 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'z',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
init: {
type: 'Literal',
value: 1977,
raw: '1977',
range: [27, 31],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 31 }
}
},
range: [23, 31],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 31 }
}
}],
kind: 'const',
range: [2, 32],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 32 }
}
}],
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
}
},
'Empty Statement': {
';': {
type: 'EmptyStatement',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}
},
'Expression Statement': {
'x': {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
},
'x, y': {
type: 'ExpressionStatement',
expression: {
type: 'SequenceExpression',
expressions: [{
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 }
}
}, {
type: 'Identifier',
name: 'y',
range: [3, 4],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 4 }
}
}],
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
'\\u0061': {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'a',
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
},
'a\\u0061': {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'aa',
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'\\u0061a': {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'aa',
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
'\\u0061a ': {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'aa',
range: [0, 7],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 7 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
}
},
'If Statement': {
'if (morning) goodMorning()': {
type: 'IfStatement',
test: {
type: 'Identifier',
name: 'morning',
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
consequent: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'goodMorning',
range: [13, 24],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 24 }
}
},
'arguments': [],
range: [13, 26],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 26 }
}
},
range: [13, 26],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 26 }
}
},
alternate: null,
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'if (morning) (function(){})': {
type: 'IfStatement',
test: {
type: 'Identifier',
name: 'morning',
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
consequent: {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [24, 26],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 26 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 26],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 26 }
}
},
range: [13, 27],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 27 }
}
},
alternate: null,
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'if (morning) var x = 0;': {
type: 'IfStatement',
test: {
type: 'Identifier',
name: 'morning',
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
consequent: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
init: {
type: 'Literal',
value: 0,
raw: '0',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
range: [17, 22],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 22 }
}
}],
kind: 'var',
range: [13, 23],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 23 }
}
},
alternate: null,
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
'if (morning) function a(){}': {
type: 'IfStatement',
test: {
type: 'Identifier',
name: 'morning',
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
consequent: {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'a',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [25, 27],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 27 }
}
},
rest: null,
generator: false,
expression: false,
range: [13, 27],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 27 }
}
},
alternate: null,
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'if (morning) goodMorning(); else goodDay()': {
type: 'IfStatement',
test: {
type: 'Identifier',
name: 'morning',
range: [4, 11],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 11 }
}
},
consequent: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'goodMorning',
range: [13, 24],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 24 }
}
},
'arguments': [],
range: [13, 26],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 26 }
}
},
range: [13, 27],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 27 }
}
},
alternate: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'goodDay',
range: [33, 40],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 40 }
}
},
'arguments': [],
range: [33, 42],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 42 }
}
},
range: [33, 42],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 42 }
}
},
range: [0, 42],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 42 }
}
}
},
'Iteration Statements': {
'do keep(); while (true)': {
type: 'DoWhileStatement',
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'keep',
range: [3, 7],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 7 }
}
},
'arguments': [],
range: [3, 9],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 9 }
}
},
range: [3, 10],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 10 }
}
},
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
},
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
'do keep(); while (true);': {
type: 'DoWhileStatement',
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'keep',
range: [3, 7],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 7 }
}
},
'arguments': [],
range: [3, 9],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 9 }
}
},
range: [3, 10],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 10 }
}
},
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'do { x++; y--; } while (x < 10)': {
type: 'DoWhileStatement',
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'x',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 }
}
},
prefix: false,
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
},
range: [5, 9],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 9 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'y',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
prefix: false,
range: [10, 13],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 13 }
}
},
range: [10, 14],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 14 }
}
}],
range: [3, 16],
loc: {
start: { line: 1, column: 3 },
end: { line: 1, column: 16 }
}
},
test: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'x',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
},
right: {
type: 'Literal',
value: 10,
raw: '10',
range: [28, 30],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 30 }
}
},
range: [24, 30],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 30 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'{ do { } while (false) false }': {
type: 'BlockStatement',
body: [{
type: 'DoWhileStatement',
body: {
type: 'BlockStatement',
body: [],
range: [5, 8],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 8 }
}
},
test: {
type: 'Literal',
value: false,
raw: 'false',
range: [16, 21],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 21 }
}
},
range: [2, 22],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 22 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: false,
raw: 'false',
range: [23, 28],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 28 }
}
},
range: [23, 29],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 29 }
}
}],
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
'while (true) doSomething()': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'doSomething',
range: [13, 24],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 24 }
}
},
'arguments': [],
range: [13, 26],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 26 }
}
},
range: [13, 26],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 26 }
}
},
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'while (x < 10) { x++; y--; }': {
type: 'WhileStatement',
test: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'x',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
right: {
type: 'Literal',
value: 10,
raw: '10',
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
range: [7, 13],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 13 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'x',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
},
prefix: false,
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
},
range: [17, 21],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 21 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'y',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
prefix: false,
range: [22, 25],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 25 }
}
},
range: [22, 26],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 26 }
}
}],
range: [15, 28],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 28 }
}
},
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
},
'for(;;);': {
type: 'ForStatement',
init: null,
test: null,
update: null,
body: {
type: 'EmptyStatement',
range: [7, 8],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 8 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'for(;;){}': {
type: 'ForStatement',
init: null,
test: null,
update: null,
body: {
type: 'BlockStatement',
body: [],
range: [7, 9],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 9 }
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
'for(x = 0;;);': {
type: 'ForStatement',
init: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Literal',
value: 0,
raw: '0',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
test: null,
update: null,
body: {
type: 'EmptyStatement',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'for(var x = 0;;);': {
type: 'ForStatement',
init: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'Literal',
value: 0,
raw: '0',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
range: [8, 13],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 13 }
}
}],
kind: 'var',
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
},
test: null,
update: null,
body: {
type: 'EmptyStatement',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'for(let x = 0;;);': {
type: 'ForStatement',
init: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'Literal',
value: 0,
raw: '0',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
range: [8, 13],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 13 }
}
}],
kind: 'let',
range: [4, 13],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 13 }
}
},
test: null,
update: null,
body: {
type: 'EmptyStatement',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 }
}
},
'for(var x = 0, y = 1;;);': {
type: 'ForStatement',
init: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'Literal',
value: 0,
raw: '0',
range: [12, 13],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 13 }
}
},
range: [8, 13],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'y',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
init: {
type: 'Literal',
value: 1,
raw: '1',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
range: [15, 20],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 20 }
}
}],
kind: 'var',
range: [4, 20],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 20 }
}
},
test: null,
update: null,
body: {
type: 'EmptyStatement',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'for(x = 0; x < 42;);': {
type: 'ForStatement',
init: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Literal',
value: 0,
raw: '0',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
test: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'x',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
range: [11, 17],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 17 }
}
},
update: null,
body: {
type: 'EmptyStatement',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'for(x = 0; x < 42; x++);': {
type: 'ForStatement',
init: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Literal',
value: 0,
raw: '0',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
test: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'x',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
range: [11, 17],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 17 }
}
},
update: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'x',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
prefix: false,
range: [19, 22],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 22 }
}
},
body: {
type: 'EmptyStatement',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'for(x = 0; x < 42; x++) process(x);': {
type: 'ForStatement',
init: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Literal',
value: 0,
raw: '0',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
test: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'x',
range: [11, 12],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 12 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [15, 17],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 17 }
}
},
range: [11, 17],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 17 }
}
},
update: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'x',
range: [19, 20],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 20 }
}
},
prefix: false,
range: [19, 22],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 22 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [24, 31],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 31 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [32, 33],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 33 }
}
}],
range: [24, 34],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 34 }
}
},
range: [24, 35],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 35 }
}
},
range: [0, 35],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 35 }
}
},
'for(x in list) process(x);': {
type: 'ForInStatement',
left: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [15, 22],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 22 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
}],
range: [15, 25],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 25 }
}
},
range: [15, 26],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 26 }
}
},
each: false,
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'for (var x in list) process(x);': {
type: 'ForInStatement',
left: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
init: null,
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}],
kind: 'var',
range: [5, 10],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
}],
range: [20, 30],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 30 }
}
},
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
},
each: false,
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'for (let x in list) process(x);': {
type: 'ForInStatement',
left: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
init: null,
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
}],
kind: 'let',
range: [5, 10],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 10 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
}],
range: [20, 30],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 30 }
}
},
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
},
each: false,
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'for (var i = function() { return 10 in [] } of list) process(x);': {
type: 'ForOfStatement',
left: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'i',
range: [9, 10],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 10 }
}
},
init: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ReturnStatement',
argument: {
type: 'BinaryExpression',
operator: 'in',
left: {
type: 'Literal',
value: 10,
raw: '10',
range: [33, 35],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 35 }
}
},
right: {
type: 'ArrayExpression',
elements: [],
range: [39, 41],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 41 }
}
},
range: [33, 41],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 41 }
}
},
range: [26, 42],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 42 }
}
}],
range: [24, 43],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 43 }
}
},
rest: null,
generator: false,
expression: false,
range: [13, 43],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 43 }
}
},
range: [9, 43],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 43 }
}
}],
kind: 'var',
range: [5, 43],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 43 }
}
},
right: {
type: 'Identifier',
name: 'list',
range: [47, 51],
loc: {
start: { line: 1, column: 47 },
end: { line: 1, column: 51 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'process',
range: [53, 60],
loc: {
start: { line: 1, column: 53 },
end: { line: 1, column: 60 }
}
},
'arguments': [{
type: 'Identifier',
name: 'x',
range: [61, 62],
loc: {
start: { line: 1, column: 61 },
end: { line: 1, column: 62 }
}
}],
range: [53, 63],
loc: {
start: { line: 1, column: 53 },
end: { line: 1, column: 63 }
}
},
range: [53, 64],
loc: {
start: { line: 1, column: 53 },
end: { line: 1, column: 64 }
}
},
range: [0, 64],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 64 }
}
}
},
'continue statement': {
'while (true) { continue; }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [
{
type: 'ContinueStatement',
label: null,
range: [15, 24],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 24 }
}
}
],
range: [13, 26],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 26 }
}
},
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
},
'while (true) { continue }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [
{
type: 'ContinueStatement',
label: null,
range: [15, 24],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 24 }
}
}
],
range: [13, 25],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 25 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'done: while (true) { continue done }': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'done',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
body: {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [13, 17],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 17 }
}
},
body: {
type: 'BlockStatement',
body: [
{
type: 'ContinueStatement',
label: {
type: 'Identifier',
name: 'done',
range: [30, 34],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 34 }
}
},
range: [21, 35],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 35 }
}
}
],
range: [19, 36],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 36 }
}
},
range: [6, 36],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 36 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
}
},
'done: while (true) { continue done; }': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'done',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
body: {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [13, 17],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 17 }
}
},
body: {
type: 'BlockStatement',
body: [
{
type: 'ContinueStatement',
label: {
type: 'Identifier',
name: 'done',
range: [30, 34],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 34 }
}
},
range: [21, 35],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 35 }
}
}
],
range: [19, 37],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 37 }
}
},
range: [6, 37],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 37 }
}
},
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
}
},
'__proto__: while (true) { continue __proto__; }': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: '__proto__',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
body: {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ContinueStatement',
label: {
type: 'Identifier',
name: '__proto__',
range: [35, 44],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 44 }
}
},
range: [26, 45],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 45 }
}
}],
range: [24, 47],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 47 }
}
},
range: [11, 47],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 47 }
}
},
range: [0, 47],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 47 }
}
}
},
'break statement': {
'while (true) { break }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [
{
type: 'BreakStatement',
label: null,
range: [15, 21],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 21 }
}
}
],
range: [13, 22],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'done: while (true) { break done }': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'done',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
body: {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [13, 17],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 17 }
}
},
body: {
type: 'BlockStatement',
body: [
{
type: 'BreakStatement',
label: {
type: 'Identifier',
name: 'done',
range: [27, 31],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 31 }
}
},
range: [21, 32],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 32 }
}
}
],
range: [19, 33],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 33 }
}
},
range: [6, 33],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 33 }
}
},
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
},
'done: while (true) { break done; }': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'done',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
body: {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [13, 17],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 17 }
}
},
body: {
type: 'BlockStatement',
body: [
{
type: 'BreakStatement',
label: {
type: 'Identifier',
name: 'done',
range: [27, 31],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 31 }
}
},
range: [21, 32],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 32 }
}
}
],
range: [19, 34],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 34 }
}
},
range: [6, 34],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 34 }
}
},
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'__proto__: while (true) { break __proto__; }': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: '__proto__',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
body: {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'BreakStatement',
label: {
type: 'Identifier',
name: '__proto__',
range: [32, 41],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 41 }
}
},
range: [26, 42],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 42 }
}
}],
range: [24, 44],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 44 }
}
},
range: [11, 44],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 44 }
}
},
range: [0, 44],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 44 }
}
}
},
'return statement': {
'(function(){ return })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: null,
range: [13, 20],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 20 }
}
}
],
range: [11, 21],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 21 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 21],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 21 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
},
'(function(){ return; })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: null,
range: [13, 20],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 20 }
}
}
],
range: [11, 22],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 22 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 22],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 22 }
}
},
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
'(function(){ return x; })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: {
type: 'Identifier',
name: 'x',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 }
}
},
range: [13, 22],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 22 }
}
}
],
range: [11, 24],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 24 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 24],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 24 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'(function(){ return x * y })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
},
range: [20, 25],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 25 }
}
},
range: [13, 26],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 26 }
}
}
],
range: [11, 27],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 27 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 27],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 27 }
}
},
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
}
},
'with statement': {
'with (x) foo = bar': {
type: 'WithStatement',
object: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
right: {
type: 'Identifier',
name: 'bar',
range: [15, 18],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 18 }
}
},
range: [9, 18],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 18 }
}
},
range: [9, 18],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 18 }
}
},
range: [0, 18],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 18 }
}
},
'with (x) foo = bar;': {
type: 'WithStatement',
object: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'foo',
range: [9, 12],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 12 }
}
},
right: {
type: 'Identifier',
name: 'bar',
range: [15, 18],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 18 }
}
},
range: [9, 18],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 18 }
}
},
range: [9, 19],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 19 }
}
},
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'with (x) { foo = bar }': {
type: 'WithStatement',
object: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'foo',
range: [11, 14],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 14 }
}
},
right: {
type: 'Identifier',
name: 'bar',
range: [17, 20],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 20 }
}
},
range: [11, 20],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 20 }
}
},
range: [11, 21],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 21 }
}
}],
range: [9, 22],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 22 }
}
},
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
}
}
},
'switch statement': {
'switch (x) {}': {
type: 'SwitchStatement',
discriminant: {
type: 'Identifier',
name: 'x',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 }
}
},
cases:[],
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
},
'switch (answer) { case 42: hi(); break; }': {
type: 'SwitchStatement',
discriminant: {
type: 'Identifier',
name: 'answer',
range: [8, 14],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 14 }
}
},
cases: [{
type: 'SwitchCase',
test: {
type: 'Literal',
value: 42,
raw: '42',
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
consequent: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'hi',
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
'arguments': [],
range: [27, 31],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 31 }
}
},
range: [27, 32],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 32 }
}
}, {
type: 'BreakStatement',
label: null,
range: [33, 39],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 39 }
}
}],
range: [18, 39],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 39 }
}
}],
range: [0, 41],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 41 }
}
},
'switch (answer) { case 42: hi(); break; default: break }': {
type: 'SwitchStatement',
discriminant: {
type: 'Identifier',
name: 'answer',
range: [8, 14],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 14 }
}
},
cases: [{
type: 'SwitchCase',
test: {
type: 'Literal',
value: 42,
raw: '42',
range: [23, 25],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 25 }
}
},
consequent: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'hi',
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
'arguments': [],
range: [27, 31],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 31 }
}
},
range: [27, 32],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 32 }
}
}, {
type: 'BreakStatement',
label: null,
range: [33, 39],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 39 }
}
}],
range: [18, 39],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 39 }
}
}, {
type: 'SwitchCase',
test: null,
consequent: [{
type: 'BreakStatement',
label: null,
range: [49, 55],
loc: {
start: { line: 1, column: 49 },
end: { line: 1, column: 55 }
}
}],
range: [40, 55],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 55 }
}
}],
range: [0, 56],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 56 }
}
}
},
'Labelled Statements': {
'start: for (;;) break start': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'start',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
body: {
type: 'ForStatement',
init: null,
test: null,
update: null,
body: {
type: 'BreakStatement',
label: {
type: 'Identifier',
name: 'start',
range: [22, 27],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 27 }
}
},
range: [16, 27],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 27 }
}
},
range: [7, 27],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 27 }
}
},
range: [0, 27],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 27 }
}
},
'start: while (true) break start': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: 'start',
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
},
body: {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
body: {
type: 'BreakStatement',
label: {
type: 'Identifier',
name: 'start',
range: [26, 31],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 31 }
}
},
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
},
range: [7, 31],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 31 }
}
},
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
}
},
'__proto__: test': {
type: 'LabeledStatement',
label: {
type: 'Identifier',
name: '__proto__',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
},
body: {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'test',
range: [11, 15],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 15 }
}
},
range: [11, 15],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 15 }
}
},
range: [0, 15],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 15 }
}
}
},
'throw statement': {
'throw x;': {
type: 'ThrowStatement',
argument: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
range: [0, 8],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 8 }
}
},
'throw x * y': {
type: 'ThrowStatement',
argument: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
right: {
type: 'Identifier',
name: 'y',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 }
}
},
range: [6, 11],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 11 }
}
},
range: [0, 11],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 11 }
}
},
'throw { message: "Error" }': {
type: 'ThrowStatement',
argument: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'message',
range: [8, 15],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 15 }
}
},
value: {
type: 'Literal',
value: 'Error',
raw: '"Error"',
range: [17, 24],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 24 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [8, 24],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 24 }
}
}],
range: [6, 26],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 26 }
}
},
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
}
}
},
'try statement': {
'try { } catch (e) { }': {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'e',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
body: {
type: 'BlockStatement',
body: [],
range: [18, 21],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 21 }
}
},
range: [8, 21],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 21 }
}
}],
finalizer: null,
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
}
},
'try { } catch (eval) { }': {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'eval',
range: [15, 19],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 19 }
}
},
body: {
type: 'BlockStatement',
body: [],
range: [21, 24],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 24 }
}
},
range: [8, 24],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 24 }
}
}],
finalizer: null,
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'try { } catch (arguments) { }': {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'arguments',
range: [15, 24],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 24 }
}
},
body: {
type: 'BlockStatement',
body: [],
range: [26, 29],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 29 }
}
},
range: [8, 29],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 29 }
}
}],
finalizer: null,
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'try { } catch (e) { say(e) }': {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'e',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'say',
range: [20, 23],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 23 }
}
},
'arguments': [{
type: 'Identifier',
name: 'e',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
}],
range: [20, 26],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 26 }
}
},
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
}],
range: [18, 28],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 28 }
}
},
range: [8, 28],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 28 }
}
}],
finalizer: null,
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
}
},
'try { } finally { cleanup(stuff) }': {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [],
range: [4, 7],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 7 }
}
},
guardedHandlers: [],
handlers: [],
finalizer: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'cleanup',
range: [18, 25],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 25 }
}
},
'arguments': [{
type: 'Identifier',
name: 'stuff',
range: [26, 31],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 31 }
}
}],
range: [18, 32],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 32 }
}
},
range: [18, 33],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 33 }
}
}],
range: [16, 34],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 34 }
}
},
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'try { doThat(); } catch (e) { say(e) }': {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'doThat',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
'arguments': [],
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
},
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'e',
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'say',
range: [30, 33],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 33 }
}
},
'arguments': [{
type: 'Identifier',
name: 'e',
range: [34, 35],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 35 }
}
}],
range: [30, 36],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 36 }
}
},
range: [30, 37],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 37 }
}
}],
range: [28, 38],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 38 }
}
},
range: [18, 38],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 38 }
}
}],
finalizer: null,
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'try { doThat(); } catch (e) { say(e) } finally { cleanup(stuff) }': {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'doThat',
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
},
'arguments': [],
range: [6, 14],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 14 }
}
},
range: [6, 15],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 15 }
}
}],
range: [4, 17],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 17 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'e',
range: [25, 26],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 26 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'say',
range: [30, 33],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 33 }
}
},
'arguments': [{
type: 'Identifier',
name: 'e',
range: [34, 35],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 35 }
}
}],
range: [30, 36],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 36 }
}
},
range: [30, 37],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 37 }
}
}],
range: [28, 38],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 38 }
}
},
range: [18, 38],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 38 }
}
}],
finalizer: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'cleanup',
range: [49, 56],
loc: {
start: { line: 1, column: 49 },
end: { line: 1, column: 56 }
}
},
'arguments': [{
type: 'Identifier',
name: 'stuff',
range: [57, 62],
loc: {
start: { line: 1, column: 57 },
end: { line: 1, column: 62 }
}
}],
range: [49, 63],
loc: {
start: { line: 1, column: 49 },
end: { line: 1, column: 63 }
}
},
range: [49, 64],
loc: {
start: { line: 1, column: 49 },
end: { line: 1, column: 64 }
}
}],
range: [47, 65],
loc: {
start: { line: 1, column: 47 },
end: { line: 1, column: 65 }
}
},
range: [0, 65],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 65 }
}
}
},
'debugger statement': {
'debugger;': {
type: 'DebuggerStatement',
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 }
}
}
},
'Function Definition': {
'function hello() { sayHi(); }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'hello',
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'sayHi',
range: [19, 24],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 24 }
}
},
'arguments': [],
range: [19, 26],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 26 }
}
},
range: [19, 27],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 27 }
}
}],
range: [17, 29],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 29 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'function eval() { }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'eval',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [16, 19],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 19 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
}
},
'function arguments() { }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'arguments',
range: [9, 18],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 18 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [21, 24],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 24 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
}
},
'function test(t, t) { }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'test',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [{
type: 'Identifier',
name: 't',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
}, {
type: 'Identifier',
name: 't',
range: [17, 18],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 18 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [20, 23],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 23 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
}
},
'(function test(t, t) { })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'test',
range: [10, 14],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 14 }
}
},
params: [{
type: 'Identifier',
name: 't',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}, {
type: 'Identifier',
name: 't',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [21, 24],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 24 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 24],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 24 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 25 }
}
},
'function eval() { function inner() { "use strict" } }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'eval',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'inner',
range: [27, 32],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 32 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\"use strict\"',
range: [37, 49],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 49 }
}
},
range: [37, 50],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 50 }
}
}],
range: [35, 51],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 51 }
}
},
rest: null,
generator: false,
expression: false,
range: [18, 51],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 51 }
}
}],
range: [16, 53],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 53 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 53],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 53 }
}
},
'function hello(a) { sayHi(); }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'hello',
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
params: [{
type: 'Identifier',
name: 'a',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'sayHi',
range: [20, 25],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 25 }
}
},
'arguments': [],
range: [20, 27],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 27 }
}
},
range: [20, 28],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 28 }
}
}],
range: [18, 30],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 30 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 30],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 30 }
}
},
'function hello(a, b) { sayHi(); }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'hello',
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
params: [{
type: 'Identifier',
name: 'a',
range: [15, 16],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 16 }
}
}, {
type: 'Identifier',
name: 'b',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'sayHi',
range: [23, 28],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 28 }
}
},
'arguments': [],
range: [23, 30],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 30 }
}
},
range: [23, 31],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 31 }
}
}],
range: [21, 33],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 33 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
}
},
'var hi = function() { sayHi() };': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'hi',
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
init: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'sayHi',
range: [22, 27],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 27 }
}
},
'arguments': [],
range: [22, 29],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 29 }
}
},
range: [22, 30],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 30 }
}
}],
range: [20, 31],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 31 }
}
},
rest: null,
generator: false,
expression: false,
range: [9, 31],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 31 }
}
},
range: [4, 31],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 31 }
}
}],
kind: 'var',
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
'var hi = function eval() { };': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'hi',
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
init: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'eval',
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [25, 28],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 28 }
}
},
rest: null,
generator: false,
expression: false,
range: [9, 28],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 28 }
}
},
range: [4, 28],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 28 }
}
}],
kind: 'var',
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 29 }
}
},
'var hi = function arguments() { };': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'hi',
range: [4, 6],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 6 }
}
},
init: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'arguments',
range: [18, 27],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 27 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [30, 33],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 33 }
}
},
rest: null,
generator: false,
expression: false,
range: [9, 33],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 33 }
}
},
range: [4, 33],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 33 }
}
}],
kind: 'var',
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
}
},
'var hello = function hi() { sayHi() };': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'hello',
range: [4, 9],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 9 }
}
},
init: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'hi',
range: [21, 23],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 23 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'sayHi',
range: [28, 33],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 33 }
}
},
'arguments': [],
range: [28, 35],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 35 }
}
},
range: [28, 36],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 36 }
}
}],
range: [26, 37],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: false,
expression: false,
range: [12, 37],
loc: {
start: { line: 1, column: 12 },
end: { line: 1, column: 37 }
}
},
range: [4, 37],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 37 }
}
}],
kind: 'var',
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
},
'(function(){})': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [11, 13],
loc: {
start: { line: 1, column: 11 },
end: { line: 1, column: 13 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 13],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 13 }
}
},
range: [0, 14],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 14 }
}
},
'function universe(__proto__) { }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'universe',
range: [9, 17],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 17 }
}
},
params: [{
type: 'Identifier',
name: '__proto__',
range: [18, 27],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 27 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [29, 32],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 32 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 32 }
}
},
'function test() { "use strict" + 42; }': {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'test',
range: [9, 13],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 13 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [18, 30],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 30 }
}
},
right: {
type: 'Literal',
value: 42,
raw: '42',
range: [33, 35],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 35 }
}
},
range: [18, 35],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 35 }
}
},
range: [18, 36],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 36 }
}
}],
range: [16, 38],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 38 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
}
}
},
'Automatic semicolon insertion': {
'{ x\n++y }': {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'x',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
},
range: [2, 4],
loc: {
start: { line: 1, column: 2 },
end: { line: 2, column: 0 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'y',
range: [6, 7],
loc: {
start: { line: 2, column: 2 },
end: { line: 2, column: 3 }
}
},
prefix: true,
range: [4, 7],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 3 }
}
},
range: [4, 8],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 4 }
}
}],
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 5 }
}
},
'{ x\n--y }': {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'x',
range: [2, 3],
loc: {
start: { line: 1, column: 2 },
end: { line: 1, column: 3 }
}
},
range: [2, 4],
loc: {
start: { line: 1, column: 2 },
end: { line: 2, column: 0 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'y',
range: [6, 7],
loc: {
start: { line: 2, column: 2 },
end: { line: 2, column: 3 }
}
},
prefix: true,
range: [4, 7],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 3 }
}
},
range: [4, 8],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 4 }
}
}],
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 5 }
}
},
'var x /* comment */;': {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
},
init: null,
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 }
}
}],
kind: 'var',
range: [0, 20],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 20 }
}
},
'{ var x = 14, y = 3\nz; }': {
type: 'BlockStatement',
body: [{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [6, 7],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 7 }
}
},
init: {
type: 'Literal',
value: 14,
raw: '14',
range: [10, 12],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 12 }
}
},
range: [6, 12],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 12 }
}
}, {
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'y',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
init: {
type: 'Literal',
value: 3,
raw: '3',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
range: [14, 19],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 19 }
}
}],
kind: 'var',
range: [2, 20],
loc: {
start: { line: 1, column: 2 },
end: { line: 2, column: 0 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'z',
range: [20, 21],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 1 }
}
},
range: [20, 22],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
}],
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 4 }
}
},
'while (true) { continue\nthere; }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ContinueStatement',
label: null,
range: [15, 23],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 23 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'there',
range: [24, 29],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 5 }
}
},
range: [24, 30],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 6 }
}
}],
range: [13, 32],
loc: {
start: { line: 1, column: 13 },
end: { line: 2, column: 8 }
}
},
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 8 }
}
},
'while (true) { continue // Comment\nthere; }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ContinueStatement',
label: null,
range: [15, 23],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 23 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'there',
range: [35, 40],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 5 }
}
},
range: [35, 41],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 6 }
}
}],
range: [13, 43],
loc: {
start: { line: 1, column: 13 },
end: { line: 2, column: 8 }
}
},
range: [0, 43],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 8 }
}
},
'while (true) { continue /* Multiline\nComment */there; }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'ContinueStatement',
label: null,
range: [15, 23],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 23 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'there',
range: [47, 52],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 15 }
}
},
range: [47, 53],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 16 }
}
}],
range: [13, 55],
loc: {
start: { line: 1, column: 13 },
end: { line: 2, column: 18 }
}
},
range: [0, 55],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 18 }
}
},
'while (true) { break\nthere; }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'BreakStatement',
label: null,
range: [15, 20],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 20 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'there',
range: [21, 26],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 5 }
}
},
range: [21, 27],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 6 }
}
}],
range: [13, 29],
loc: {
start: { line: 1, column: 13 },
end: { line: 2, column: 8 }
}
},
range: [0, 29],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 8 }
}
},
'while (true) { break // Comment\nthere; }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'BreakStatement',
label: null,
range: [15, 20],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 20 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'there',
range: [32, 37],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 5 }
}
},
range: [32, 38],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 6 }
}
}],
range: [13, 40],
loc: {
start: { line: 1, column: 13 },
end: { line: 2, column: 8 }
}
},
range: [0, 40],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 8 }
}
},
'while (true) { break /* Multiline\nComment */there; }': {
type: 'WhileStatement',
test: {
type: 'Literal',
value: true,
raw: 'true',
range: [7, 11],
loc: {
start: { line: 1, column: 7 },
end: { line: 1, column: 11 }
}
},
body: {
type: 'BlockStatement',
body: [{
type: 'BreakStatement',
label: null,
range: [15, 20],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 20 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'there',
range: [44, 49],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 15 }
}
},
range: [44, 50],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 16 }
}
}],
range: [13, 52],
loc: {
start: { line: 1, column: 13 },
end: { line: 2, column: 18 }
}
},
range: [0, 52],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 18 }
}
},
'(function(){ return\nx; })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: null,
range: [13, 19],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 19 }
}
},
{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'x',
range: [20, 21],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 1 }
}
},
range: [20, 22],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
}
],
range: [11, 24],
loc: {
start: { line: 1, column: 11 },
end: { line: 2, column: 4 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 24],
loc: {
start: { line: 1, column: 1 },
end: { line: 2, column: 4 }
}
},
range: [0, 25],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 5 }
}
},
'(function(){ return // Comment\nx; })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: null,
range: [13, 19],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 19 }
}
},
{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'x',
range: [31, 32],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 1 }
}
},
range: [31, 33],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 2 }
}
}
],
range: [11, 35],
loc: {
start: { line: 1, column: 11 },
end: { line: 2, column: 4 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 35],
loc: {
start: { line: 1, column: 1 },
end: { line: 2, column: 4 }
}
},
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 5 }
}
},
'(function(){ return/* Multiline\nComment */x; })': {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: null,
range: [13, 19],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 19 }
}
},
{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'x',
range: [42, 43],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 11 }
}
},
range: [42, 44],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 12 }
}
}
],
range: [11, 46],
loc: {
start: { line: 1, column: 11 },
end: { line: 2, column: 14 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 46],
loc: {
start: { line: 1, column: 1 },
end: { line: 2, column: 14 }
}
},
range: [0, 47],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 15 }
}
},
'{ throw error\nerror; }': {
type: 'BlockStatement',
body: [{
type: 'ThrowStatement',
argument: {
type: 'Identifier',
name: 'error',
range: [8, 13],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 13 }
}
},
range: [2, 14],
loc: {
start: { line: 1, column: 2 },
end: { line: 2, column: 0 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'error',
range: [14, 19],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 5 }
}
},
range: [14, 20],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 6 }
}
}],
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 8 }
}
},
'{ throw error// Comment\nerror; }': {
type: 'BlockStatement',
body: [{
type: 'ThrowStatement',
argument: {
type: 'Identifier',
name: 'error',
range: [8, 13],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 13 }
}
},
range: [2, 24],
loc: {
start: { line: 1, column: 2 },
end: { line: 2, column: 0 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'error',
range: [24, 29],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 5 }
}
},
range: [24, 30],
loc: {
start: { line: 2, column: 0 },
end: { line: 2, column: 6 }
}
}],
range: [0, 32],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 8 }
}
},
'{ throw error/* Multiline\nComment */error; }': {
type: 'BlockStatement',
body: [{
type: 'ThrowStatement',
argument: {
type: 'Identifier',
name: 'error',
range: [8, 13],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 13 }
}
},
range: [2, 36],
loc: {
start: { line: 1, column: 2 },
end: { line: 2, column: 10 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'error',
range: [36, 41],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 15 }
}
},
range: [36, 42],
loc: {
start: { line: 2, column: 10 },
end: { line: 2, column: 16 }
}
}],
range: [0, 44],
loc: {
start: { line: 1, column: 0 },
end: { line: 2, column: 18 }
}
}
},
'Source elements': {
'': {
type: 'Program',
body: [],
range: [0, 0],
loc: {
start: { line: 0, column: 0 },
end: { line: 0, column: 0 }
},
tokens: []
}
},
'Source option': {
'x + y - z': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '-',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'x',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 },
source: '42.js'
}
},
right: {
type: 'Identifier',
name: 'y',
range: [4, 5],
loc: {
start: { line: 1, column: 4 },
end: { line: 1, column: 5 },
source: '42.js'
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 },
source: '42.js'
}
},
right: {
type: 'Identifier',
name: 'z',
range: [8, 9],
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 9 },
source: '42.js'
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 },
source: '42.js'
}
},
range: [0, 9],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 9 },
source: '42.js'
}
},
'a + (b < (c * d)) + e': {
type: 'ExpressionStatement',
expression: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'BinaryExpression',
operator: '+',
left: {
type: 'Identifier',
name: 'a',
range: [0, 1],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 },
source: '42.js'
}
},
right: {
type: 'BinaryExpression',
operator: '<',
left: {
type: 'Identifier',
name: 'b',
range: [5, 6],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 6 },
source: '42.js'
}
},
right: {
type: 'BinaryExpression',
operator: '*',
left: {
type: 'Identifier',
name: 'c',
range: [10, 11],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 11 },
source: '42.js'
}
},
right: {
type: 'Identifier',
name: 'd',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 },
source: '42.js'
}
},
range: [10, 15],
loc: {
start: { line: 1, column: 10 },
end: { line: 1, column: 15 },
source: '42.js'
}
},
range: [5, 16],
loc: {
start: { line: 1, column: 5 },
end: { line: 1, column: 16 },
source: '42.js'
}
},
range: [0, 17],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 17 },
source: '42.js'
}
},
right: {
type: 'Identifier',
name: 'e',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 },
source: '42.js'
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 },
source: '42.js'
}
},
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 },
source: '42.js'
}
}
},
'Invalid syntax': {
'{': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected end of input'
},
'}': {
index: 0,
lineNumber: 1,
column: 1,
message: 'Error: Line 1: Unexpected token }'
},
'3ea': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'3in []': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'3e': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'3e+': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'3e-': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'3x': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'3x0': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0x': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'09': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'018': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'01a': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'3in[]': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'0x3in[]': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'"Hello\nWorld"': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'x\\': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'x\\u005c': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'x\\u002a': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'var x = /(s/g': {
index: 13,
lineNumber: 1,
column: 14,
message: 'Error: Line 1: Invalid regular expression'
},
'a\\u': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'\\ua': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'/': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Invalid regular expression: missing /'
},
'/test': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Invalid regular expression: missing /'
},
'var x = /[a-z]/\\ux': {
index: 18,
lineNumber: 1,
column: 19,
message: 'Error: Line 1: Invalid regular expression'
},
'3 = 4': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'func() = 4': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'(1 + 1) = 10': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'1++': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'1--': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'++1': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'--1': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'for((1 + 1) in list) process(x);': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Invalid left-hand side in for-in'
},
'[': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected end of input'
},
'[,': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected end of input'
},
'1 + {': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected end of input'
},
'1 + { t:t ': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Unexpected end of input'
},
'1 + { t:t,': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Unexpected end of input'
},
'var x = /\n/': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Invalid regular expression: missing /'
},
'var x = "\n': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'var if = 42': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Unexpected token if'
},
'i #= 42': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'i + 2 = 42': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'+i = 42': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Invalid left-hand side in assignment'
},
'1 + (': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected end of input'
},
'\n\n\n{': {
index: 4,
lineNumber: 4,
column: 2,
message: 'Error: Line 4: Unexpected end of input'
},
'\n/* Some multiline\ncomment */\n)': {
index: 30,
lineNumber: 4,
column: 1,
message: 'Error: Line 4: Unexpected token )'
},
'{ set 1 }': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected number'
},
'{ get 2 }': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected number'
},
'({ set: s(if) { } })': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Unexpected token if'
},
'({ set s(.) { } })': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token .'
},
'({ set: s() { } })': {
index: 12,
lineNumber: 1,
column: 13,
message: 'Error: Line 1: Unexpected token {'
},
'({ set: s(a, b) { } })': {
index: 16,
lineNumber: 1,
column: 17,
message: 'Error: Line 1: Unexpected token {'
},
'({ get: g(d) { } })': {
index: 13,
lineNumber: 1,
column: 14,
message: 'Error: Line 1: Unexpected token {'
},
'({ get i() { }, i: 42 })': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Object literal may not have data and accessor property with the same name'
},
'({ i: 42, get i() { } })': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Object literal may not have data and accessor property with the same name'
},
'({ set i(x) { }, i: 42 })': {
index: 22,
lineNumber: 1,
column: 23,
message: 'Error: Line 1: Object literal may not have data and accessor property with the same name'
},
'({ i: 42, set i(x) { } })': {
index: 22,
lineNumber: 1,
column: 23,
message: 'Error: Line 1: Object literal may not have data and accessor property with the same name'
},
'({ get i() { }, get i() { } })': {
index: 27,
lineNumber: 1,
column: 28,
message: 'Error: Line 1: Object literal may not have multiple get/set accessors with the same name'
},
'({ set i(x) { }, set i(x) { } })': {
index: 29,
lineNumber: 1,
column: 30,
message: 'Error: Line 1: Object literal may not have multiple get/set accessors with the same name'
},
'function t(if) { }': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Unexpected token if'
},
'function t(true) { }': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Unexpected token true'
},
'function t(false) { }': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Unexpected token false'
},
'function t(null) { }': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Unexpected token null'
},
'function null() { }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token null'
},
'function true() { }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token true'
},
'function false() { }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token false'
},
'function if() { }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token if'
},
'a b;': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected identifier'
},
'if.a;': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token .'
},
'a if;': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token if'
},
'a class;': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected reserved word'
},
'break\n': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Illegal break statement'
},
'break 1;': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected number'
},
'continue\n': {
index: 8,
lineNumber: 1,
column: 9,
message: 'Error: Line 1: Illegal continue statement'
},
'continue 2;': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected number'
},
'throw': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected end of input'
},
'throw;': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected token ;'
},
'throw\n': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Illegal newline after throw'
},
'for (var i, i2 in {});': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Unexpected token in'
},
'for ((i in {}));': {
index: 14,
lineNumber: 1,
column: 15,
message: 'Error: Line 1: Unexpected token )'
},
'for (i + 1 in {});': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Invalid left-hand side in for-in'
},
'for (+i in {});': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Invalid left-hand side in for-in'
},
'if(false)': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected end of input'
},
'if(false) doThis(); else': {
index: 24,
lineNumber: 1,
column: 25,
message: 'Error: Line 1: Unexpected end of input'
},
'do': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected end of input'
},
'while(false)': {
index: 12,
lineNumber: 1,
column: 13,
message: 'Error: Line 1: Unexpected end of input'
},
'for(;;)': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected end of input'
},
'with(x)': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected end of input'
},
'try { }': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Missing catch or finally after try'
},
'\u203F = 10': {
index: 0,
lineNumber: 1,
column: 1,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'const x = 12, y;': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Const must be initialized'
},
'const x, y = 12;': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Const must be initialized'
},
'const x;': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Const must be initialized'
},
'if(true) let a = 1;': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token let'
},
'if(true) const a = 1;': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token const'
},
'switch (c) { default: default: }': {
index: 30,
lineNumber: 1,
column: 31,
message: 'Error: Line 1: More than one default clause in switch statement'
},
'new X()."s"': {
index: 8,
lineNumber: 1,
column: 9,
message: 'Error: Line 1: Unexpected string'
},
'/*': {
index: 2,
lineNumber: 1,
column: 3,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'/*\n\n\n': {
index: 5,
lineNumber: 4,
column: 1,
message: 'Error: Line 4: Unexpected token ILLEGAL'
},
'/**': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'/*\n\n*': {
index: 5,
lineNumber: 3,
column: 2,
message: 'Error: Line 3: Unexpected token ILLEGAL'
},
'/*hello': {
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'/*hello *': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'\n]': {
index: 1,
lineNumber: 2,
column: 1,
message: 'Error: Line 2: Unexpected token ]'
},
'\r]': {
index: 1,
lineNumber: 2,
column: 1,
message: 'Error: Line 2: Unexpected token ]'
},
'\r\n]': {
index: 2,
lineNumber: 2,
column: 1,
message: 'Error: Line 2: Unexpected token ]'
},
'\n\r]': {
index: 2,
lineNumber: 3,
column: 1,
message: 'Error: Line 3: Unexpected token ]'
},
'//\r\n]': {
index: 4,
lineNumber: 2,
column: 1,
message: 'Error: Line 2: Unexpected token ]'
},
'//\n\r]': {
index: 4,
lineNumber: 3,
column: 1,
message: 'Error: Line 3: Unexpected token ]'
},
'/a\\\n/': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Invalid regular expression: missing /'
},
'//\r \n]': {
index: 5,
lineNumber: 3,
column: 1,
message: 'Error: Line 3: Unexpected token ]'
},
'/*\r\n*/]': {
index: 6,
lineNumber: 2,
column: 3,
message: 'Error: Line 2: Unexpected token ]'
},
'/*\n\r*/]': {
index: 6,
lineNumber: 3,
column: 3,
message: 'Error: Line 3: Unexpected token ]'
},
'/*\r \n*/]': {
index: 7,
lineNumber: 3,
column: 3,
message: 'Error: Line 3: Unexpected token ]'
},
'\\\\': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'\\u005c': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'\\x': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'\\u0000': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'\u200C = []': {
index: 0,
lineNumber: 1,
column: 1,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'\u200D = []': {
index: 0,
lineNumber: 1,
column: 1,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'"\\': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'"\\u': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected token ILLEGAL'
},
'try { } catch() {}': {
index: 14,
lineNumber: 1,
column: 15,
message: 'Error: Line 1: Unexpected token )'
},
'return': {
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Illegal return statement'
},
'break': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Illegal break statement'
},
'continue': {
index: 8,
lineNumber: 1,
column: 9,
message: 'Error: Line 1: Illegal continue statement'
},
'switch (x) { default: continue; }': {
index: 31,
lineNumber: 1,
column: 32,
message: 'Error: Line 1: Illegal continue statement'
},
'do { x } *': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Unexpected token *'
},
'while (true) { break x; }': {
index: 22,
lineNumber: 1,
column: 23,
message: 'Error: Line 1: Undefined label \'x\''
},
'while (true) { continue x; }': {
index: 25,
lineNumber: 1,
column: 26,
message: 'Error: Line 1: Undefined label \'x\''
},
'x: while (true) { (function () { break x; }); }': {
index: 40,
lineNumber: 1,
column: 41,
message: 'Error: Line 1: Undefined label \'x\''
},
'x: while (true) { (function () { continue x; }); }': {
index: 43,
lineNumber: 1,
column: 44,
message: 'Error: Line 1: Undefined label \'x\''
},
'x: while (true) { (function () { break; }); }': {
index: 39,
lineNumber: 1,
column: 40,
message: 'Error: Line 1: Illegal break statement'
},
'x: while (true) { (function () { continue; }); }': {
index: 42,
lineNumber: 1,
column: 43,
message: 'Error: Line 1: Illegal continue statement'
},
'x: while (true) { x: while (true) { } }': {
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Label \'x\' has already been declared'
},
'(function () { \'use strict\'; delete i; }())': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Delete of an unqualified identifier in strict mode.'
},
'(function () { \'use strict\'; with (i); }())': {
index: 28,
lineNumber: 1,
column: 29,
message: 'Error: Line 1: Strict mode code may not include a with statement'
},
'function hello() {\'use strict\'; ({ i: 42, i: 42 }) }': {
index: 47,
lineNumber: 1,
column: 48,
message: 'Error: Line 1: Duplicate data property in object literal not allowed in strict mode'
},
'function hello() {\'use strict\'; ({ hasOwnProperty: 42, hasOwnProperty: 42 }) }': {
index: 73,
lineNumber: 1,
column: 74,
message: 'Error: Line 1: Duplicate data property in object literal not allowed in strict mode'
},
'function hello() {\'use strict\'; var eval = 10; }': {
index: 40,
lineNumber: 1,
column: 41,
message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; var arguments = 10; }': {
index: 45,
lineNumber: 1,
column: 46,
message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; try { } catch (eval) { } }': {
index: 51,
lineNumber: 1,
column: 52,
message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; try { } catch (arguments) { } }': {
index: 56,
lineNumber: 1,
column: 57,
message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; eval = 10; }': {
index: 32,
lineNumber: 1,
column: 33,
message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode'
},
'function hello() {\'use strict\'; arguments = 10; }': {
index: 32,
lineNumber: 1,
column: 33,
message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode'
},
'function hello() {\'use strict\'; ++eval; }': {
index: 38,
lineNumber: 1,
column: 39,
message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; --eval; }': {
index: 38,
lineNumber: 1,
column: 39,
message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; ++arguments; }': {
index: 43,
lineNumber: 1,
column: 44,
message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; --arguments; }': {
index: 43,
lineNumber: 1,
column: 44,
message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; eval++; }': {
index: 36,
lineNumber: 1,
column: 37,
message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; eval--; }': {
index: 36,
lineNumber: 1,
column: 37,
message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; arguments++; }': {
index: 41,
lineNumber: 1,
column: 42,
message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; arguments--; }': {
index: 41,
lineNumber: 1,
column: 42,
message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode'
},
'function hello() {\'use strict\'; function eval() { } }': {
index: 41,
lineNumber: 1,
column: 42,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; function arguments() { } }': {
index: 41,
lineNumber: 1,
column: 42,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'function eval() {\'use strict\'; }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'function arguments() {\'use strict\'; }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; (function eval() { }()) }': {
index: 42,
lineNumber: 1,
column: 43,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; (function arguments() { }()) }': {
index: 42,
lineNumber: 1,
column: 43,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'(function eval() {\'use strict\'; })()': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'(function arguments() {\'use strict\'; })()': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'function hello() {\'use strict\'; ({ s: function eval() { } }); }': {
index: 47,
lineNumber: 1,
column: 48,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'(function package() {\'use strict\'; })()': {
index: 10,
lineNumber: 1,
column: 11,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() {\'use strict\'; ({ i: 10, set s(eval) { } }); }': {
index: 48,
lineNumber: 1,
column: 49,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function hello() {\'use strict\'; ({ set s(eval) { } }); }': {
index: 41,
lineNumber: 1,
column: 42,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function hello() {\'use strict\'; ({ s: function s(eval) { } }); }': {
index: 49,
lineNumber: 1,
column: 50,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function hello(eval) {\'use strict\';}': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function hello(arguments) {\'use strict\';}': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function hello() { \'use strict\'; function inner(eval) {} }': {
index: 48,
lineNumber: 1,
column: 49,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function hello() { \'use strict\'; function inner(arguments) {} }': {
index: 48,
lineNumber: 1,
column: 49,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
' "\\1"; \'use strict\';': {
index: 1,
lineNumber: 1,
column: 2,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { \'use strict\'; "\\1"; }': {
index: 33,
lineNumber: 1,
column: 34,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { \'use strict\'; 021; }': {
index: 33,
lineNumber: 1,
column: 34,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { \'use strict\'; ({ "\\1": 42 }); }': {
index: 36,
lineNumber: 1,
column: 37,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { \'use strict\'; ({ 021: 42 }); }': {
index: 36,
lineNumber: 1,
column: 37,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { "octal directive\\1"; "use strict"; }': {
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { "octal directive\\1"; "octal directive\\2"; "use strict"; }': {
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { "use strict"; function inner() { "octal directive\\1"; } }': {
index: 52,
lineNumber: 1,
column: 53,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
},
'function hello() { "use strict"; var implements; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var interface; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var package; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var private; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var protected; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var public; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var static; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var yield; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello() { "use strict"; var let; }': {
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function hello(static) { "use strict"; }': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function static() { "use strict"; }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function eval(a) { "use strict"; }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'function arguments(a) { "use strict"; }': {
index: 9,
lineNumber: 1,
column: 10,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
},
'var yield': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Unexpected token yield'
},
'var let': {
index: 4,
lineNumber: 1,
column: 5,
message: 'Error: Line 1: Unexpected token let'
},
'"use strict"; function static() { }': {
index: 23,
lineNumber: 1,
column: 24,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function a(t, t) { "use strict"; }': {
index: 14,
lineNumber: 1,
column: 15,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'function a(eval) { "use strict"; }': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'function a(package) { "use strict"; }': {
index: 11,
lineNumber: 1,
column: 12,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'function a() { "use strict"; function b(t, t) { }; }': {
index: 43,
lineNumber: 1,
column: 44,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'(function a(t, t) { "use strict"; })': {
index: 15,
lineNumber: 1,
column: 16,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'function a() { "use strict"; (function b(t, t) { }); }': {
index: 44,
lineNumber: 1,
column: 45,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'(function a(eval) { "use strict"; })': {
index: 12,
lineNumber: 1,
column: 13,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
},
'(function a(package) { "use strict"; })': {
index: 12,
lineNumber: 1,
column: 13,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},
'__proto__: __proto__: 42;': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Label \'__proto__\' has already been declared'
},
'"use strict"; function t(__proto__, __proto__) { }': {
index: 36,
lineNumber: 1,
column: 37,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
},
'"use strict"; x = { __proto__: 42, __proto__: 43 }': {
index: 48,
lineNumber: 1,
column: 49,
message: 'Error: Line 1: Duplicate data property in object literal not allowed in strict mode'
},
'"use strict"; x = { get __proto__() { }, __proto__: 43 }': {
index: 54,
lineNumber: 1,
column: 55,
message: 'Error: Line 1: Object literal may not have data and accessor property with the same name'
},
'var': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected end of input'
},
'let': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected end of input'
},
'const': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected end of input'
},
'{ ; ; ': {
index: 8,
lineNumber: 1,
column: 9,
message: 'Error: Line 1: Unexpected end of input'
},
'function t() { ; ; ': {
index: 21,
lineNumber: 1,
column: 22,
message: 'Error: Line 1: Unexpected end of input'
}
},
'Tokenize': {
'tokenize(/42/)': [
{
"type": "Identifier",
"value": "tokenize",
"range": [
0,
8
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
8,
9
],
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
13,
14
],
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
}
}
},
{
"type": "RegularExpression",
"value": "/42/",
"range": [
9,
13
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 13
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
13,
14
],
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
}
}
}
],
'if (false) { /42/ }': [
{
"type": "Keyword",
"value": "if",
"range": [
0,
2
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
3,
4
],
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 4
}
}
},
{
"type": "Boolean",
"value": "false",
"range": [
4,
9
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 9
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
9,
10
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
}
}
},
{
"type": "Punctuator",
"value": "{",
"range": [
11,
12
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
18,
19
],
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
}
}
},
{
"type": "RegularExpression",
"value": "/42/",
"range": [
13,
17
],
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 17
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
18,
19
],
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
}
}
}
],
'with (false) /42/': [
{
"type": "Keyword",
"value": "with",
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
5,
6
],
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 6
}
}
},
{
"type": "Boolean",
"value": "false",
"range": [
6,
11
],
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 11
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
11,
12
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
}
}
},
{
"type": "RegularExpression",
"value": "/42/",
"range": [
13,
17
],
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 17
}
}
}
],
'(false) /42/': [
{
"type": "Punctuator",
"value": "(",
"range": [
0,
1
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
}
},
{
"type": "Boolean",
"value": "false",
"range": [
1,
6
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 6
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
6,
7
],
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 7
}
}
},
{
"type": "Punctuator",
"value": "/",
"range": [
8,
9
],
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
}
}
},
{
"type": "Numeric",
"value": "42",
"range": [
9,
11
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 11
}
}
},
{
"type": "Punctuator",
"value": "/",
"range": [
11,
12
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
}
}
}
],
'function f(){} /42/': [
{
"type": "Keyword",
"value": "function",
"range": [
0,
8
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
}
},
{
"type": "Identifier",
"value": "f",
"range": [
9,
10
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
10,
11
],
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
11,
12
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
}
}
},
{
"type": "Punctuator",
"value": "{",
"range": [
12,
13
],
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
13,
14
],
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
}
}
},
{
"type": "RegularExpression",
"value": "/42/",
"range": [
15,
19
],
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 19
}
}
}
],
'function(){} /42': [
{
"type": "Keyword",
"value": "function",
"range": [
0,
8
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
8,
9
],
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
9,
10
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
}
}
},
{
"type": "Punctuator",
"value": "{",
"range": [
10,
11
],
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
11,
12
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
}
}
},
{
"type": "Punctuator",
"value": "/",
"range": [
13,
14
],
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
}
}
},
{
"type": "Numeric",
"value": "42",
"range": [
14,
16
],
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 16
}
}
}
],
'{} /42': [
{
"type": "Punctuator",
"value": "{",
"range": [
0,
1
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
1,
2
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 2
}
}
},
{
"type": "Punctuator",
"value": "/",
"range": [
3,
4
],
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 4
}
}
},
{
"type": "Numeric",
"value": "42",
"range": [
4,
6
],
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 6
}
}
}
],
'[function(){} /42]': [
{
"type": "Punctuator",
"value": "[",
"range": [
0,
1
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
}
},
{
"type": "Keyword",
"value": "function",
"range": [
1,
9
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 9
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
9,
10
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
10,
11
],
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
}
}
},
{
"type": "Punctuator",
"value": "{",
"range": [
11,
12
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
12,
13
],
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
}
}
},
{
"type": "Punctuator",
"value": "/",
"range": [
14,
15
],
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
}
}
},
{
"type": "Numeric",
"value": "42",
"range": [
15,
17
],
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 17
}
}
},
{
"type": "Punctuator",
"value": "]",
"range": [
17,
18
],
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 18
}
}
}
],
';function f(){} /42/': [
{
"type": "Punctuator",
"value": ";",
"range": [
0,
1
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
}
},
{
"type": "Keyword",
"value": "function",
"range": [
1,
9
],
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 9
}
}
},
{
"type": "Identifier",
"value": "f",
"range": [
10,
11
],
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
}
}
},
{
"type": "Punctuator",
"value": "(",
"range": [
11,
12
],
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 12
}
}
},
{
"type": "Punctuator",
"value": ")",
"range": [
12,
13
],
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
}
}
},
{
"type": "Punctuator",
"value": "{",
"range": [
13,
14
],
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
}
}
},
{
"type": "Punctuator",
"value": "}",
"range": [
14,
15
],
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
}
}
},
{
"type": "RegularExpression",
"value": "/42/",
"range": [
16,
20
],
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 20
}
}
}
],
'void /42/': [
{
"type": "Keyword",
"value": "void",
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
}
},
{
"type": "RegularExpression",
"value": "/42/",
"range": [
5,
9
],
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 9
}
}
}
],
'/42/': [
{
"type": "RegularExpression",
"value": "/42/",
"range": [
0,
4
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
}
}
],
'foo[/42]': [
{
"type": "Identifier",
"value": "foo",
"range": [
0,
3
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
}
},
{
"type": "Punctuator",
"value": "[",
"range": [
3,
4
],
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 4
}
}
}
],
'': [],
'/42': {
tokenize: true,
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Invalid regular expression: missing /'
},
'foo[/42': {
tokenize: true,
index: 7,
lineNumber: 1,
column: 8,
message: 'Error: Line 1: Invalid regular expression: missing /'
}
},
'API': {
'parse()': {
call: 'parse',
args: [],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'undefined'
}
}]
}
},
'parse(null)': {
call: 'parse',
args: [null],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: null,
raw: 'null'
}
}]
}
},
'parse(42)': {
call: 'parse',
args: [42],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42'
}
}]
}
},
'parse(true)': {
call: 'parse',
args: [true],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: true,
raw: 'true'
}
}]
}
},
'parse(undefined)': {
call: 'parse',
args: [void 0],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'undefined'
}
}]
}
},
'parse(new String("test"))': {
call: 'parse',
args: [new String('test')],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Identifier',
name: 'test'
}
}]
}
},
'parse(new Number(42))': {
call: 'parse',
args: [new Number(42)],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 42,
raw: '42'
}
}]
}
},
'parse(new Boolean(true))': {
call: 'parse',
args: [new Boolean(true)],
result: {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: true,
raw: 'true'
}
}]
}
},
'Syntax': {
property: 'Syntax',
result: {
ArrayExpression: 'ArrayExpression',
ArrayPattern: 'ArrayPattern',
ArrowFunctionExpression: 'ArrowFunctionExpression',
AssignmentExpression: 'AssignmentExpression',
BinaryExpression: 'BinaryExpression',
BlockStatement: 'BlockStatement',
BreakStatement: 'BreakStatement',
CallExpression: 'CallExpression',
CatchClause: 'CatchClause',
ClassBody: 'ClassBody',
ClassDeclaration: 'ClassDeclaration',
ClassExpression: 'ClassExpression',
ClassHeritage: 'ClassHeritage',
ComprehensionBlock: 'ComprehensionBlock',
ComprehensionExpression: 'ComprehensionExpression',
ConditionalExpression: 'ConditionalExpression',
ContinueStatement: 'ContinueStatement',
DebuggerStatement: 'DebuggerStatement',
DoWhileStatement: 'DoWhileStatement',
EmptyStatement: 'EmptyStatement',
ExportDeclaration: 'ExportDeclaration',
ExportBatchSpecifier: 'ExportBatchSpecifier',
ExportSpecifier: 'ExportSpecifier',
ExpressionStatement: 'ExpressionStatement',
ForInStatement: 'ForInStatement',
ForOfStatement: 'ForOfStatement',
ForStatement: 'ForStatement',
FunctionDeclaration: 'FunctionDeclaration',
FunctionExpression: 'FunctionExpression',
Identifier: 'Identifier',
IfStatement: 'IfStatement',
ImportDeclaration: 'ImportDeclaration',
ImportSpecifier: 'ImportSpecifier',
LabeledStatement: 'LabeledStatement',
Literal: 'Literal',
LogicalExpression: 'LogicalExpression',
MemberExpression: 'MemberExpression',
MethodDefinition: 'MethodDefinition',
ModuleDeclaration: 'ModuleDeclaration',
NewExpression: 'NewExpression',
ObjectExpression: 'ObjectExpression',
ObjectPattern: 'ObjectPattern',
Program: 'Program',
Property: 'Property',
ReturnStatement: 'ReturnStatement',
SequenceExpression: 'SequenceExpression',
SpreadElement: 'SpreadElement',
SwitchCase: 'SwitchCase',
SwitchStatement: 'SwitchStatement',
TaggedTemplateExpression: 'TaggedTemplateExpression',
TemplateElement: 'TemplateElement',
TemplateLiteral: 'TemplateLiteral',
ThisExpression: 'ThisExpression',
ThrowStatement: 'ThrowStatement',
TryStatement: 'TryStatement',
TypeAnnotatedIdentifier: 'TypeAnnotatedIdentifier',
TypeAnnotation: 'TypeAnnotation',
UnaryExpression: 'UnaryExpression',
UpdateExpression: 'UpdateExpression',
VariableDeclaration: 'VariableDeclaration',
VariableDeclarator: 'VariableDeclarator',
WhileStatement: 'WhileStatement',
WithStatement: 'WithStatement',
XJSIdentifier: 'XJSIdentifier',
XJSEmptyExpression: "XJSEmptyExpression",
XJSExpressionContainer: "XJSExpressionContainer",
XJSElement: 'XJSElement',
XJSClosingElement: 'XJSClosingElement',
XJSOpeningElement: 'XJSOpeningElement',
XJSAttribute: "XJSAttribute",
XJSText: 'XJSText',
YieldExpression: 'YieldExpression'
}
},
'tokenize()': {
call: 'tokenize',
args: [],
result: [{
type: 'Identifier',
value: 'undefined'
}]
},
'tokenize(null)': {
call: 'tokenize',
args: [null],
result: [{
type: 'Null',
value: 'null'
}]
},
'tokenize(42)': {
call: 'tokenize',
args: [42],
result: [{
type: 'Numeric',
value: '42'
}]
},
'tokenize(true)': {
call: 'tokenize',
args: [true],
result: [{
type: 'Boolean',
value: 'true'
}]
},
'tokenize(undefined)': {
call: 'tokenize',
args: [void 0],
result: [{
type: 'Identifier',
value: 'undefined'
}]
},
'tokenize(new String("test"))': {
call: 'tokenize',
args: [new String('test')],
result: [{
type: 'Identifier',
value: 'test'
}]
},
'tokenize(new Number(42))': {
call: 'tokenize',
args: [new Number(42)],
result: [{
type: 'Numeric',
value: '42'
}]
},
'tokenize(new Boolean(true))': {
call: 'tokenize',
args: [new Boolean(true)],
result: [{
type: 'Boolean',
value: 'true'
}]
},
},
'Tolerant parse': {
'return': {
type: 'Program',
body: [{
type: 'ReturnStatement',
'argument': null,
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
}
}],
range: [0, 6],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 6 }
},
errors: [{
index: 6,
lineNumber: 1,
column: 7,
message: 'Error: Line 1: Illegal return statement'
}]
},
'(function () { \'use strict\'; with (i); }())': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\'use strict\'',
range: [15, 27],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 27 }
}
},
range: [15, 28],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 28 }
}
}, {
type: 'WithStatement',
object: {
type: 'Identifier',
name: 'i',
range: [35, 36],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 36 }
}
},
body: {
type: 'EmptyStatement',
range: [37, 38],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 38 }
}
},
range: [29, 38],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 38 }
}
}],
range: [13, 40],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 40 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 40],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 40 }
}
},
'arguments': [],
range: [1, 42],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 42 }
}
},
range: [0, 43],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 43 }
}
}],
range: [0, 43],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 43 }
},
errors: [{
index: 29,
lineNumber: 1,
column: 30,
message: 'Error: Line 1: Strict mode code may not include a with statement'
}]
},
'(function () { \'use strict\'; 021 }())': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\'use strict\'',
range: [15, 27],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 27 }
}
},
range: [15, 28],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 28 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 17,
raw: "021",
range: [29, 32],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 32 }
}
},
range: [29, 33],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 33 }
}
}],
range: [13, 34],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 34 }
}
},
rest: null,
generator: false,
expression: false,
range: [1, 34],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 34 }
}
},
'arguments': [],
range: [1, 36],
loc: {
start: { line: 1, column: 1 },
end: { line: 1, column: 36 }
}
},
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
}
}],
range: [0, 37],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 37 }
},
errors: [{
index: 29,
lineNumber: 1,
column: 30,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
}]
},
'"use strict"; delete x': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UnaryExpression',
operator: 'delete',
argument: {
type: 'Identifier',
name: 'x',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
range: [14, 22],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 22 }
}
},
range: [14, 22],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 22 }
}
}],
range: [0, 22],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 22 }
},
errors: [{
index: 22,
lineNumber: 1,
column: 23,
message: 'Error: Line 1: Delete of an unqualified identifier in strict mode.'
}]
},
'"use strict"; try {} catch (eval) {}': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [],
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'eval',
range: [28, 32],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 32 }
}
},
body: {
type: 'BlockStatement',
body: [],
range: [34, 36],
loc: {
start: { line: 1, column: 34 },
end: { line: 1, column: 36 }
}
},
range: [21, 36],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 36 }
}
}],
finalizer: null,
range: [14, 36],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 36 }
}
}],
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
},
errors: [{
index: 32,
lineNumber: 1,
column: 33,
message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode'
}]
},
'"use strict"; try {} catch (arguments) {}': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'TryStatement',
block: {
type: 'BlockStatement',
body: [],
range: [18, 20],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 20 }
}
},
guardedHandlers: [],
handlers: [{
type: 'CatchClause',
param: {
type: 'Identifier',
name: 'arguments',
range: [28, 37],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 37 }
}
},
body: {
type: 'BlockStatement',
body: [],
range: [39, 41],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 41 }
}
},
range: [21, 41],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 41 }
}
}],
finalizer: null,
range: [14, 41],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 41 }
}
}],
range: [0, 41],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 41 }
},
errors: [{
index: 37,
lineNumber: 1,
column: 38,
message: 'Error: Line 1: Catch variable may not be eval or arguments in strict mode'
}]
},
'"use strict"; var eval;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'eval',
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
},
init: null,
range: [18, 22],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 22 }
}
}],
kind: 'var',
range: [14, 23],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 23 }
}
}],
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
},
errors: [{
index: 22,
lineNumber: 1,
column: 23,
message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode'
}]
},
'"use strict"; var arguments;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'arguments',
range: [18, 27],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 27 }
}
},
init: null,
range: [18, 27],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 27 }
}
}],
kind: 'var',
range: [14, 28],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 28 }
}
}],
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
},
errors: [{
index: 27,
lineNumber: 1,
column: 28,
message: 'Error: Line 1: Variable name may not be eval or arguments in strict mode'
}]
},
'"use strict"; eval = 0;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'eval',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
right: {
type: 'Literal',
value: 0,
raw: '0',
range: [21, 22],
loc: {
start: { line: 1, column: 21 },
end: { line: 1, column: 22 }
}
},
range: [14, 22],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 22 }
}
},
range: [14, 23],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 23 }
}
}],
range: [0, 23],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 23 }
},
errors: [{
index: 14,
lineNumber: 1,
column: 15,
message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode'
}]
},
'"use strict"; eval++;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'eval',
range: [14, 18],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 18 }
}
},
prefix: false,
range: [14, 20],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 20 }
}
},
range: [14, 21],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 21 }
}
}],
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
},
errors: [{
index: 18,
lineNumber: 1,
column: 19,
message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode'
}]
},
'"use strict"; --eval;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'eval',
range: [16, 20],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 20 }
}
},
prefix: true,
range: [14, 20],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 20 }
}
},
range: [14, 21],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 21 }
}
}],
range: [0, 21],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 21 }
},
errors: [{
index: 20,
lineNumber: 1,
column: 21,
message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode'
}]
},
'"use strict"; arguments = 0;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'arguments',
range: [14, 23],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 23 }
}
},
right: {
type: 'Literal',
value: 0,
raw: '0',
range: [26, 27],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 27 }
}
},
range: [14, 27],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 27 }
}
},
range: [14, 28],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 28 }
}
}],
range: [0, 28],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 28 }
},
errors: [{
index: 14,
lineNumber: 1,
column: 15,
message: 'Error: Line 1: Assignment to eval or arguments is not allowed in strict mode'
}]
},
'"use strict"; arguments--;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '--',
argument: {
type: 'Identifier',
name: 'arguments',
range: [14, 23],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 23 }
}
},
prefix: false,
range: [14, 25],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 25 }
}
},
range: [14, 26],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 26 }
}
}],
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
},
errors: [{
index: 23,
lineNumber: 1,
column: 24,
message: 'Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode'
}]
},
'"use strict"; ++arguments;': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'UpdateExpression',
operator: '++',
argument: {
type: 'Identifier',
name: 'arguments',
range: [16, 25],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 25 }
}
},
prefix: true,
range: [14, 25],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 25 }
}
},
range: [14, 26],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 26 }
}
}],
range: [0, 26],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 26 }
},
errors: [{
index: 25,
lineNumber: 1,
column: 26,
message: 'Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode'
}]
},
'"use strict";x={y:1,y:1}': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [13, 14],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 14 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'y',
range: [16, 17],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 17 }
}
},
value: {
type: 'Literal',
value: 1,
raw: '1',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [16, 19],
loc: {
start: { line: 1, column: 16 },
end: { line: 1, column: 19 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'y',
range: [20, 21],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 21 }
}
},
value: {
type: 'Literal',
value: 1,
raw: '1',
range: [22, 23],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 23 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [20, 23],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 23 }
}
}],
range: [15, 24],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 24 }
}
},
range: [13, 24],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 24 }
}
},
range: [13, 24],
loc: {
start: { line: 1, column: 13 },
end: { line: 1, column: 24 }
}
}],
range: [0, 24],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 24 }
},
errors: [{
index: 23,
lineNumber: 1,
column: 24,
message: 'Error: Line 1: Duplicate data property in object literal not allowed in strict mode'
}]
},
'"use strict"; function eval() {};': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'eval',
range: [23, 27],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 27 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [30, 32],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 32 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 32],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 32 }
}
}, {
type: 'EmptyStatement',
range: [32, 33],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 33 }
}
}],
range: [0, 33],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 33 }
},
errors: [{
index: 23,
lineNumber: 1,
column: 24,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
}]
},
'"use strict"; function arguments() {};': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'arguments',
range: [23, 32],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 32 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [35, 37],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 37],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 37 }
}
}, {
type: 'EmptyStatement',
range: [37, 38],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 38 }
}
}],
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
},
errors: [{
index: 23,
lineNumber: 1,
column: 24,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
}]
},
'"use strict"; function interface() {};': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'interface',
range: [23, 32],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 32 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [35, 37],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 37 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 37],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 37 }
}
}, {
type: 'EmptyStatement',
range: [37, 38],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 38 }
}
}],
range: [0, 38],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 38 }
},
errors: [{
index: 23,
lineNumber: 1,
column: 24,
message: 'Error: Line 1: Use of future reserved word in strict mode'
}]
},
'"use strict"; (function eval() {});': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'eval',
range: [24, 28],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 28 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [31, 33],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 33 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 33],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 33 }
}
},
range: [14, 35],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 35 }
}
}],
range: [0, 35],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 35 }
},
errors: [{
index: 24,
lineNumber: 1,
column: 25,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
}]
},
'"use strict"; (function arguments() {});': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'arguments',
range: [24, 33],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 33 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [36, 38],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 38 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 38],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 38 }
}
},
range: [14, 40],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 40 }
}
}],
range: [0, 40],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 40 }
},
errors: [{
index: 24,
lineNumber: 1,
column: 25,
message: 'Error: Line 1: Function name may not be eval or arguments in strict mode'
}]
},
'"use strict"; (function interface() {});': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'interface',
range: [24, 33],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 33 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [36, 38],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 38 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 38],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 38 }
}
},
range: [14, 40],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 40 }
}
}],
range: [0, 40],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 40 }
},
errors: [{
index: 24,
lineNumber: 1,
column: 25,
message: 'Error: Line 1: Use of future reserved word in strict mode'
}]
},
'"use strict"; function f(eval) {};': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'f',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
params: [{
type: 'Identifier',
name: 'eval',
range: [25, 29],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 29 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [31, 33],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 33 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 33],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 33 }
}
}, {
type: 'EmptyStatement',
range: [33, 34],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 34 }
}
}],
range: [0, 34],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 34 }
},
errors: [{
index: 25,
lineNumber: 1,
column: 26,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
}]
},
'"use strict"; function f(arguments) {};': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'f',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
params: [{
type: 'Identifier',
name: 'arguments',
range: [25, 34],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 34 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [36, 38],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 38 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 38],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 38 }
}
}, {
type: 'EmptyStatement',
range: [38, 39],
loc: {
start: { line: 1, column: 38 },
end: { line: 1, column: 39 }
}
}],
range: [0, 39],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 39 }
},
errors: [{
index: 25,
lineNumber: 1,
column: 26,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
}]
},
'"use strict"; function f(foo, foo) {};': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'f',
range: [23, 24],
loc: {
start: { line: 1, column: 23 },
end: { line: 1, column: 24 }
}
},
params: [{
type: 'Identifier',
name: 'foo',
range: [25, 28],
loc: {
start: { line: 1, column: 25 },
end: { line: 1, column: 28 }
}
}, {
type: 'Identifier',
name: 'foo',
range: [31, 34],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 34 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [36, 38],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 38 }
}
},
rest: null,
generator: false,
expression: false,
range: [14, 38],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 38 }
}
}, {
type: 'EmptyStatement',
range: [38, 39],
loc: {
start: { line: 1, column: 38 },
end: { line: 1, column: 39 }
}
}],
range: [0, 39],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 39 }
},
errors: [{
index: 31,
lineNumber: 1,
column: 32,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
}]
},
'"use strict"; (function f(eval) {});': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'f',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
},
params: [{
type: 'Identifier',
name: 'eval',
range: [26, 30],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 30 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [32, 34],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 34 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 34],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 34 }
}
},
range: [14, 36],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 36 }
}
}],
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
},
errors: [{
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
}]
},
'"use strict"; (function f(arguments) {});': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'f',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
},
params: [{
type: 'Identifier',
name: 'arguments',
range: [26, 35],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 35 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [37, 39],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 39 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 39],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 39 }
}
},
range: [14, 41],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 41 }
}
}],
range: [0, 41],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 41 }
},
errors: [{
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
}]
},
'"use strict"; (function f(foo, foo) {});': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'f',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
},
params: [{
type: 'Identifier',
name: 'foo',
range: [26, 29],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 29 }
}
}, {
type: 'Identifier',
name: 'foo',
range: [32, 35],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 35 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [37, 39],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 39 }
}
},
rest: null,
generator: false,
expression: false,
range: [15, 39],
loc: {
start: { line: 1, column: 15 },
end: { line: 1, column: 39 }
}
},
range: [14, 41],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 41 }
}
}],
range: [0, 41],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 41 }
},
errors: [{
index: 32,
lineNumber: 1,
column: 33,
message: 'Error: Line 1: Strict mode function may not have duplicate parameter names'
}]
},
'"use strict"; x = { set f(eval) {} }' : {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'Identifier',
name: 'x',
range: [14, 15],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 15 }
}
},
right: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'f',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
},
value : {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'eval',
range: [26, 30],
loc: {
start: { line: 1, column: 26 },
end: { line: 1, column: 30 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [32, 34],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 34 }
}
},
rest: null,
generator: false,
expression: false,
range: [32, 34],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 34 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [20, 34],
loc: {
start: { line: 1, column: 20 },
end: { line: 1, column: 34 }
}
}],
range: [18, 36],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 36 }
}
},
range: [14, 36],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 36 }
}
},
range: [14, 36],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 36 }
}
}],
range: [0, 36],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 36 }
},
errors: [{
index: 26,
lineNumber: 1,
column: 27,
message: 'Error: Line 1: Parameter name eval or arguments is not allowed in strict mode'
}]
},
'function hello() { "octal directive\\1"; "use strict"; }': {
type: 'Program',
body: [{
type: 'FunctionDeclaration',
id: {
type: 'Identifier',
name: 'hello',
range: [9, 14],
loc: {
start: { line: 1, column: 9 },
end: { line: 1, column: 14 }
}
},
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'octal directive\u0001',
raw: '"octal directive\\1"',
range: [19, 38],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 38 }
}
},
range: [19, 39],
loc: {
start: { line: 1, column: 19 },
end: { line: 1, column: 39 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [40, 52],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 52 }
}
},
range: [40, 53],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 53 }
}
}],
range: [17, 55],
loc: {
start: { line: 1, column: 17 },
end: { line: 1, column: 55 }
}
},
rest: null,
generator: false,
expression: false,
range: [0, 55],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 55 }
}
}],
range: [0, 55],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 55 }
},
errors: [{
index: 19,
lineNumber: 1,
column: 20,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
}]
},
'"\\1"; \'use strict\';': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: '\u0001',
raw: '"\\1"',
range: [0, 4],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 4 }
}
},
range: [0, 5],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 5 }
}
}, {
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '\'use strict\'',
range: [6, 18],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 18 }
}
},
range: [6, 19],
loc: {
start: { line: 1, column: 6 },
end: { line: 1, column: 19 }
}
}],
range: [0, 19],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 19 }
},
errors: [{
index: 0,
lineNumber: 1,
column: 1,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
}]
},
'"use strict"; var x = { 014: 3}': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
init: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Literal',
value: 12,
raw: '014',
range: [24, 27],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 27 }
}
},
value: {
type: 'Literal',
value: 3,
raw: '3',
range: [29, 30],
loc: {
start: { line: 1, column: 29 },
end: { line: 1, column: 30 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [24, 30],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 30 }
}
}],
range: [22, 31],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 31 }
}
},
range: [18, 31],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 31 }
}
}],
kind: 'var',
range: [14, 31],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 31 }
}
}],
range: [0, 31],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 31 }
},
errors: [{
index: 24,
lineNumber: 1,
column: 25,
message: 'Error: Line 1: Octal literals are not allowed in strict mode.'
}]
},
'"use strict"; var x = { get i() {}, get i() {} }': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
init: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'i',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [32, 34],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 34 }
}
},
rest: null,
generator: false,
expression: false,
range: [32, 34],
loc: {
start: { line: 1, column: 32 },
end: { line: 1, column: 34 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [24, 34],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 34 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'i',
range: [40, 41],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 41 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [44, 46],
loc: {
start: { line: 1, column: 44 },
end: { line: 1, column: 46 }
}
},
rest: null,
generator: false,
expression: false,
range: [44, 46],
loc: {
start: { line: 1, column: 44 },
end: { line: 1, column: 46 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [36, 46],
loc: {
start: { line: 1, column: 36 },
end: { line: 1, column: 46 }
}
}],
range: [22, 48],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 48 }
}
},
range: [18, 48],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 48 }
}
}],
kind: 'var',
range: [14, 48],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 48 }
}
}],
range: [0, 48],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 48 }
},
errors: [{
index: 46,
lineNumber: 1,
column: 47,
message: 'Error: Line 1: Object literal may not have multiple get/set accessors with the same name'
}]
},
'"use strict"; var x = { i: 42, get i() {} }': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
init: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'i',
range: [24, 25],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 25 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [27, 29],
loc: {
start: { line: 1, column: 27 },
end: { line: 1, column: 29 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [24, 29],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 29 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'i',
range: [35, 36],
loc: {
start: { line: 1, column: 35 },
end: { line: 1, column: 36 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [39, 41],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 41 }
}
},
rest: null,
generator: false,
expression: false,
range: [39, 41],
loc: {
start: { line: 1, column: 39 },
end: { line: 1, column: 41 }
}
},
kind: 'get',
method: false,
shorthand: false,
range: [31, 41],
loc: {
start: { line: 1, column: 31 },
end: { line: 1, column: 41 }
}
}],
range: [22, 43],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 43 }
}
},
range: [18, 43],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 43 }
}
}],
kind: 'var',
range: [14, 43],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 43 }
}
}],
range: [0, 43],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 43 }
},
errors: [{
index: 41,
lineNumber: 1,
column: 42,
message: 'Error: Line 1: Object literal may not have data and accessor property with the same name'
}]
},
'"use strict"; var x = { set i(x) {}, i: 42 }': {
type: 'Program',
body: [{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'use strict',
raw: '"use strict"',
range: [0, 12],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 12 }
}
},
range: [0, 13],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 13 }
}
}, {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: 'x',
range: [18, 19],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 19 }
}
},
init: {
type: 'ObjectExpression',
properties: [{
type: 'Property',
key: {
type: 'Identifier',
name: 'i',
range: [28, 29],
loc: {
start: { line: 1, column: 28 },
end: { line: 1, column: 29 }
}
},
value: {
type: 'FunctionExpression',
id: null,
params: [{
type: 'Identifier',
name: 'x',
range: [30, 31],
loc: {
start: { line: 1, column: 30 },
end: { line: 1, column: 31 }
}
}],
defaults: [],
body: {
type: 'BlockStatement',
body: [],
range: [33, 35],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 35 }
}
},
rest: null,
generator: false,
expression: false,
range: [33, 35],
loc: {
start: { line: 1, column: 33 },
end: { line: 1, column: 35 }
}
},
kind: 'set',
method: false,
shorthand: false,
range: [24, 35],
loc: {
start: { line: 1, column: 24 },
end: { line: 1, column: 35 }
}
}, {
type: 'Property',
key: {
type: 'Identifier',
name: 'i',
range: [37, 38],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 38 }
}
},
value: {
type: 'Literal',
value: 42,
raw: '42',
range: [40, 42],
loc: {
start: { line: 1, column: 40 },
end: { line: 1, column: 42 }
}
},
kind: 'init',
method: false,
shorthand: false,
range: [37, 42],
loc: {
start: { line: 1, column: 37 },
end: { line: 1, column: 42 }
}
}],
range: [22, 44],
loc: {
start: { line: 1, column: 22 },
end: { line: 1, column: 44 }
}
},
range: [18, 44],
loc: {
start: { line: 1, column: 18 },
end: { line: 1, column: 44 }
}
}],
kind: 'var',
range: [14, 44],
loc: {
start: { line: 1, column: 14 },
end: { line: 1, column: 44 }
}
}],
range: [0, 44],
loc: {
start: { line: 1, column: 0 },
end: { line: 1, column: 44 }
},
errors: [{
index: 42,
lineNumber: 1,
column: 43,
message: 'Error: Line 1: Object literal may not have data and accessor property with the same name'
}]
}
},
};
``` | /content/code_sandbox/node_modules/esprima-fb/test/test.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 149,102 |
```javascript
var Transform = require('readable-stream/transform')
, inherits = require('util').inherits
, xtend = require('xtend')
function DestroyableTransform(opts) {
Transform.call(this, opts)
this._destroyed = false
}
inherits(DestroyableTransform, Transform)
DestroyableTransform.prototype.destroy = function(err) {
if (this._destroyed) return
this._destroyed = true
var self = this
process.nextTick(function() {
if (err)
self.emit('error', err)
self.emit('close')
})
}
// a noop _transform function
function noop (chunk, enc, callback) {
callback(null, chunk)
}
// create a new export function, used by both the main export and
// the .ctor export, contains common logic for dealing with arguments
function through2 (construct) {
return function (options, transform, flush) {
if (typeof options == 'function') {
flush = transform
transform = options
options = {}
}
if (typeof transform != 'function')
transform = noop
if (typeof flush != 'function')
flush = null
return construct(options, transform, flush)
}
}
// main export, just make me a transform stream!
module.exports = through2(function (options, transform, flush) {
var t2 = new DestroyableTransform(options)
t2._transform = transform
if (flush)
t2._flush = flush
return t2
})
// make me a reusable prototype that I can `new`, or implicitly `new`
// with a constructor call
module.exports.ctor = through2(function (options, transform, flush) {
function Through2 (override) {
if (!(this instanceof Through2))
return new Through2(override)
this.options = xtend(options, override)
DestroyableTransform.call(this, this.options)
}
inherits(Through2, DestroyableTransform)
Through2.prototype._transform = transform
if (flush)
Through2.prototype._flush = flush
return Through2
})
module.exports.obj = through2(function (options, transform, flush) {
var t2 = new DestroyableTransform(xtend({ objectMode: true, highWaterMark: 16 }, options))
t2._transform = transform
if (flush)
t2._flush = flush
return t2
})
``` | /content/code_sandbox/node_modules/through2/through2.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 523 |
```javascript
var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = Stream;
exports.Readable = exports;
exports.Writable = require('./lib/_stream_writable.js');
exports.Duplex = require('./lib/_stream_duplex.js');
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('./lib/_stream_passthrough.js');
if (!process.browser && process.env.READABLE_STREAM === 'disable') {
module.exports = require('stream');
}
``` | /content/code_sandbox/node_modules/through2/node_modules/readable-stream/readable.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 121 |
```javascript
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a transform stream is a readable/writable stream where you do
// something with the data. Sometimes it's called a "filter",
// but that's not a great name for it, since that implies a thing where
// some bits pass through, and others are simply ignored. (That would
// be a valid example of a transform, of course.)
//
// While the output is causally related to the input, it's not a
// necessarily symmetric or synchronous transformation. For example,
// a zlib stream might take multiple plain-text writes(), and then
// emit a single compressed chunk some time in the future.
//
// Here's how this works:
//
// The Transform stream has all the aspects of the readable and writable
// stream classes. When you write(chunk), that calls _write(chunk,cb)
// internally, and returns false if there's a lot of pending writes
// buffered up. When you call read(), that calls _read(n) until
// there's enough pending readable data buffered up.
//
// In a transform stream, the written data is placed in a buffer. When
// _read(n) is called, it transforms the queued up data, calling the
// buffered _write cb's as it consumes chunks. If consuming a single
// written chunk would result in multiple output chunks, then the first
// outputted bit calls the readcb, and subsequent chunks just go into
// the read buffer, and will cause it to emit 'readable' if necessary.
//
// This way, back-pressure is actually determined by the reading side,
// since _read has to be called to start processing a new chunk. However,
// a pathological inflate type of transform can cause excessive buffering
// here. For example, imagine a stream where every byte of input is
// interpreted as an integer from 0-255, and then results in that many
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
// 1kb of data being output. In this case, you could write a very small
// amount of input, and end up with a very large amount of output. In
// such a pathological inflating mechanism, there'd be no way to tell
// the system to stop doing the transform. A single 4MB write could
// cause the system to run out of memory.
//
// However, even in such a pathological case, only a single written chunk
// would be consumed, and then the rest would wait (un-transformed) until
// the results of the previous transformed chunk were consumed.
module.exports = Transform;
var Duplex = require('./_stream_duplex');
/*<replacement>*/
var util = require('core-util-is');
util.inherits = require('inherits');
/*</replacement>*/
util.inherits(Transform, Duplex);
function TransformState(options, stream) {
this.afterTransform = function(er, data) {
return afterTransform(stream, er, data);
};
this.needTransform = false;
this.transforming = false;
this.writecb = null;
this.writechunk = null;
}
function afterTransform(stream, er, data) {
var ts = stream._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (!cb)
return stream.emit('error', new Error('no writecb in Transform class'));
ts.writechunk = null;
ts.writecb = null;
if (data !== null && data !== undefined)
stream.push(data);
if (cb)
cb(er);
var rs = stream._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
stream._read(rs.highWaterMark);
}
}
function Transform(options) {
if (!(this instanceof Transform))
return new Transform(options);
Duplex.call(this, options);
var ts = this._transformState = new TransformState(options, this);
// when the writable side finishes, then flush out anything remaining.
var stream = this;
// start out asking for a readable event once data is transformed.
this._readableState.needReadable = true;
// we have implemented the _read method, and done the other things
// that Readable wants before the first _read call, so unset the
// sync guard flag.
this._readableState.sync = false;
this.once('finish', function() {
if ('function' === typeof this._flush)
this._flush(function(er) {
done(stream, er);
});
else
done(stream);
});
}
Transform.prototype.push = function(chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
// This is the part where you do stuff!
// override this function in implementation classes.
// 'chunk' is an input chunk.
//
// Call `push(newChunk)` to pass along transformed output
// to the readable side. You may call 'push' zero or more times.
//
// Call `cb(err)` when you are done with this chunk. If you pass
// an error, then that'll put the hurt on the whole operation. If you
// never call cb(), then you'll never get another chunk.
Transform.prototype._transform = function(chunk, encoding, cb) {
throw new Error('not implemented');
};
Transform.prototype._write = function(chunk, encoding, cb) {
var ts = this._transformState;
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform ||
rs.needReadable ||
rs.length < rs.highWaterMark)
this._read(rs.highWaterMark);
}
};
// Doesn't matter what the args are here.
// _transform does all the work.
// That we got here means that the readable side wants more data.
Transform.prototype._read = function(n) {
var ts = this._transformState;
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
// mark that we need a transform, so that any data that comes in
// will get processed, now that we've asked for it.
ts.needTransform = true;
}
};
function done(stream, er) {
if (er)
return stream.emit('error', er);
// if there's nothing in the write buffer, then that means
// that nothing more will ever be provided
var ws = stream._writableState;
var rs = stream._readableState;
var ts = stream._transformState;
if (ws.length)
throw new Error('calling transform done when ws.length != 0');
if (ts.transforming)
throw new Error('calling transform done when still transforming');
return stream.push(null);
}
``` | /content/code_sandbox/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,733 |
```javascript
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// A bit simpler than readable streams.
// Implement an async ._write(chunk, cb), and it'll handle all
// the drain event emission and buffering.
module.exports = Writable;
/*<replacement>*/
var Buffer = require('buffer').Buffer;
/*</replacement>*/
Writable.WritableState = WritableState;
/*<replacement>*/
var util = require('core-util-is');
util.inherits = require('inherits');
/*</replacement>*/
var Stream = require('stream');
util.inherits(Writable, Stream);
function WriteReq(chunk, encoding, cb) {
this.chunk = chunk;
this.encoding = encoding;
this.callback = cb;
}
function WritableState(options, stream) {
options = options || {};
// the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
var hwm = options.highWaterMark;
this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
// object stream flag to indicate whether or not this stream
// contains buffers or objects.
this.objectMode = !!options.objectMode;
// cast to ints.
this.highWaterMark = ~~this.highWaterMark;
this.needDrain = false;
// at the start of calling end()
this.ending = false;
// when end() has been called, and returned
this.ended = false;
// when 'finish' is emitted
this.finished = false;
// should we decode strings into buffers before passing to _write?
// this is here so that some node-core streams can optimize string
// handling at a lower level.
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
// Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.
// Everything else in the universe uses 'utf8', though.
this.defaultEncoding = options.defaultEncoding || 'utf8';
// not an actual buffer we keep track of, but a measurement
// of how much we're waiting to get pushed to some underlying
// socket or file.
this.length = 0;
// a flag to see when we're in the middle of a write.
this.writing = false;
// a flag to be able to tell if the onwrite cb is called immediately,
// or on a later tick. We set this to true at first, becuase any
// actions that shouldn't happen until "later" should generally also
// not happen before the first write call.
this.sync = true;
// a flag to know if we're processing previously buffered items, which
// may call the _write() callback in the same tick, so that we don't
// end up in an overlapped onwrite situation.
this.bufferProcessing = false;
// the callback that's passed to _write(chunk,cb)
this.onwrite = function(er) {
onwrite(stream, er);
};
// the callback that the user supplies to write(chunk,encoding,cb)
this.writecb = null;
// the amount that is being written when _write is called.
this.writelen = 0;
this.buffer = [];
// True if the error was already emitted and should not be thrown again
this.errorEmitted = false;
}
function Writable(options) {
var Duplex = require('./_stream_duplex');
// Writable ctor is applied to Duplexes, though they're not
// instanceof Writable, they're instanceof Readable.
if (!(this instanceof Writable) && !(this instanceof Duplex))
return new Writable(options);
this._writableState = new WritableState(options, this);
// legacy.
this.writable = true;
Stream.call(this);
}
// Otherwise people can pipe Writable streams, which is just wrong.
Writable.prototype.pipe = function() {
this.emit('error', new Error('Cannot pipe. Not readable.'));
};
function writeAfterEnd(stream, state, cb) {
var er = new Error('write after end');
// TODO: defer error events consistently everywhere, not just the cb
stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
}
// If we get something that is not a buffer, string, null, or undefined,
// and we're not in objectMode, then that's an error.
// Otherwise stream chunks are all considered to be of length=1, and the
// watermarks determine how many objects to keep in the buffer, rather than
// how many bytes or characters.
function validChunk(stream, state, chunk, cb) {
var valid = true;
if (!Buffer.isBuffer(chunk) &&
'string' !== typeof chunk &&
chunk !== null &&
chunk !== undefined &&
!state.objectMode) {
var er = new TypeError('Invalid non-string/buffer chunk');
stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
valid = false;
}
return valid;
}
Writable.prototype.write = function(chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
if (Buffer.isBuffer(chunk))
encoding = 'buffer';
else if (!encoding)
encoding = state.defaultEncoding;
if (typeof cb !== 'function')
cb = function() {};
if (state.ended)
writeAfterEnd(this, state, cb);
else if (validChunk(this, state, chunk, cb))
ret = writeOrBuffer(this, state, chunk, encoding, cb);
return ret;
};
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode &&
state.decodeStrings !== false &&
typeof chunk === 'string') {
chunk = new Buffer(chunk, encoding);
}
return chunk;
}
// if we're already writing something, then just put this
// in the queue, and wait our turn. Otherwise, call _write
// If we return false, then we need a drain event, so set that flag.
function writeOrBuffer(stream, state, chunk, encoding, cb) {
chunk = decodeChunk(state, chunk, encoding);
if (Buffer.isBuffer(chunk))
encoding = 'buffer';
var len = state.objectMode ? 1 : chunk.length;
state.length += len;
var ret = state.length < state.highWaterMark;
// we must ensure that previous needDrain will not be reset to false.
if (!ret)
state.needDrain = true;
if (state.writing)
state.buffer.push(new WriteReq(chunk, encoding, cb));
else
doWrite(stream, state, len, chunk, encoding, cb);
return ret;
}
function doWrite(stream, state, len, chunk, encoding, cb) {
state.writelen = len;
state.writecb = cb;
state.writing = true;
state.sync = true;
stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
if (sync)
process.nextTick(function() {
cb(er);
});
else
cb(er);
stream._writableState.errorEmitted = true;
stream.emit('error', er);
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
onwriteStateUpdate(state);
if (er)
onwriteError(stream, state, sync, er, cb);
else {
// Check if we're actually ready to finish, but don't emit yet
var finished = needFinish(stream, state);
if (!finished && !state.bufferProcessing && state.buffer.length)
clearBuffer(stream, state);
if (sync) {
process.nextTick(function() {
afterWrite(stream, state, finished, cb);
});
} else {
afterWrite(stream, state, finished, cb);
}
}
}
function afterWrite(stream, state, finished, cb) {
if (!finished)
onwriteDrain(stream, state);
cb();
if (finished)
finishMaybe(stream, state);
}
// Must force callback to be called on nextTick, so that we don't
// emit 'drain' before the write() consumer gets the 'false' return
// value, and has a chance to attach a 'drain' listener.
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit('drain');
}
}
// if there's something in the buffer waiting, then process it
function clearBuffer(stream, state) {
state.bufferProcessing = true;
for (var c = 0; c < state.buffer.length; c++) {
var entry = state.buffer[c];
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, len, chunk, encoding, cb);
// if we didn't call the onwrite immediately, then
// it means that we need to wait until it does.
// also, that means that the chunk and cb are currently
// being processed, so move the buffer counter past them.
if (state.writing) {
c++;
break;
}
}
state.bufferProcessing = false;
if (c < state.buffer.length)
state.buffer = state.buffer.slice(c);
else
state.buffer.length = 0;
}
Writable.prototype._write = function(chunk, encoding, cb) {
cb(new Error('not implemented'));
};
Writable.prototype.end = function(chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === 'function') {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
if (typeof chunk !== 'undefined' && chunk !== null)
this.write(chunk, encoding);
// ignore unnecessary end() calls.
if (!state.ending && !state.finished)
endWritable(this, state, cb);
};
function needFinish(stream, state) {
return (state.ending &&
state.length === 0 &&
!state.finished &&
!state.writing);
}
function finishMaybe(stream, state) {
var need = needFinish(stream, state);
if (need) {
state.finished = true;
stream.emit('finish');
}
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
if (state.finished)
process.nextTick(cb);
else
stream.once('finish', cb);
}
state.ended = true;
}
``` | /content/code_sandbox/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,685 |
```javascript
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
module.exports = Readable;
/*<replacement>*/
var isArray = require('isarray');
/*</replacement>*/
/*<replacement>*/
var Buffer = require('buffer').Buffer;
/*</replacement>*/
Readable.ReadableState = ReadableState;
var EE = require('events').EventEmitter;
/*<replacement>*/
if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
return emitter.listeners(type).length;
};
/*</replacement>*/
var Stream = require('stream');
/*<replacement>*/
var util = require('core-util-is');
util.inherits = require('inherits');
/*</replacement>*/
var StringDecoder;
util.inherits(Readable, Stream);
function ReadableState(options, stream) {
options = options || {};
// the point at which it stops calling _read() to fill the buffer
// Note: 0 is a valid value, means "don't call _read preemptively ever"
var hwm = options.highWaterMark;
this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
// cast to ints.
this.highWaterMark = ~~this.highWaterMark;
this.buffer = [];
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
this.flowing = false;
this.ended = false;
this.endEmitted = false;
this.reading = false;
// In streams that never have any data, and do push(null) right away,
// the consumer can miss the 'end' event if they do some I/O before
// consuming the stream. So, we don't emit('end') until some reading
// happens.
this.calledRead = false;
// a flag to be able to tell if the onwrite cb is called immediately,
// or on a later tick. We set this to true at first, becuase any
// actions that shouldn't happen until "later" should generally also
// not happen before the first write call.
this.sync = true;
// whenever we return null, then we set a flag to say
// that we're awaiting a 'readable' event emission.
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
// object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
// Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.
// Everything else in the universe uses 'utf8', though.
this.defaultEncoding = options.defaultEncoding || 'utf8';
// when piping, we only care about 'readable' events that happen
// after read()ing all the bytes and not getting any pushback.
this.ranOut = false;
// the number of writers that are awaiting a drain event in .pipe()s
this.awaitDrain = 0;
// if true, a maybeReadMore has been scheduled
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder)
StringDecoder = require('string_decoder/').StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
if (!(this instanceof Readable))
return new Readable(options);
this._readableState = new ReadableState(options, this);
// legacy
this.readable = true;
Stream.call(this);
}
// Manually shove something into the read() buffer.
// This returns true if the highWaterMark has not been hit yet,
// similar to how Writable.write() returns true if you should
// write() some more.
Readable.prototype.push = function(chunk, encoding) {
var state = this._readableState;
if (typeof chunk === 'string' && !state.objectMode) {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
chunk = new Buffer(chunk, encoding);
encoding = '';
}
}
return readableAddChunk(this, state, chunk, encoding, false);
};
// Unshift should *always* be something directly out of read()
Readable.prototype.unshift = function(chunk) {
var state = this._readableState;
return readableAddChunk(this, state, chunk, '', true);
};
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
var er = chunkInvalid(state, chunk);
if (er) {
stream.emit('error', er);
} else if (chunk === null || chunk === undefined) {
state.reading = false;
if (!state.ended)
onEofChunk(stream, state);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (state.ended && !addToFront) {
var e = new Error('stream.push() after EOF');
stream.emit('error', e);
} else if (state.endEmitted && addToFront) {
var e = new Error('stream.unshift() after end event');
stream.emit('error', e);
} else {
if (state.decoder && !addToFront && !encoding)
chunk = state.decoder.write(chunk);
// update the buffer info.
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront) {
state.buffer.unshift(chunk);
} else {
state.reading = false;
state.buffer.push(chunk);
}
if (state.needReadable)
emitReadable(stream);
maybeReadMore(stream, state);
}
} else if (!addToFront) {
state.reading = false;
}
return needMoreData(state);
}
// if it's past the high water mark, we can push in some more.
// Also, if we have no data yet, we can stand some
// more bytes. This is to work around cases where hwm=0,
// such as the repl. Also, if the push() triggered a
// readable event, and the user called read(largeNumber) such that
// needReadable was set, then we ought to push more, so that another
// 'readable' event will be triggered.
function needMoreData(state) {
return !state.ended &&
(state.needReadable ||
state.length < state.highWaterMark ||
state.length === 0);
}
// backwards compatibility.
Readable.prototype.setEncoding = function(enc) {
if (!StringDecoder)
StringDecoder = require('string_decoder/').StringDecoder;
this._readableState.decoder = new StringDecoder(enc);
this._readableState.encoding = enc;
};
// Don't raise the hwm > 128MB
var MAX_HWM = 0x800000;
function roundUpToNextPowerOf2(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
// Get the next highest power of 2
n--;
for (var p = 1; p < 32; p <<= 1) n |= n >> p;
n++;
}
return n;
}
function howMuchToRead(n, state) {
if (state.length === 0 && state.ended)
return 0;
if (state.objectMode)
return n === 0 ? 0 : 1;
if (n === null || isNaN(n)) {
// only flow one buffer at a time
if (state.flowing && state.buffer.length)
return state.buffer[0].length;
else
return state.length;
}
if (n <= 0)
return 0;
// If we're asking for more than the target buffer level,
// then raise the water mark. Bump up to the next highest
// power of 2, to prevent increasing it excessively in tiny
// amounts.
if (n > state.highWaterMark)
state.highWaterMark = roundUpToNextPowerOf2(n);
// don't have that much. return null, unless we've ended.
if (n > state.length) {
if (!state.ended) {
state.needReadable = true;
return 0;
} else
return state.length;
}
return n;
}
// you can override either this method, or the async _read(n) below.
Readable.prototype.read = function(n) {
var state = this._readableState;
state.calledRead = true;
var nOrig = n;
var ret;
if (typeof n !== 'number' || n > 0)
state.emittedReadable = false;
// if we're doing read(0) to trigger a readable event, but we
// already have a bunch of data in the buffer, then just trigger
// the 'readable' event and move on.
if (n === 0 &&
state.needReadable &&
(state.length >= state.highWaterMark || state.ended)) {
emitReadable(this);
return null;
}
n = howMuchToRead(n, state);
// if we've ended, and we're now clear, then finish it up.
if (n === 0 && state.ended) {
ret = null;
// In cases where the decoder did not receive enough data
// to produce a full chunk, then immediately received an
// EOF, state.buffer will contain [<Buffer >, <Buffer 00 ...>].
// howMuchToRead will see this and coerce the amount to
// read to zero (because it's looking at the length of the
// first <Buffer > in state.buffer), and we'll end up here.
//
// This can only happen via state.decoder -- no other venue
// exists for pushing a zero-length chunk into state.buffer
// and triggering this behavior. In this case, we return our
// remaining data and end the stream, if appropriate.
if (state.length > 0 && state.decoder) {
ret = fromList(n, state);
state.length -= ret.length;
}
if (state.length === 0)
endReadable(this);
return ret;
}
// All the actual chunk generation logic needs to be
// *below* the call to _read. The reason is that in certain
// synthetic stream cases, such as passthrough streams, _read
// may be a completely synchronous operation which may change
// the state of the read buffer, providing enough data when
// before there was *not* enough.
//
// So, the steps are:
// 1. Figure out what the state of things will be after we do
// a read from the buffer.
//
// 2. If that resulting state will trigger a _read, then call _read.
// Note that this may be asynchronous, or synchronous. Yes, it is
// deeply ugly to write APIs this way, but that still doesn't mean
// that the Readable class should behave improperly, as streams are
// designed to be sync/async agnostic.
// Take note if the _read call is sync or async (ie, if the read call
// has returned yet), so that we know whether or not it's safe to emit
// 'readable' etc.
//
// 3. Actually pull the requested chunks out of the buffer and return.
// if we need a readable event, then we need to do some reading.
var doRead = state.needReadable;
// if we currently have less than the highWaterMark, then also read some
if (state.length - n <= state.highWaterMark)
doRead = true;
// however, if we've ended, then there's no point, and if we're already
// reading, then it's unnecessary.
if (state.ended || state.reading)
doRead = false;
if (doRead) {
state.reading = true;
state.sync = true;
// if the length is currently zero, then we *need* a readable event.
if (state.length === 0)
state.needReadable = true;
// call internal read method
this._read(state.highWaterMark);
state.sync = false;
}
// If _read called its callback synchronously, then `reading`
// will be false, and we need to re-evaluate how much data we
// can return to the user.
if (doRead && !state.reading)
n = howMuchToRead(nOrig, state);
if (n > 0)
ret = fromList(n, state);
else
ret = null;
if (ret === null) {
state.needReadable = true;
n = 0;
}
state.length -= n;
// If we have nothing in the buffer, then we want to know
// as soon as we *do* get something into the buffer.
if (state.length === 0 && !state.ended)
state.needReadable = true;
// If we happened to read() exactly the remaining amount in the
// buffer, and the EOF has been seen at this point, then make sure
// that we emit 'end' on the very next tick.
if (state.ended && !state.endEmitted && state.length === 0)
endReadable(this);
return ret;
};
function chunkInvalid(state, chunk) {
var er = null;
if (!Buffer.isBuffer(chunk) &&
'string' !== typeof chunk &&
chunk !== null &&
chunk !== undefined &&
!state.objectMode) {
er = new TypeError('Invalid non-string/buffer chunk');
}
return er;
}
function onEofChunk(stream, state) {
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
}
}
state.ended = true;
// if we've ended and we have some data left, then emit
// 'readable' now to make sure it gets picked up.
if (state.length > 0)
emitReadable(stream);
else
endReadable(stream);
}
// Don't emit readable right away in sync mode, because this can trigger
// another read() call => stack overflow. This way, it might trigger
// a nextTick recursion warning, but that's not so bad.
function emitReadable(stream) {
var state = stream._readableState;
state.needReadable = false;
if (state.emittedReadable)
return;
state.emittedReadable = true;
if (state.sync)
process.nextTick(function() {
emitReadable_(stream);
});
else
emitReadable_(stream);
}
function emitReadable_(stream) {
stream.emit('readable');
}
// at this point, the user has presumably seen the 'readable' event,
// and called read() to consume some data. that may have triggered
// in turn another _read(n) call, in which case reading = true if
// it's in progress.
// However, if we're not ended, or reading, and the length < hwm,
// then go ahead and try to read some more preemptively.
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
process.nextTick(function() {
maybeReadMore_(stream, state);
});
}
}
function maybeReadMore_(stream, state) {
var len = state.length;
while (!state.reading && !state.flowing && !state.ended &&
state.length < state.highWaterMark) {
stream.read(0);
if (len === state.length)
// didn't get any data, stop spinning.
break;
else
len = state.length;
}
state.readingMore = false;
}
// abstract method. to be overridden in specific implementation classes.
// call cb(er, data) where data is <= n in length.
// for virtual (non-string, non-buffer) streams, "length" is somewhat
// arbitrary, and perhaps not very meaningful.
Readable.prototype._read = function(n) {
this.emit('error', new Error('not implemented'));
};
Readable.prototype.pipe = function(dest, pipeOpts) {
var src = this;
var state = this._readableState;
switch (state.pipesCount) {
case 0:
state.pipes = dest;
break;
case 1:
state.pipes = [state.pipes, dest];
break;
default:
state.pipes.push(dest);
break;
}
state.pipesCount += 1;
var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
dest !== process.stdout &&
dest !== process.stderr;
var endFn = doEnd ? onend : cleanup;
if (state.endEmitted)
process.nextTick(endFn);
else
src.once('end', endFn);
dest.on('unpipe', onunpipe);
function onunpipe(readable) {
if (readable !== src) return;
cleanup();
}
function onend() {
dest.end();
}
// when the dest drains, it reduces the awaitDrain counter
// on the source. This would be more elegant with a .once()
// handler in flow(), but adding and removing repeatedly is
// too slow.
var ondrain = pipeOnDrain(src);
dest.on('drain', ondrain);
function cleanup() {
// cleanup event handlers once the pipe is broken
dest.removeListener('close', onclose);
dest.removeListener('finish', onfinish);
dest.removeListener('drain', ondrain);
dest.removeListener('error', onerror);
dest.removeListener('unpipe', onunpipe);
src.removeListener('end', onend);
src.removeListener('end', cleanup);
// if the reader is waiting for a drain event from this
// specific writer, then it would cause it to never start
// flowing again.
// So, if this is awaiting a drain, then we just call it now.
// If we don't know, then assume that we are waiting for one.
if (!dest._writableState || dest._writableState.needDrain)
ondrain();
}
// if the dest has an error, then stop piping into it.
// however, don't suppress the throwing behavior for this.
function onerror(er) {
unpipe();
dest.removeListener('error', onerror);
if (EE.listenerCount(dest, 'error') === 0)
dest.emit('error', er);
}
// This is a brutally ugly hack to make sure that our error handler
// is attached before any userland ones. NEVER DO THIS.
if (!dest._events || !dest._events.error)
dest.on('error', onerror);
else if (isArray(dest._events.error))
dest._events.error.unshift(onerror);
else
dest._events.error = [onerror, dest._events.error];
// Both close and finish should trigger unpipe, but only once.
function onclose() {
dest.removeListener('finish', onfinish);
unpipe();
}
dest.once('close', onclose);
function onfinish() {
dest.removeListener('close', onclose);
unpipe();
}
dest.once('finish', onfinish);
function unpipe() {
src.unpipe(dest);
}
// tell the dest that it's being piped to
dest.emit('pipe', src);
// start the flow if it hasn't been started already.
if (!state.flowing) {
// the handler that waits for readable events after all
// the data gets sucked out in flow.
// This would be easier to follow with a .once() handler
// in flow(), but that is too slow.
this.on('readable', pipeOnReadable);
state.flowing = true;
process.nextTick(function() {
flow(src);
});
}
return dest;
};
function pipeOnDrain(src) {
return function() {
var dest = this;
var state = src._readableState;
state.awaitDrain--;
if (state.awaitDrain === 0)
flow(src);
};
}
function flow(src) {
var state = src._readableState;
var chunk;
state.awaitDrain = 0;
function write(dest, i, list) {
var written = dest.write(chunk);
if (false === written) {
state.awaitDrain++;
}
}
while (state.pipesCount && null !== (chunk = src.read())) {
if (state.pipesCount === 1)
write(state.pipes, 0, null);
else
forEach(state.pipes, write);
src.emit('data', chunk);
// if anyone needs a drain, then we have to wait for that.
if (state.awaitDrain > 0)
return;
}
// if every destination was unpiped, either before entering this
// function, or in the while loop, then stop flowing.
//
// NB: This is a pretty rare edge case.
if (state.pipesCount === 0) {
state.flowing = false;
// if there were data event listeners added, then switch to old mode.
if (EE.listenerCount(src, 'data') > 0)
emitDataEvents(src);
return;
}
// at this point, no one needed a drain, so we just ran out of data
// on the next readable event, start it over again.
state.ranOut = true;
}
function pipeOnReadable() {
if (this._readableState.ranOut) {
this._readableState.ranOut = false;
flow(this);
}
}
Readable.prototype.unpipe = function(dest) {
var state = this._readableState;
// if we're not piping anywhere, then do nothing.
if (state.pipesCount === 0)
return this;
// just one destination. most common case.
if (state.pipesCount === 1) {
// passed in one, but it's not the right one.
if (dest && dest !== state.pipes)
return this;
if (!dest)
dest = state.pipes;
// got a match.
state.pipes = null;
state.pipesCount = 0;
this.removeListener('readable', pipeOnReadable);
state.flowing = false;
if (dest)
dest.emit('unpipe', this);
return this;
}
// slow case. multiple pipe destinations.
if (!dest) {
// remove all.
var dests = state.pipes;
var len = state.pipesCount;
state.pipes = null;
state.pipesCount = 0;
this.removeListener('readable', pipeOnReadable);
state.flowing = false;
for (var i = 0; i < len; i++)
dests[i].emit('unpipe', this);
return this;
}
// try to find the right one.
var i = indexOf(state.pipes, dest);
if (i === -1)
return this;
state.pipes.splice(i, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1)
state.pipes = state.pipes[0];
dest.emit('unpipe', this);
return this;
};
// set up data events if they are asked for
// Ensure readable listeners eventually get something
Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
if (ev === 'data' && !this._readableState.flowing)
emitDataEvents(this);
if (ev === 'readable' && this.readable) {
var state = this._readableState;
if (!state.readableListening) {
state.readableListening = true;
state.emittedReadable = false;
state.needReadable = true;
if (!state.reading) {
this.read(0);
} else if (state.length) {
emitReadable(this, state);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
// pause() and resume() are remnants of the legacy readable stream API
// If the user uses them, then switch into old mode.
Readable.prototype.resume = function() {
emitDataEvents(this);
this.read(0);
this.emit('resume');
};
Readable.prototype.pause = function() {
emitDataEvents(this, true);
this.emit('pause');
};
function emitDataEvents(stream, startPaused) {
var state = stream._readableState;
if (state.flowing) {
// path_to_url
throw new Error('Cannot switch to old mode now.');
}
var paused = startPaused || false;
var readable = false;
// convert to an old-style stream.
stream.readable = true;
stream.pipe = Stream.prototype.pipe;
stream.on = stream.addListener = Stream.prototype.on;
stream.on('readable', function() {
readable = true;
var c;
while (!paused && (null !== (c = stream.read())))
stream.emit('data', c);
if (c === null) {
readable = false;
stream._readableState.needReadable = true;
}
});
stream.pause = function() {
paused = true;
this.emit('pause');
};
stream.resume = function() {
paused = false;
if (readable)
process.nextTick(function() {
stream.emit('readable');
});
else
this.read(0);
this.emit('resume');
};
// now make it start, just in case it hadn't already.
stream.emit('readable');
}
// wrap an old-style stream as the async data source.
// This is *not* part of the readable stream interface.
// It is an ugly unfortunate mess of history.
Readable.prototype.wrap = function(stream) {
var state = this._readableState;
var paused = false;
var self = this;
stream.on('end', function() {
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length)
self.push(chunk);
}
self.push(null);
});
stream.on('data', function(chunk) {
if (state.decoder)
chunk = state.decoder.write(chunk);
// don't skip over falsy values in objectMode
//if (state.objectMode && util.isNullOrUndefined(chunk))
if (state.objectMode && (chunk === null || chunk === undefined))
return;
else if (!state.objectMode && (!chunk || !chunk.length))
return;
var ret = self.push(chunk);
if (!ret) {
paused = true;
stream.pause();
}
});
// proxy all the other methods.
// important when wrapping filters and duplexes.
for (var i in stream) {
if (typeof stream[i] === 'function' &&
typeof this[i] === 'undefined') {
this[i] = function(method) { return function() {
return stream[method].apply(stream, arguments);
}}(i);
}
}
// proxy certain important events.
var events = ['error', 'close', 'destroy', 'pause', 'resume'];
forEach(events, function(ev) {
stream.on(ev, self.emit.bind(self, ev));
});
// when we try to consume some more bytes, simply unpause the
// underlying stream.
self._read = function(n) {
if (paused) {
paused = false;
stream.resume();
}
};
return self;
};
// exposed for testing purposes only.
Readable._fromList = fromList;
// Pluck off n bytes from an array of buffers.
// Length is the combined lengths of all the buffers in the list.
function fromList(n, state) {
var list = state.buffer;
var length = state.length;
var stringMode = !!state.decoder;
var objectMode = !!state.objectMode;
var ret;
// nothing in the list, definitely empty.
if (list.length === 0)
return null;
if (length === 0)
ret = null;
else if (objectMode)
ret = list.shift();
else if (!n || n >= length) {
// read it all, truncate the array.
if (stringMode)
ret = list.join('');
else
ret = Buffer.concat(list, length);
list.length = 0;
} else {
// read just some of it.
if (n < list[0].length) {
// just take a part of the first list item.
// slice is the same for buffers and strings.
var buf = list[0];
ret = buf.slice(0, n);
list[0] = buf.slice(n);
} else if (n === list[0].length) {
// first list is a perfect match
ret = list.shift();
} else {
// complex case.
// we have enough to cover it, but it spans past the first buffer.
if (stringMode)
ret = '';
else
ret = new Buffer(n);
var c = 0;
for (var i = 0, l = list.length; i < l && c < n; i++) {
var buf = list[0];
var cpy = Math.min(n - c, buf.length);
if (stringMode)
ret += buf.slice(0, cpy);
else
buf.copy(ret, c, 0, cpy);
if (cpy < buf.length)
list[0] = buf.slice(cpy);
else
list.shift();
c += cpy;
}
}
}
return ret;
}
function endReadable(stream) {
var state = stream._readableState;
// If we get here before consuming all the bytes, then that is a
// bug in node. Should never happen.
if (state.length > 0)
throw new Error('endReadable called on non-empty stream');
if (!state.endEmitted && state.calledRead) {
state.ended = true;
process.nextTick(function() {
// Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
});
}
}
function forEach (xs, f) {
for (var i = 0, l = xs.length; i < l; i++) {
f(xs[i], i);
}
}
function indexOf (xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
}
``` | /content/code_sandbox/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 7,019 |
```javascript
/**
* dashdash - A light, featureful and explicit option parsing library for
* node.js.
*/
// vim: set ts=4 sts=4 sw=4 et:
var assert = require('assert-plus');
var format = require('util').format;
var fs = require('fs');
var path = require('path');
var DEBUG = true;
if (DEBUG) {
var debug = console.warn;
} else {
var debug = function () {};
}
// ---- internal support stuff
// Replace {{variable}} in `s` with the template data in `d`.
function renderTemplate(s, d) {
return s.replace(/{{([a-zA-Z]+)}}/g, function (match, key) {
return d.hasOwnProperty(key) ? d[key] : match;
});
}
/**
* Return a shallow copy of the given object;
*/
function shallowCopy(obj) {
if (!obj) {
return (obj);
}
var copy = {};
Object.keys(obj).forEach(function (k) {
copy[k] = obj[k];
});
return (copy);
}
function space(n) {
var s = '';
for (var i = 0; i < n; i++) {
s += ' ';
}
return s;
}
function makeIndent(arg, deflen, name) {
if (arg === null || arg === undefined)
return space(deflen);
else if (typeof (arg) === 'number')
return space(arg);
else if (typeof (arg) === 'string')
return arg;
else
assert.fail('invalid "' + name + '": not a string or number: ' + arg);
}
/**
* Return an array of lines wrapping the given text to the given width.
* This splits on whitespace. Single tokens longer than `width` are not
* broken up.
*/
function textwrap(s, width) {
var words = s.trim().split(/\s+/);
var lines = [];
var line = '';
words.forEach(function (w) {
var newLength = line.length + w.length;
if (line.length > 0)
newLength += 1;
if (newLength > width) {
lines.push(line);
line = '';
}
if (line.length > 0)
line += ' ';
line += w;
});
lines.push(line);
return lines;
}
/**
* Transform an option name to a "key" that is used as the field
* on the `opts` object returned from `<parser>.parse()`.
*
* Transformations:
* - '-' -> '_': This allow one to use hyphen in option names (common)
* but not have to do silly things like `opt["dry-run"]` to access the
* parsed results.
*/
function optionKeyFromName(name) {
return name.replace(/-/g, '_');
}
// ---- Option types
function parseBool(option, optstr, arg) {
return Boolean(arg);
}
function parseString(option, optstr, arg) {
assert.string(arg, 'arg');
return arg;
}
function parseNumber(option, optstr, arg) {
assert.string(arg, 'arg');
var num = Number(arg);
if (isNaN(num)) {
throw new Error(format('arg for "%s" is not a number: "%s"',
optstr, arg));
}
return num;
}
function parseInteger(option, optstr, arg) {
assert.string(arg, 'arg');
var num = Number(arg);
if (!/^[0-9-]+$/.test(arg) || isNaN(num)) {
throw new Error(format('arg for "%s" is not an integer: "%s"',
optstr, arg));
}
return num;
}
function parsePositiveInteger(option, optstr, arg) {
assert.string(arg, 'arg');
var num = Number(arg);
if (!/^[0-9]+$/.test(arg) || isNaN(num) || num === 0) {
throw new Error(format('arg for "%s" is not a positive integer: "%s"',
optstr, arg));
}
return num;
}
/**
* Supported date args:
* - epoch second times (e.g. 1396031701)
* - ISO 8601 format: YYYY-MM-DD[THH:MM:SS[.sss][Z]]
* 2014-03-28T18:35:01.489Z
* 2014-03-28T18:35:01.489
* 2014-03-28T18:35:01Z
* 2014-03-28T18:35:01
* 2014-03-28
*/
function parseDate(option, optstr, arg) {
assert.string(arg, 'arg');
var date;
if (/^\d+$/.test(arg)) {
// epoch seconds
date = new Date(Number(arg) * 1000);
/* JSSTYLED */
} else if (/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?Z?)?$/i.test(arg)) {
// ISO 8601 format
date = new Date(arg);
} else {
throw new Error(format('arg for "%s" is not a valid date format: "%s"',
optstr, arg));
}
if (date.toString() === 'Invalid Date') {
throw new Error(format('arg for "%s" is an invalid date: "%s"',
optstr, arg));
}
return date;
}
var optionTypes = {
bool: {
takesArg: false,
parseArg: parseBool
},
string: {
takesArg: true,
helpArg: 'ARG',
parseArg: parseString
},
number: {
takesArg: true,
helpArg: 'NUM',
parseArg: parseNumber
},
integer: {
takesArg: true,
helpArg: 'INT',
parseArg: parseInteger
},
positiveInteger: {
takesArg: true,
helpArg: 'INT',
parseArg: parsePositiveInteger
},
date: {
takesArg: true,
helpArg: 'DATE',
parseArg: parseDate
},
arrayOfBool: {
takesArg: false,
array: true,
parseArg: parseBool
},
arrayOfString: {
takesArg: true,
helpArg: 'ARG',
array: true,
parseArg: parseString
},
arrayOfNumber: {
takesArg: true,
helpArg: 'NUM',
array: true,
parseArg: parseNumber
},
arrayOfInteger: {
takesArg: true,
helpArg: 'INT',
array: true,
parseArg: parseInteger
},
arrayOfPositiveInteger: {
takesArg: true,
helpArg: 'INT',
array: true,
parseArg: parsePositiveInteger
},
arrayOfDate: {
takesArg: true,
helpArg: 'INT',
array: true,
parseArg: parseDate
},
};
// ---- Parser
/**
* Parser constructor.
*
* @param config {Object} The parser configuration
* - options {Array} Array of option specs. See the README for how to
* specify each option spec.
* - allowUnknown {Boolean} Default false. Whether to throw on unknown
* options. If false, then unknown args are included in the _args array.
* - interspersed {Boolean} Default true. Whether to allow interspersed
* arguments (non-options) and options. E.g.:
* node tool.js arg1 arg2 -v
* '-v' is after some args here. If `interspersed: false` then '-v'
* would not be parsed out. Note that regardless of `interspersed`
* the presence of '--' will stop option parsing, as all good
* option parsers should.
*/
function Parser(config) {
assert.object(config, 'config');
assert.arrayOfObject(config.options, 'config.options');
assert.optionalBool(config.interspersed, 'config.interspersed');
var self = this;
// Allow interspersed arguments (true by default).
this.interspersed = (config.interspersed !== undefined
? config.interspersed : true);
// Don't allow unknown flags (true by default).
this.allowUnknown = (config.allowUnknown !== undefined
? config.allowUnknown : false);
this.options = config.options.map(function (o) { return shallowCopy(o); });
this.optionFromName = {};
this.optionFromEnv = {};
for (var i = 0; i < this.options.length; i++) {
var o = this.options[i];
if (o.group !== undefined && o.group !== null) {
assert.optionalString(o.group,
format('config.options.%d.group', i));
continue;
}
assert.ok(optionTypes[o.type],
format('invalid config.options.%d.type: "%s" in %j',
i, o.type, o));
assert.optionalString(o.name, format('config.options.%d.name', i));
assert.optionalArrayOfString(o.names,
format('config.options.%d.names', i));
assert.ok((o.name || o.names) && !(o.name && o.names),
format('exactly one of "name" or "names" required: %j', o));
assert.optionalString(o.help, format('config.options.%d.help', i));
var env = o.env || [];
if (typeof (env) === 'string') {
env = [env];
}
assert.optionalArrayOfString(env, format('config.options.%d.env', i));
assert.optionalString(o.helpGroup,
format('config.options.%d.helpGroup', i));
assert.optionalBool(o.helpWrap,
format('config.options.%d.helpWrap', i));
assert.optionalBool(o.hidden, format('config.options.%d.hidden', i));
if (o.name) {
o.names = [o.name];
} else {
assert.string(o.names[0],
format('config.options.%d.names is empty', i));
}
o.key = optionKeyFromName(o.names[0]);
o.names.forEach(function (n) {
if (self.optionFromName[n]) {
throw new Error(format(
'option name collision: "%s" used in %j and %j',
n, self.optionFromName[n], o));
}
self.optionFromName[n] = o;
});
env.forEach(function (n) {
if (self.optionFromEnv[n]) {
throw new Error(format(
'option env collision: "%s" used in %j and %j',
n, self.optionFromEnv[n], o));
}
self.optionFromEnv[n] = o;
});
}
}
Parser.prototype.optionTakesArg = function optionTakesArg(option) {
return optionTypes[option.type].takesArg;
};
/**
* Parse options from the given argv.
*
* @param inputs {Object} Optional.
* - argv {Array} Optional. The argv to parse. Defaults to
* `process.argv`.
* - slice {Number} The index into argv at which options/args begin.
* Default is 2, as appropriate for `process.argv`.
* - env {Object} Optional. The env to use for 'env' entries in the
* option specs. Defaults to `process.env`.
* @returns {Object} Parsed `opts`. It has special keys `_args` (the
* remaining args from `argv`) and `_order` (gives the order that
* options were specified).
*/
Parser.prototype.parse = function parse(inputs) {
var self = this;
// Old API was `parse([argv, [slice]])`
if (Array.isArray(arguments[0])) {
inputs = {argv: arguments[0], slice: arguments[1]};
}
assert.optionalObject(inputs, 'inputs');
if (!inputs) {
inputs = {};
}
assert.optionalArrayOfString(inputs.argv, 'inputs.argv');
//assert.optionalNumber(slice, 'slice');
var argv = inputs.argv || process.argv;
var slice = inputs.slice !== undefined ? inputs.slice : 2;
var args = argv.slice(slice);
var env = inputs.env || process.env;
var opts = {};
var _order = [];
function addOpt(option, optstr, key, val, from) {
var type = optionTypes[option.type];
var parsedVal = type.parseArg(option, optstr, val);
if (type.array) {
if (!opts[key]) {
opts[key] = [];
}
if (type.arrayFlatten && Array.isArray(parsedVal)) {
for (var i = 0; i < parsedVal.length; i++) {
opts[key].push(parsedVal[i]);
}
} else {
opts[key].push(parsedVal);
}
} else {
opts[key] = parsedVal;
}
var item = { key: key, value: parsedVal, from: from };
_order.push(item);
}
// Parse args.
var _args = [];
var i = 0;
outer: while (i < args.length) {
var arg = args[i];
// End of options marker.
if (arg === '--') {
i++;
break;
// Long option
} else if (arg.slice(0, 2) === '--') {
var name = arg.slice(2);
var val = null;
var idx = name.indexOf('=');
if (idx !== -1) {
val = name.slice(idx + 1);
name = name.slice(0, idx);
}
var option = this.optionFromName[name];
if (!option) {
if (!this.allowUnknown)
throw new Error(format('unknown option: "--%s"', name));
else if (this.interspersed)
_args.push(arg);
else
break outer;
} else {
var takesArg = this.optionTakesArg(option);
if (val !== null && !takesArg) {
throw new Error(format('argument given to "--%s" option '
+ 'that does not take one: "%s"', name, arg));
}
if (!takesArg) {
addOpt(option, '--'+name, option.key, true, 'argv');
} else if (val !== null) {
addOpt(option, '--'+name, option.key, val, 'argv');
} else if (i + 1 >= args.length) {
throw new Error(format('do not have enough args for "--%s" '
+ 'option', name));
} else {
addOpt(option, '--'+name, option.key, args[i + 1], 'argv');
i++;
}
}
// Short option
} else if (arg[0] === '-' && arg.length > 1) {
var j = 1;
var allFound = true;
while (j < arg.length) {
var name = arg[j];
var option = this.optionFromName[name];
if (!option) {
allFound = false;
if (this.allowUnknown) {
if (this.interspersed) {
_args.push(arg);
break;
} else
break outer;
} else if (arg.length > 2) {
throw new Error(format(
'unknown option: "-%s" in "%s" group',
name, arg));
} else {
throw new Error(format('unknown option: "-%s"', name));
}
} else if (this.optionTakesArg(option)) {
break;
}
j++;
}
j = 1;
while (allFound && j < arg.length) {
var name = arg[j];
var val = arg.slice(j + 1); // option val if it takes an arg
var option = this.optionFromName[name];
var takesArg = this.optionTakesArg(option);
if (!takesArg) {
addOpt(option, '-'+name, option.key, true, 'argv');
} else if (val) {
addOpt(option, '-'+name, option.key, val, 'argv');
break;
} else {
if (i + 1 >= args.length) {
throw new Error(format('do not have enough args '
+ 'for "-%s" option', name));
}
addOpt(option, '-'+name, option.key, args[i + 1], 'argv');
i++;
break;
}
j++;
}
// An interspersed arg
} else if (this.interspersed) {
_args.push(arg);
// An arg and interspersed args are not allowed, so done options.
} else {
break outer;
}
i++;
}
_args = _args.concat(args.slice(i));
// Parse environment.
Object.keys(this.optionFromEnv).forEach(function (envname) {
var val = env[envname];
if (val === undefined)
return;
var option = self.optionFromEnv[envname];
if (opts[option.key] !== undefined)
return;
var takesArg = self.optionTakesArg(option);
if (takesArg) {
addOpt(option, envname, option.key, val, 'env');
} else if (val !== '') {
// Boolean envvar handling:
// - VAR=<empty-string> not set (as if the VAR was not set)
// - VAR=0 false
// - anything else true
addOpt(option, envname, option.key, (val !== '0'), 'env');
}
});
// Apply default values.
this.options.forEach(function (o) {
if (opts[o.key] === undefined) {
if (o.default !== undefined) {
opts[o.key] = o.default;
} else if (o.type && optionTypes[o.type].default !== undefined) {
opts[o.key] = optionTypes[o.type].default;
}
}
});
opts._order = _order;
opts._args = _args;
return opts;
};
/**
* Return help output for the current options.
*
* E.g.: if the current options are:
* [{names: ['help', 'h'], type: 'bool', help: 'Show help and exit.'}]
* then this would return:
* ' -h, --help Show help and exit.\n'
*
* @param config {Object} Config for controlling the option help output.
* - indent {Number|String} Default 4. An indent/prefix to use for
* each option line.
* - nameSort {String} Default is 'length'. By default the names are
* sorted to put the short opts first (i.e. '-h, --help' preferred
* to '--help, -h'). Set to 'none' to not do this sorting.
* - maxCol {Number} Default 80. Note that long tokens in a help string
* can go past this.
* - helpCol {Number} Set to specify a specific column at which
* option help will be aligned. By default this is determined
* automatically.
* - minHelpCol {Number} Default 20.
* - maxHelpCol {Number} Default 40.
* - includeEnv {Boolean} Default false. If true, a note stating the `env`
* envvar (if specified for this option) will be appended to the help
* output.
* - includeDefault {Boolean} Default false. If true, a note stating
* the `default` for this option, if any, will be appended to the help
* output.
* - helpWrap {Boolean} Default true. Wrap help text in helpCol..maxCol
* bounds.
* @returns {String}
*/
Parser.prototype.help = function help(config) {
config = config || {};
assert.object(config, 'config');
var indent = makeIndent(config.indent, 4, 'config.indent');
var headingIndent = makeIndent(config.headingIndent,
Math.round(indent.length / 2), 'config.headingIndent');
assert.optionalString(config.nameSort, 'config.nameSort');
var nameSort = config.nameSort || 'length';
assert.ok(~['length', 'none'].indexOf(nameSort),
'invalid "config.nameSort"');
assert.optionalNumber(config.maxCol, 'config.maxCol');
assert.optionalNumber(config.maxHelpCol, 'config.maxHelpCol');
assert.optionalNumber(config.minHelpCol, 'config.minHelpCol');
assert.optionalNumber(config.helpCol, 'config.helpCol');
assert.optionalBool(config.includeEnv, 'config.includeEnv');
assert.optionalBool(config.includeDefault, 'config.includeDefault');
assert.optionalBool(config.helpWrap, 'config.helpWrap');
var maxCol = config.maxCol || 80;
var minHelpCol = config.minHelpCol || 20;
var maxHelpCol = config.maxHelpCol || 40;
var lines = [];
var maxWidth = 0;
this.options.forEach(function (o) {
if (o.hidden) {
return;
}
if (o.group !== undefined && o.group !== null) {
// We deal with groups in the next pass
lines.push(null);
return;
}
var type = optionTypes[o.type];
var arg = o.helpArg || type.helpArg || 'ARG';
var line = '';
var names = o.names.slice();
if (nameSort === 'length') {
names.sort(function (a, b) {
if (a.length < b.length)
return -1;
else if (b.length < a.length)
return 1;
else
return 0;
})
}
names.forEach(function (name, i) {
if (i > 0)
line += ', ';
if (name.length === 1) {
line += '-' + name
if (type.takesArg)
line += ' ' + arg;
} else {
line += '--' + name
if (type.takesArg)
line += '=' + arg;
}
});
maxWidth = Math.max(maxWidth, line.length);
lines.push(line);
});
// Add help strings.
var helpCol = config.helpCol;
if (!helpCol) {
helpCol = maxWidth + indent.length + 2;
helpCol = Math.min(Math.max(helpCol, minHelpCol), maxHelpCol);
}
var i = -1;
this.options.forEach(function (o) {
if (o.hidden) {
return;
}
i++;
if (o.group !== undefined && o.group !== null) {
if (o.group === '') {
// Support a empty string "group" to have a blank line between
// sets of options.
lines[i] = '';
} else {
// Render the group heading with the heading-specific indent.
lines[i] = (i === 0 ? '' : '\n') + headingIndent +
o.group + ':';
}
return;
}
var helpDefault;
if (config.includeDefault) {
if (o.default !== undefined) {
helpDefault = format('Default: %j', o.default);
} else if (o.type && optionTypes[o.type].default !== undefined) {
helpDefault = format('Default: %j',
optionTypes[o.type].default);
}
}
var line = lines[i] = indent + lines[i];
if (!o.help && !(config.includeEnv && o.env) && !helpDefault) {
return;
}
var n = helpCol - line.length;
if (n >= 0) {
line += space(n);
} else {
line += '\n' + space(helpCol);
}
var helpEnv = '';
if (o.env && o.env.length && config.includeEnv) {
helpEnv += 'Environment: ';
var type = optionTypes[o.type];
var arg = o.helpArg || type.helpArg || 'ARG';
var envs = (Array.isArray(o.env) ? o.env : [o.env]).map(
function (e) {
if (type.takesArg) {
return e + '=' + arg;
} else {
return e + '=1';
}
}
);
helpEnv += envs.join(', ');
}
var help = (o.help || '').trim();
if (o.helpWrap !== false && config.helpWrap !== false) {
// Wrap help description normally.
if (help.length && !~'.!?"\''.indexOf(help.slice(-1))) {
help += '.';
}
if (help.length) {
help += ' ';
}
help += helpEnv;
if (helpDefault) {
if (helpEnv) {
help += '. ';
}
help += helpDefault;
}
line += textwrap(help, maxCol - helpCol).join(
'\n' + space(helpCol));
} else {
// Do not wrap help description, but indent newlines appropriately.
var helpLines = help.split('\n').filter(
function (ln) { return ln.length });
if (helpEnv !== '') {
helpLines.push(helpEnv);
}
if (helpDefault) {
helpLines.push(helpDefault);
}
line += helpLines.join('\n' + space(helpCol));
}
lines[i] = line;
});
var rv = '';
if (lines.length > 0) {
rv = lines.join('\n') + '\n';
}
return rv;
};
/**
* Return a string suitable for a Bash completion file for this tool.
*
* @param args.name {String} The tool name.
* @param args.specExtra {String} Optional. Extra Bash code content to add
* to the end of the "spec". Typically this is used to append Bash
* "complete_TYPE" functions for custom option types. See
* "examples/ddcompletion.js" for an example.
* @param args.argtypes {Array} Optional. Array of completion types for
* positional args (i.e. non-options). E.g.
* argtypes = ['fruit', 'veggie', 'file']
* will result in completion of fruits for the first arg, veggies for the
* second, and filenames for the third and subsequent positional args.
* If not given, positional args will use Bash's 'default' completion.
* See `specExtra` for providing Bash `complete_TYPE` functions, e.g.
* `complete_fruit` and `complete_veggie` in this example.
*/
Parser.prototype.bashCompletion = function bashCompletion(args) {
assert.object(args, 'args');
assert.string(args.name, 'args.name');
assert.optionalString(args.specExtra, 'args.specExtra');
assert.optionalArrayOfString(args.argtypes, 'args.argtypes');
return bashCompletionFromOptions({
name: args.name,
specExtra: args.specExtra,
argtypes: args.argtypes,
options: this.options
});
};
// ---- Bash completion
const BASH_COMPLETION_TEMPLATE_PATH = path.join(
__dirname, '../etc/dashdash.bash_completion.in');
/**
* Return the Bash completion "spec" (the string value for the "{{spec}}"
* var in the "dashdash.bash_completion.in" template) for this tool.
*
* The "spec" is Bash code that defines the CLI options and subcmds for
* the template's completion code. It looks something like this:
*
* local cmd_shortopts="-J ..."
* local cmd_longopts="--help ..."
* local cmd_optargs="-p=tritonprofile ..."
*
* @param args.options {Array} The array of dashdash option specs.
* @param args.context {String} Optional. A context string for the "local cmd*"
* vars in the spec. By default it is the empty string. When used to
* scope for completion on a *sub-command* (e.g. for "git log" on a "git"
* tool), then it would have a value (e.g. "__log"). See
* <path_to_url Bash completion for details.
* @param opts.includeHidden {Boolean} Optional. Default false. By default
* hidden options and subcmds are "excluded". Here excluded means they
* won't be offered as a completion, but if used, their argument type
* will be completed. "Hidden" options and subcmds are ones with the
* `hidden: true` attribute to exclude them from default help output.
* @param args.argtypes {Array} Optional. Array of completion types for
* positional args (i.e. non-options). E.g.
* argtypes = ['fruit', 'veggie', 'file']
* will result in completion of fruits for the first arg, veggies for the
* second, and filenames for the third and subsequent positional args.
* If not given, positional args will use Bash's 'default' completion.
* See `specExtra` for providing Bash `complete_TYPE` functions, e.g.
* `complete_fruit` and `complete_veggie` in this example.
*/
function bashCompletionSpecFromOptions(args) {
assert.object(args, 'args');
assert.object(args.options, 'args.options');
assert.optionalString(args.context, 'args.context');
assert.optionalBool(args.includeHidden, 'args.includeHidden');
assert.optionalArrayOfString(args.argtypes, 'args.argtypes');
var context = args.context || '';
var includeHidden = (args.includeHidden === undefined
? false : args.includeHidden);
var spec = [];
var shortopts = [];
var longopts = [];
var optargs = [];
(args.options || []).forEach(function (o) {
if (o.group !== undefined && o.group !== null) {
// Skip group headers.
return;
}
var optNames = o.names || [o.name];
var optType = getOptionType(o.type);
if (optType.takesArg) {
var completionType = o.completionType ||
optType.completionType || o.type;
optNames.forEach(function (optName) {
if (optName.length === 1) {
if (includeHidden || !o.hidden) {
shortopts.push('-' + optName);
}
// Include even hidden options in `optargs` so that bash
// completion of its arg still works.
optargs.push('-' + optName + '=' + completionType);
} else {
if (includeHidden || !o.hidden) {
longopts.push('--' + optName);
}
optargs.push('--' + optName + '=' + completionType);
}
});
} else {
optNames.forEach(function (optName) {
if (includeHidden || !o.hidden) {
if (optName.length === 1) {
shortopts.push('-' + optName);
} else {
longopts.push('--' + optName);
}
}
});
}
});
spec.push(format('local cmd%s_shortopts="%s"',
context, shortopts.sort().join(' ')));
spec.push(format('local cmd%s_longopts="%s"',
context, longopts.sort().join(' ')));
spec.push(format('local cmd%s_optargs="%s"',
context, optargs.sort().join(' ')));
if (args.argtypes) {
spec.push(format('local cmd%s_argtypes="%s"',
context, args.argtypes.join(' ')));
}
return spec.join('\n');
}
/**
* Return a string suitable for a Bash completion file for this tool.
*
* @param args.name {String} The tool name.
* @param args.options {Array} The array of dashdash option specs.
* @param args.specExtra {String} Optional. Extra Bash code content to add
* to the end of the "spec". Typically this is used to append Bash
* "complete_TYPE" functions for custom option types. See
* "examples/ddcompletion.js" for an example.
* @param args.argtypes {Array} Optional. Array of completion types for
* positional args (i.e. non-options). E.g.
* argtypes = ['fruit', 'veggie', 'file']
* will result in completion of fruits for the first arg, veggies for the
* second, and filenames for the third and subsequent positional args.
* If not given, positional args will use Bash's 'default' completion.
* See `specExtra` for providing Bash `complete_TYPE` functions, e.g.
* `complete_fruit` and `complete_veggie` in this example.
*/
function bashCompletionFromOptions(args) {
assert.object(args, 'args');
assert.object(args.options, 'args.options');
assert.string(args.name, 'args.name');
assert.optionalString(args.specExtra, 'args.specExtra');
assert.optionalArrayOfString(args.argtypes, 'args.argtypes');
// Gather template data.
var data = {
name: args.name,
date: new Date(),
spec: bashCompletionSpecFromOptions({
options: args.options,
argtypes: args.argtypes
}),
};
if (args.specExtra) {
data.spec += '\n\n' + args.specExtra;
}
// Render template.
var template = fs.readFileSync(BASH_COMPLETION_TEMPLATE_PATH, 'utf8');
return renderTemplate(template, data);
}
// ---- exports
function createParser(config) {
return new Parser(config);
}
/**
* Parse argv with the given options.
*
* @param config {Object} A merge of all the available fields from
* `dashdash.Parser` and `dashdash.Parser.parse`: options, interspersed,
* argv, env, slice.
*/
function parse(config) {
assert.object(config, 'config');
assert.optionalArrayOfString(config.argv, 'config.argv');
assert.optionalObject(config.env, 'config.env');
var config = shallowCopy(config);
var argv = config.argv;
delete config.argv;
var env = config.env;
delete config.env;
var parser = new Parser(config);
return parser.parse({argv: argv, env: env});
}
/**
* Add a new option type.
*
* @params optionType {Object}:
* - name {String} Required.
* - takesArg {Boolean} Required. Whether this type of option takes an
* argument on process.argv. Typically this is true for all but the
* "bool" type.
* - helpArg {String} Required iff `takesArg === true`. The string to
* show in generated help for options of this type.
* - parseArg {Function} Require. `function (option, optstr, arg)` parser
* that takes a string argument and returns an instance of the
* appropriate type, or throws an error if the arg is invalid.
* - array {Boolean} Optional. Set to true if this is an 'arrayOf' type
* that collects multiple usages of the option in process.argv and
* puts results in an array.
* - arrayFlatten {Boolean} Optional. XXX
* - default Optional. Default value for options of this type, if no
* default is specified in the option type usage.
*/
function addOptionType(optionType) {
assert.object(optionType, 'optionType');
assert.string(optionType.name, 'optionType.name');
assert.bool(optionType.takesArg, 'optionType.takesArg');
if (optionType.takesArg) {
assert.string(optionType.helpArg, 'optionType.helpArg');
}
assert.func(optionType.parseArg, 'optionType.parseArg');
assert.optionalBool(optionType.array, 'optionType.array');
assert.optionalBool(optionType.arrayFlatten, 'optionType.arrayFlatten');
optionTypes[optionType.name] = {
takesArg: optionType.takesArg,
helpArg: optionType.helpArg,
parseArg: optionType.parseArg,
array: optionType.array,
arrayFlatten: optionType.arrayFlatten,
default: optionType.default
}
}
function getOptionType(name) {
assert.string(name, 'name');
return optionTypes[name];
}
/**
* Return a synopsis string for the given option spec.
*
* Examples:
* > synopsisFromOpt({names: ['help', 'h'], type: 'bool'});
* '[ --help | -h ]'
* > synopsisFromOpt({name: 'file', type: 'string', helpArg: 'FILE'});
* '[ --file=FILE ]'
*/
function synopsisFromOpt(o) {
assert.object(o, 'o');
if (o.hasOwnProperty('group')) {
return null;
}
var names = o.names || [o.name];
// `type` here could be undefined if, for example, the command has a
// dashdash option spec with a bogus 'type'.
var type = getOptionType(o.type);
var helpArg = o.helpArg || (type && type.helpArg) || 'ARG';
var parts = [];
names.forEach(function (name) {
var part = (name.length === 1 ? '-' : '--') + name;
if (type && type.takesArg) {
part += (name.length === 1 ? ' ' + helpArg : '=' + helpArg);
}
parts.push(part);
});
return ('[ ' + parts.join(' | ') + ' ]');
};
module.exports = {
createParser: createParser,
Parser: Parser,
parse: parse,
addOptionType: addOptionType,
getOptionType: getOptionType,
synopsisFromOpt: synopsisFromOpt,
// Bash completion-related exports
BASH_COMPLETION_TEMPLATE_PATH: BASH_COMPLETION_TEMPLATE_PATH,
bashCompletionFromOptions: bashCompletionFromOptions,
bashCompletionSpecFromOptions: bashCompletionSpecFromOptions,
// Export the parseFoo parsers because they might be useful as primitives
// for custom option types.
parseBool: parseBool,
parseString: parseString,
parseNumber: parseNumber,
parseInteger: parseInteger,
parsePositiveInteger: parsePositiveInteger,
parseDate: parseDate
};
``` | /content/code_sandbox/node_modules/dashdash/lib/dashdash.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 8,347 |
```javascript
"use strict";
var BOMChar = '\uFEFF';
exports.PrependBOM = PrependBOMWrapper
function PrependBOMWrapper(encoder, options) {
this.encoder = encoder;
this.addBOM = true;
}
PrependBOMWrapper.prototype.write = function(str) {
if (this.addBOM) {
str = BOMChar + str;
this.addBOM = false;
}
return this.encoder.write(str);
}
PrependBOMWrapper.prototype.end = function() {
return this.encoder.end();
}
//your_sha256_hash--------------
exports.StripBOM = StripBOMWrapper;
function StripBOMWrapper(decoder, options) {
this.decoder = decoder;
this.pass = false;
this.options = options || {};
}
StripBOMWrapper.prototype.write = function(buf) {
var res = this.decoder.write(buf);
if (this.pass || !res)
return res;
if (res[0] === BOMChar) {
res = res.slice(1);
if (typeof this.options.stripBOM === 'function')
this.options.stripBOM();
}
this.pass = true;
return res;
}
StripBOMWrapper.prototype.end = function() {
return this.decoder.end();
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/lib/bom-handling.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 271 |
```javascript
/*!
* raw-body
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var asyncHooks = tryRequireAsyncHooks()
var bytes = require('bytes')
var createError = require('http-errors')
var iconv = require('iconv-lite')
var unpipe = require('unpipe')
/**
* Module exports.
* @public
*/
module.exports = getRawBody
/**
* Module variables.
* @private
*/
var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: /
/**
* Get the decoder for a given encoding.
*
* @param {string} encoding
* @private
*/
function getDecoder (encoding) {
if (!encoding) return null
try {
return iconv.getDecoder(encoding)
} catch (e) {
// error getting decoder
if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e
// the encoding was not found
throw createError(415, 'specified encoding unsupported', {
encoding: encoding,
type: 'encoding.unsupported'
})
}
}
/**
* Get the raw body of a stream (typically HTTP).
*
* @param {object} stream
* @param {object|string|function} [options]
* @param {function} [callback]
* @public
*/
function getRawBody (stream, options, callback) {
var done = callback
var opts = options || {}
if (options === true || typeof options === 'string') {
// short cut for encoding
opts = {
encoding: options
}
}
if (typeof options === 'function') {
done = options
opts = {}
}
// validate callback is a function, if provided
if (done !== undefined && typeof done !== 'function') {
throw new TypeError('argument callback must be a function')
}
// require the callback without promises
if (!done && !global.Promise) {
throw new TypeError('argument callback is required')
}
// get encoding
var encoding = opts.encoding !== true
? opts.encoding
: 'utf-8'
// convert the limit to an integer
var limit = bytes.parse(opts.limit)
// convert the expected length to an integer
var length = opts.length != null && !isNaN(opts.length)
? parseInt(opts.length, 10)
: null
if (done) {
// classic callback style
return readStream(stream, encoding, length, limit, wrap(done))
}
return new Promise(function executor (resolve, reject) {
readStream(stream, encoding, length, limit, function onRead (err, buf) {
if (err) return reject(err)
resolve(buf)
})
})
}
/**
* Halt a stream.
*
* @param {Object} stream
* @private
*/
function halt (stream) {
// unpipe everything from the stream
unpipe(stream)
// pause stream
if (typeof stream.pause === 'function') {
stream.pause()
}
}
/**
* Read the data from the stream.
*
* @param {object} stream
* @param {string} encoding
* @param {number} length
* @param {number} limit
* @param {function} callback
* @public
*/
function readStream (stream, encoding, length, limit, callback) {
var complete = false
var sync = true
// check the length and limit options.
// note: we intentionally leave the stream paused,
// so users should handle the stream themselves.
if (limit !== null && length !== null && length > limit) {
return done(createError(413, 'request entity too large', {
expected: length,
length: length,
limit: limit,
type: 'entity.too.large'
}))
}
// streams1: assert request encoding is buffer.
// streams2+: assert the stream encoding is buffer.
// stream._decoder: streams1
// state.encoding: streams2
// state.decoder: streams2, specifically < 0.10.6
var state = stream._readableState
if (stream._decoder || (state && (state.encoding || state.decoder))) {
// developer error
return done(createError(500, 'stream encoding should not be set', {
type: 'stream.encoding.set'
}))
}
if (typeof stream.readable !== 'undefined' && !stream.readable) {
return done(createError(500, 'stream is not readable', {
type: 'stream.not.readable'
}))
}
var received = 0
var decoder
try {
decoder = getDecoder(encoding)
} catch (err) {
return done(err)
}
var buffer = decoder
? ''
: []
// attach listeners
stream.on('aborted', onAborted)
stream.on('close', cleanup)
stream.on('data', onData)
stream.on('end', onEnd)
stream.on('error', onEnd)
// mark sync section complete
sync = false
function done () {
var args = new Array(arguments.length)
// copy arguments
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i]
}
// mark complete
complete = true
if (sync) {
process.nextTick(invokeCallback)
} else {
invokeCallback()
}
function invokeCallback () {
cleanup()
if (args[0]) {
// halt the stream on error
halt(stream)
}
callback.apply(null, args)
}
}
function onAborted () {
if (complete) return
done(createError(400, 'request aborted', {
code: 'ECONNABORTED',
expected: length,
length: length,
received: received,
type: 'request.aborted'
}))
}
function onData (chunk) {
if (complete) return
received += chunk.length
if (limit !== null && received > limit) {
done(createError(413, 'request entity too large', {
limit: limit,
received: received,
type: 'entity.too.large'
}))
} else if (decoder) {
buffer += decoder.write(chunk)
} else {
buffer.push(chunk)
}
}
function onEnd (err) {
if (complete) return
if (err) return done(err)
if (length !== null && received !== length) {
done(createError(400, 'request size did not match content length', {
expected: length,
length: length,
received: received,
type: 'request.size.invalid'
}))
} else {
var string = decoder
? buffer + (decoder.end() || '')
: Buffer.concat(buffer)
done(null, string)
}
}
function cleanup () {
buffer = null
stream.removeListener('aborted', onAborted)
stream.removeListener('data', onData)
stream.removeListener('end', onEnd)
stream.removeListener('error', onEnd)
stream.removeListener('close', cleanup)
}
}
/**
* Try to require async_hooks
* @private
*/
function tryRequireAsyncHooks () {
try {
return require('async_hooks')
} catch (e) {
return {}
}
}
/**
* Wrap function with async resource, if possible.
* AsyncResource.bind static method backported.
* @private
*/
function wrap (fn) {
var res
// create anonymous resource
if (asyncHooks.AsyncResource) {
res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
}
// incompatible node.js
if (!res || !res.runInAsyncScope) {
return fn
}
// return bound function
return res.runInAsyncScope.bind(res, fn, null)
}
``` | /content/code_sandbox/node_modules/raw-body/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,703 |
```javascript
"use strict";
// Some environments don't have global Buffer (e.g. React Native).
// Solution would be installing npm modules "buffer" and "stream" explicitly.
var Buffer = require("safer-buffer").Buffer;
var bomHandling = require("./bom-handling"),
iconv = module.exports;
// All codecs and aliases are kept here, keyed by encoding name/alias.
// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`.
iconv.encodings = null;
// Characters emitted in case of error.
iconv.defaultCharUnicode = '';
iconv.defaultCharSingleByte = '?';
// Public API.
iconv.encode = function encode(str, encoding, options) {
str = "" + (str || ""); // Ensure string.
var encoder = iconv.getEncoder(encoding, options);
var res = encoder.write(str);
var trail = encoder.end();
return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res;
}
iconv.decode = function decode(buf, encoding, options) {
if (typeof buf === 'string') {
if (!iconv.skipDecodeWarning) {
console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to path_to_url
iconv.skipDecodeWarning = true;
}
buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer.
}
var decoder = iconv.getDecoder(encoding, options);
var res = decoder.write(buf);
var trail = decoder.end();
return trail ? (res + trail) : res;
}
iconv.encodingExists = function encodingExists(enc) {
try {
iconv.getCodec(enc);
return true;
} catch (e) {
return false;
}
}
// Legacy aliases to convert functions
iconv.toEncoding = iconv.encode;
iconv.fromEncoding = iconv.decode;
// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache.
iconv._codecDataCache = {};
iconv.getCodec = function getCodec(encoding) {
if (!iconv.encodings)
iconv.encodings = require("../encodings"); // Lazy load all encoding definitions.
// Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
var enc = iconv._canonicalizeEncoding(encoding);
// Traverse iconv.encodings to find actual codec.
var codecOptions = {};
while (true) {
var codec = iconv._codecDataCache[enc];
if (codec)
return codec;
var codecDef = iconv.encodings[enc];
switch (typeof codecDef) {
case "string": // Direct alias to other encoding.
enc = codecDef;
break;
case "object": // Alias with options. Can be layered.
for (var key in codecDef)
codecOptions[key] = codecDef[key];
if (!codecOptions.encodingName)
codecOptions.encodingName = enc;
enc = codecDef.type;
break;
case "function": // Codec itself.
if (!codecOptions.encodingName)
codecOptions.encodingName = enc;
// The codec function must load all tables and return object with .encoder and .decoder methods.
// It'll be called only once (for each different options object).
codec = new codecDef(codecOptions, iconv);
iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later.
return codec;
default:
throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
}
}
}
iconv._canonicalizeEncoding = function(encoding) {
// Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
}
iconv.getEncoder = function getEncoder(encoding, options) {
var codec = iconv.getCodec(encoding),
encoder = new codec.encoder(options, codec);
if (codec.bomAware && options && options.addBOM)
encoder = new bomHandling.PrependBOM(encoder, options);
return encoder;
}
iconv.getDecoder = function getDecoder(encoding, options) {
var codec = iconv.getCodec(encoding),
decoder = new codec.decoder(options, codec);
if (codec.bomAware && !(options && options.stripBOM === false))
decoder = new bomHandling.StripBOM(decoder, options);
return decoder;
}
// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json.
var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node;
if (nodeVer) {
// Load streaming support in Node v0.10+
var nodeVerArr = nodeVer.split(".").map(Number);
if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
require("./streams")(iconv);
}
// Load Node primitive extensions.
require("./extend-node")(iconv);
}
if ("" != "\u0100") {
console.error("iconv-lite warning: javascript files use encoding different from utf-8. See path_to_url for more info.");
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/lib/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,134 |
```javascript
"use strict";
var Buffer = require("buffer").Buffer,
Transform = require("stream").Transform;
// == Exports ==================================================================
module.exports = function(iconv) {
// Additional Public API.
iconv.encodeStream = function encodeStream(encoding, options) {
return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options);
}
iconv.decodeStream = function decodeStream(encoding, options) {
return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options);
}
iconv.supportsStreams = true;
// Not published yet.
iconv.IconvLiteEncoderStream = IconvLiteEncoderStream;
iconv.IconvLiteDecoderStream = IconvLiteDecoderStream;
iconv._collect = IconvLiteDecoderStream.prototype.collect;
};
// == Encoder stream =======================================================
function IconvLiteEncoderStream(conv, options) {
this.conv = conv;
options = options || {};
options.decodeStrings = false; // We accept only strings, so we don't need to decode them.
Transform.call(this, options);
}
IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
constructor: { value: IconvLiteEncoderStream }
});
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
if (typeof chunk != 'string')
return done(new Error("Iconv encoding stream needs strings as its input."));
try {
var res = this.conv.write(chunk);
if (res && res.length) this.push(res);
done();
}
catch (e) {
done(e);
}
}
IconvLiteEncoderStream.prototype._flush = function(done) {
try {
var res = this.conv.end();
if (res && res.length) this.push(res);
done();
}
catch (e) {
done(e);
}
}
IconvLiteEncoderStream.prototype.collect = function(cb) {
var chunks = [];
this.on('error', cb);
this.on('data', function(chunk) { chunks.push(chunk); });
this.on('end', function() {
cb(null, Buffer.concat(chunks));
});
return this;
}
// == Decoder stream =======================================================
function IconvLiteDecoderStream(conv, options) {
this.conv = conv;
options = options || {};
options.encoding = this.encoding = 'utf8'; // We output strings.
Transform.call(this, options);
}
IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
constructor: { value: IconvLiteDecoderStream }
});
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
if (!Buffer.isBuffer(chunk))
return done(new Error("Iconv decoding stream needs buffers as its input."));
try {
var res = this.conv.write(chunk);
if (res && res.length) this.push(res, this.encoding);
done();
}
catch (e) {
done(e);
}
}
IconvLiteDecoderStream.prototype._flush = function(done) {
try {
var res = this.conv.end();
if (res && res.length) this.push(res, this.encoding);
done();
}
catch (e) {
done(e);
}
}
IconvLiteDecoderStream.prototype.collect = function(cb) {
var res = '';
this.on('error', cb);
this.on('data', function(chunk) { res += chunk; });
this.on('end', function() {
cb(null, res);
});
return this;
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/lib/streams.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 744 |
```javascript
"use strict";
var Buffer = require("safer-buffer").Buffer;
// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that
// correspond to encoded bytes (if 128 - then lower half is ASCII).
exports._sbcs = SBCSCodec;
function SBCSCodec(codecOptions, iconv) {
if (!codecOptions)
throw new Error("SBCS codec is called without the data.")
// Prepare char buffer for decoding.
if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256))
throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)");
if (codecOptions.chars.length === 128) {
var asciiString = "";
for (var i = 0; i < 128; i++)
asciiString += String.fromCharCode(i);
codecOptions.chars = asciiString + codecOptions.chars;
}
this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2');
// Encoding buffer.
var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0));
for (var i = 0; i < codecOptions.chars.length; i++)
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
this.encodeBuf = encodeBuf;
}
SBCSCodec.prototype.encoder = SBCSEncoder;
SBCSCodec.prototype.decoder = SBCSDecoder;
function SBCSEncoder(options, codec) {
this.encodeBuf = codec.encodeBuf;
}
SBCSEncoder.prototype.write = function(str) {
var buf = Buffer.alloc(str.length);
for (var i = 0; i < str.length; i++)
buf[i] = this.encodeBuf[str.charCodeAt(i)];
return buf;
}
SBCSEncoder.prototype.end = function() {
}
function SBCSDecoder(options, codec) {
this.decodeBuf = codec.decodeBuf;
}
SBCSDecoder.prototype.write = function(buf) {
// Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
var decodeBuf = this.decodeBuf;
var newBuf = Buffer.alloc(buf.length*2);
var idx1 = 0, idx2 = 0;
for (var i = 0; i < buf.length; i++) {
idx1 = buf[i]*2; idx2 = i*2;
newBuf[idx2] = decodeBuf[idx1];
newBuf[idx2+1] = decodeBuf[idx1+1];
}
return newBuf.toString('ucs2');
}
SBCSDecoder.prototype.end = function() {
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-codec.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 574 |
```javascript
"use strict";
// Update this array if you add/rename/remove files in this directory.
// We support Browserify by skipping automatic module discovery and requiring modules directly.
var modules = [
require("./internal"),
require("./utf16"),
require("./utf7"),
require("./sbcs-codec"),
require("./sbcs-data"),
require("./sbcs-data-generated"),
require("./dbcs-codec"),
require("./dbcs-data"),
];
// Put all encoding/alias/codec definitions to single object and export it.
for (var i = 0; i < modules.length; i++) {
var module = modules[i];
for (var enc in module)
if (Object.prototype.hasOwnProperty.call(module, enc))
exports[enc] = module[enc];
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 164 |
```javascript
"use strict";
var Buffer = require("buffer").Buffer;
// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer
// == Extend Node primitives to use iconv-lite =================================
module.exports = function (iconv) {
var original = undefined; // Place to keep original methods.
// Node authors rewrote Buffer internals to make it compatible with
// Uint8Array and we cannot patch key functions since then.
// Note: this does use older Buffer API on a purpose
iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array);
iconv.extendNodeEncodings = function extendNodeEncodings() {
if (original) return;
original = {};
if (!iconv.supportsNodeEncodingsExtension) {
console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node");
console.error("See more info at path_to_url");
return;
}
var nodeNativeEncodings = {
'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true,
'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true,
};
Buffer.isNativeEncoding = function(enc) {
return enc && nodeNativeEncodings[enc.toLowerCase()];
}
// -- SlowBuffer -----------------------------------------------------------
var SlowBuffer = require('buffer').SlowBuffer;
original.SlowBufferToString = SlowBuffer.prototype.toString;
SlowBuffer.prototype.toString = function(encoding, start, end) {
encoding = String(encoding || 'utf8').toLowerCase();
// Use native conversion when possible
if (Buffer.isNativeEncoding(encoding))
return original.SlowBufferToString.call(this, encoding, start, end);
// Otherwise, use our decoding method.
if (typeof start == 'undefined') start = 0;
if (typeof end == 'undefined') end = this.length;
return iconv.decode(this.slice(start, end), encoding);
}
original.SlowBufferWrite = SlowBuffer.prototype.write;
SlowBuffer.prototype.write = function(string, offset, length, encoding) {
// Support both (string, offset, length, encoding)
// and the legacy (string, encoding, offset, length)
if (isFinite(offset)) {
if (!isFinite(length)) {
encoding = length;
length = undefined;
}
} else { // legacy
var swap = encoding;
encoding = offset;
offset = length;
length = swap;
}
offset = +offset || 0;
var remaining = this.length - offset;
if (!length) {
length = remaining;
} else {
length = +length;
if (length > remaining) {
length = remaining;
}
}
encoding = String(encoding || 'utf8').toLowerCase();
// Use native conversion when possible
if (Buffer.isNativeEncoding(encoding))
return original.SlowBufferWrite.call(this, string, offset, length, encoding);
if (string.length > 0 && (length < 0 || offset < 0))
throw new RangeError('attempt to write beyond buffer bounds');
// Otherwise, use our encoding method.
var buf = iconv.encode(string, encoding);
if (buf.length < length) length = buf.length;
buf.copy(this, offset, 0, length);
return length;
}
// -- Buffer ---------------------------------------------------------------
original.BufferIsEncoding = Buffer.isEncoding;
Buffer.isEncoding = function(encoding) {
return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding);
}
original.BufferByteLength = Buffer.byteLength;
Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) {
encoding = String(encoding || 'utf8').toLowerCase();
// Use native conversion when possible
if (Buffer.isNativeEncoding(encoding))
return original.BufferByteLength.call(this, str, encoding);
// Slow, I know, but we don't have a better way yet.
return iconv.encode(str, encoding).length;
}
original.BufferToString = Buffer.prototype.toString;
Buffer.prototype.toString = function(encoding, start, end) {
encoding = String(encoding || 'utf8').toLowerCase();
// Use native conversion when possible
if (Buffer.isNativeEncoding(encoding))
return original.BufferToString.call(this, encoding, start, end);
// Otherwise, use our decoding method.
if (typeof start == 'undefined') start = 0;
if (typeof end == 'undefined') end = this.length;
return iconv.decode(this.slice(start, end), encoding);
}
original.BufferWrite = Buffer.prototype.write;
Buffer.prototype.write = function(string, offset, length, encoding) {
var _offset = offset, _length = length, _encoding = encoding;
// Support both (string, offset, length, encoding)
// and the legacy (string, encoding, offset, length)
if (isFinite(offset)) {
if (!isFinite(length)) {
encoding = length;
length = undefined;
}
} else { // legacy
var swap = encoding;
encoding = offset;
offset = length;
length = swap;
}
encoding = String(encoding || 'utf8').toLowerCase();
// Use native conversion when possible
if (Buffer.isNativeEncoding(encoding))
return original.BufferWrite.call(this, string, _offset, _length, _encoding);
offset = +offset || 0;
var remaining = this.length - offset;
if (!length) {
length = remaining;
} else {
length = +length;
if (length > remaining) {
length = remaining;
}
}
if (string.length > 0 && (length < 0 || offset < 0))
throw new RangeError('attempt to write beyond buffer bounds');
// Otherwise, use our encoding method.
var buf = iconv.encode(string, encoding);
if (buf.length < length) length = buf.length;
buf.copy(this, offset, 0, length);
return length;
// TODO: Set _charsWritten.
}
// -- Readable -------------------------------------------------------------
if (iconv.supportsStreams) {
var Readable = require('stream').Readable;
original.ReadableSetEncoding = Readable.prototype.setEncoding;
Readable.prototype.setEncoding = function setEncoding(enc, options) {
// Use our own decoder, it has the same interface.
// We cannot use original function as it doesn't handle BOM-s.
this._readableState.decoder = iconv.getDecoder(enc, options);
this._readableState.encoding = enc;
}
Readable.prototype.collect = iconv._collect;
}
}
// Remove iconv-lite Node primitive extensions.
iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() {
if (!iconv.supportsNodeEncodingsExtension)
return;
if (!original)
throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.")
delete Buffer.isNativeEncoding;
var SlowBuffer = require('buffer').SlowBuffer;
SlowBuffer.prototype.toString = original.SlowBufferToString;
SlowBuffer.prototype.write = original.SlowBufferWrite;
Buffer.isEncoding = original.BufferIsEncoding;
Buffer.byteLength = original.BufferByteLength;
Buffer.prototype.toString = original.BufferToString;
Buffer.prototype.write = original.BufferWrite;
if (iconv.supportsStreams) {
var Readable = require('stream').Readable;
Readable.prototype.setEncoding = original.ReadableSetEncoding;
delete Readable.prototype.collect;
}
original = undefined;
}
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/lib/extend-node.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,675 |
```javascript
"use strict";
// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script.
module.exports = {
"437": "cp437",
"737": "cp737",
"775": "cp775",
"850": "cp850",
"852": "cp852",
"855": "cp855",
"856": "cp856",
"857": "cp857",
"858": "cp858",
"860": "cp860",
"861": "cp861",
"862": "cp862",
"863": "cp863",
"864": "cp864",
"865": "cp865",
"866": "cp866",
"869": "cp869",
"874": "windows874",
"922": "cp922",
"1046": "cp1046",
"1124": "cp1124",
"1125": "cp1125",
"1129": "cp1129",
"1133": "cp1133",
"1161": "cp1161",
"1162": "cp1162",
"1163": "cp1163",
"1250": "windows1250",
"1251": "windows1251",
"1252": "windows1252",
"1253": "windows1253",
"1254": "windows1254",
"1255": "windows1255",
"1256": "windows1256",
"1257": "windows1257",
"1258": "windows1258",
"28591": "iso88591",
"28592": "iso88592",
"28593": "iso88593",
"28594": "iso88594",
"28595": "iso88595",
"28596": "iso88596",
"28597": "iso88597",
"28598": "iso88598",
"28599": "iso88599",
"28600": "iso885910",
"28601": "iso885911",
"28603": "iso885913",
"28604": "iso885914",
"28605": "iso885915",
"28606": "iso885916",
"windows874": {
"type": "_sbcs",
"chars": ""
},
"win874": "windows874",
"cp874": "windows874",
"windows1250": {
"type": "_sbcs",
"chars": ""
},
"win1250": "windows1250",
"cp1250": "windows1250",
"windows1251": {
"type": "_sbcs",
"chars": ""
},
"win1251": "windows1251",
"cp1251": "windows1251",
"windows1252": {
"type": "_sbcs",
"chars": ""
},
"win1252": "windows1252",
"cp1252": "windows1252",
"windows1253": {
"type": "_sbcs",
"chars": ""
},
"win1253": "windows1253",
"cp1253": "windows1253",
"windows1254": {
"type": "_sbcs",
"chars": ""
},
"win1254": "windows1254",
"cp1254": "windows1254",
"windows1255": {
"type": "_sbcs",
"chars": ""
},
"win1255": "windows1255",
"cp1255": "windows1255",
"windows1256": {
"type": "_sbcs",
"chars": ""
},
"win1256": "windows1256",
"cp1256": "windows1256",
"windows1257": {
"type": "_sbcs",
"chars": ""
},
"win1257": "windows1257",
"cp1257": "windows1257",
"windows1258": {
"type": "_sbcs",
"chars": ""
},
"win1258": "windows1258",
"cp1258": "windows1258",
"iso88591": {
"type": "_sbcs",
"chars": ""
},
"cp28591": "iso88591",
"iso88592": {
"type": "_sbcs",
"chars": ""
},
"cp28592": "iso88592",
"iso88593": {
"type": "_sbcs",
"chars": ""
},
"cp28593": "iso88593",
"iso88594": {
"type": "_sbcs",
"chars": ""
},
"cp28594": "iso88594",
"iso88595": {
"type": "_sbcs",
"chars": ""
},
"cp28595": "iso88595",
"iso88596": {
"type": "_sbcs",
"chars": ""
},
"cp28596": "iso88596",
"iso88597": {
"type": "_sbcs",
"chars": ""
},
"cp28597": "iso88597",
"iso88598": {
"type": "_sbcs",
"chars": ""
},
"cp28598": "iso88598",
"iso88599": {
"type": "_sbcs",
"chars": ""
},
"cp28599": "iso88599",
"iso885910": {
"type": "_sbcs",
"chars": ""
},
"cp28600": "iso885910",
"iso885911": {
"type": "_sbcs",
"chars": ""
},
"cp28601": "iso885911",
"iso885913": {
"type": "_sbcs",
"chars": ""
},
"cp28603": "iso885913",
"iso885914": {
"type": "_sbcs",
"chars": ""
},
"cp28604": "iso885914",
"iso885915": {
"type": "_sbcs",
"chars": ""
},
"cp28605": "iso885915",
"iso885916": {
"type": "_sbcs",
"chars": ""
},
"cp28606": "iso885916",
"cp437": {
"type": "_sbcs",
"chars": ""
},
"ibm437": "cp437",
"csibm437": "cp437",
"cp737": {
"type": "_sbcs",
"chars": ""
},
"ibm737": "cp737",
"csibm737": "cp737",
"cp775": {
"type": "_sbcs",
"chars": ""
},
"ibm775": "cp775",
"csibm775": "cp775",
"cp850": {
"type": "_sbcs",
"chars": ""
},
"ibm850": "cp850",
"csibm850": "cp850",
"cp852": {
"type": "_sbcs",
"chars": ""
},
"ibm852": "cp852",
"csibm852": "cp852",
"cp855": {
"type": "_sbcs",
"chars": ""
},
"ibm855": "cp855",
"csibm855": "cp855",
"cp856": {
"type": "_sbcs",
"chars": ""
},
"ibm856": "cp856",
"csibm856": "cp856",
"cp857": {
"type": "_sbcs",
"chars": ""
},
"ibm857": "cp857",
"csibm857": "cp857",
"cp858": {
"type": "_sbcs",
"chars": ""
},
"ibm858": "cp858",
"csibm858": "cp858",
"cp860": {
"type": "_sbcs",
"chars": ""
},
"ibm860": "cp860",
"csibm860": "cp860",
"cp861": {
"type": "_sbcs",
"chars": ""
},
"ibm861": "cp861",
"csibm861": "cp861",
"cp862": {
"type": "_sbcs",
"chars": ""
},
"ibm862": "cp862",
"csibm862": "cp862",
"cp863": {
"type": "_sbcs",
"chars": ""
},
"ibm863": "cp863",
"csibm863": "cp863",
"cp864": {
"type": "_sbcs",
"chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
},
"ibm864": "cp864",
"csibm864": "cp864",
"cp865": {
"type": "_sbcs",
"chars": ""
},
"ibm865": "cp865",
"csibm865": "cp865",
"cp866": {
"type": "_sbcs",
"chars": ""
},
"ibm866": "cp866",
"csibm866": "cp866",
"cp869": {
"type": "_sbcs",
"chars": ""
},
"ibm869": "cp869",
"csibm869": "cp869",
"cp922": {
"type": "_sbcs",
"chars": ""
},
"ibm922": "cp922",
"csibm922": "cp922",
"cp1046": {
"type": "_sbcs",
"chars": ""
},
"ibm1046": "cp1046",
"csibm1046": "cp1046",
"cp1124": {
"type": "_sbcs",
"chars": ""
},
"ibm1124": "cp1124",
"csibm1124": "cp1124",
"cp1125": {
"type": "_sbcs",
"chars": ""
},
"ibm1125": "cp1125",
"csibm1125": "cp1125",
"cp1129": {
"type": "_sbcs",
"chars": ""
},
"ibm1129": "cp1129",
"csibm1129": "cp1129",
"cp1133": {
"type": "_sbcs",
"chars": ""
},
"ibm1133": "cp1133",
"csibm1133": "cp1133",
"cp1161": {
"type": "_sbcs",
"chars": ""
},
"ibm1161": "cp1161",
"csibm1161": "cp1161",
"cp1162": {
"type": "_sbcs",
"chars": ""
},
"ibm1162": "cp1162",
"csibm1162": "cp1162",
"cp1163": {
"type": "_sbcs",
"chars": ""
},
"ibm1163": "cp1163",
"csibm1163": "cp1163",
"maccroatian": {
"type": "_sbcs",
"chars": ""
},
"maccyrillic": {
"type": "_sbcs",
"chars": ""
},
"macgreek": {
"type": "_sbcs",
"chars": ""
},
"maciceland": {
"type": "_sbcs",
"chars": ""
},
"macroman": {
"type": "_sbcs",
"chars": ""
},
"macromania": {
"type": "_sbcs",
"chars": ""
},
"macthai": {
"type": "_sbcs",
"chars": ""
},
"macturkish": {
"type": "_sbcs",
"chars": ""
},
"macukraine": {
"type": "_sbcs",
"chars": ""
},
"koi8r": {
"type": "_sbcs",
"chars": ""
},
"koi8u": {
"type": "_sbcs",
"chars": ""
},
"koi8ru": {
"type": "_sbcs",
"chars": ""
},
"koi8t": {
"type": "_sbcs",
"chars": ""
},
"armscii8": {
"type": "_sbcs",
"chars": ")(.,-"
},
"rk1048": {
"type": "_sbcs",
"chars": ""
},
"tcvn": {
"type": "_sbcs",
"chars": "\u0000\u0003\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
},
"georgianacademy": {
"type": "_sbcs",
"chars": ""
},
"georgianps": {
"type": "_sbcs",
"chars": ""
},
"pt154": {
"type": "_sbcs",
"chars": ""
},
"viscii": {
"type": "_sbcs",
"chars": "\u0000\u0001\u0003\u0004\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0015\u0016\u0017\u0018\u001a\u001b\u001c\u001d\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
},
"iso646cn": {
"type": "_sbcs",
"chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}"
},
"iso646jp": {
"type": "_sbcs",
"chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}"
},
"hproman8": {
"type": "_sbcs",
"chars": ""
},
"macintosh": {
"type": "_sbcs",
"chars": ""
},
"ascii": {
"type": "_sbcs",
"chars": ""
},
"tis620": {
"type": "_sbcs",
"chars": ""
}
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-data-generated.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 3,677 |
```javascript
"use strict";
// Description of supported double byte encodings and aliases.
// Tables are not require()-d until they are needed to speed up library load.
// require()-s are direct to support Browserify.
module.exports = {
// == Japanese/ShiftJIS ====================================================
// All japanese encodings are based on JIS X set of standards:
// JIS X 0201 - Single-byte encoding of ASCII + + Kana chars at 0xA1-0xDF.
// JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
// Has several variations in 1978, 1983, 1990 and 1997.
// JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
// JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
// 2 planes, first is superset of 0208, second - revised 0212.
// Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx)
// Byte encodings are:
// * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte
// encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC.
// Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI.
// * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes.
// 0x00-0x7F - lower part of 0201
// 0x8E, 0xA1-0xDF - upper part of 0201
// (0xA1-0xFE)x2 - 0208 plane (94x94).
// 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
// * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
// Used as-is in ISO2022 family.
// * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
// 0201-1976 Roman, 0208-1978, 0208-1983.
// * ISO2022-JP-1: Adds esc seq for 0212-1990.
// * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
// * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2.
// * ISO2022-JP-2004: Adds 0213-2004 Plane 1.
//
// After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
//
// Overall, it seems that it's a mess :( path_to_url
'shiftjis': {
type: '_dbcs',
table: function() { return require('./tables/shiftjis.json') },
encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E},
encodeSkipVals: [{from: 0xED40, to: 0xF940}],
},
'csshiftjis': 'shiftjis',
'mskanji': 'shiftjis',
'sjis': 'shiftjis',
'windows31j': 'shiftjis',
'ms31j': 'shiftjis',
'xsjis': 'shiftjis',
'windows932': 'shiftjis',
'ms932': 'shiftjis',
'932': 'shiftjis',
'cp932': 'shiftjis',
'eucjp': {
type: '_dbcs',
table: function() { return require('./tables/eucjp.json') },
encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E},
},
// TODO: KDDI extension to Shift_JIS
// TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes.
// TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars.
// == Chinese/GBK ==========================================================
// path_to_url
// We mostly implement W3C recommendation: path_to_url#gbk-encoder
// Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
'gb2312': 'cp936',
'gb231280': 'cp936',
'gb23121980': 'cp936',
'csgb2312': 'cp936',
'csiso58gb231280': 'cp936',
'euccn': 'cp936',
// Microsoft's CP936 is a subset and approximation of GBK.
'windows936': 'cp936',
'ms936': 'cp936',
'936': 'cp936',
'cp936': {
type: '_dbcs',
table: function() { return require('./tables/cp936.json') },
},
// GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
'gbk': {
type: '_dbcs',
table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) },
},
'xgbk': 'gbk',
'isoir58': 'gbk',
// GB18030 is an algorithmic extension of GBK.
// Main source: path_to_url#gbk-encoder
// path_to_url
// path_to_url
// path_to_url
'gb18030': {
type: '_dbcs',
table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) },
gb18030: function() { return require('./tables/gb18030-ranges.json') },
encodeSkipVals: [0x80],
encodeAdd: {'': 0xA2E3},
},
'chinese': 'gb18030',
// == Korean ===============================================================
// EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
'windows949': 'cp949',
'ms949': 'cp949',
'949': 'cp949',
'cp949': {
type: '_dbcs',
table: function() { return require('./tables/cp949.json') },
},
'cseuckr': 'cp949',
'csksc56011987': 'cp949',
'euckr': 'cp949',
'isoir149': 'cp949',
'korean': 'cp949',
'ksc56011987': 'cp949',
'ksc56011989': 'cp949',
'ksc5601': 'cp949',
// == Big5/Taiwan/Hong Kong ================================================
// There are lots of tables for Big5 and cp950. Please see the following links for history:
// path_to_url path_to_url
// Variations, in roughly number of defined chars:
// * Windows CP 950: Microsoft variant of Big5. Canonical: path_to_url
// * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. path_to_url
// * Big5-2003 (Taiwan standard) almost superset of cp950.
// * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
// * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
// many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
// Plus, it has 4 combining sequences.
// Seems that Mozilla refused to support it for 10 yrs. path_to_url path_to_url
// because big5-hkscs is the only encoding to include astral characters in non-algorithmic way.
// Implementations are not consistent within browsers; sometimes labeled as just big5.
// MS Internet Explorer switches from big5 to big5-hkscs when a patch applied.
// Great discussion & recap of what's going on path_to_url#c31
// In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
// Official spec: path_to_url
// path_to_url
//
// Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, path_to_url#big5-encoder
// Unicode mapping (path_to_url is said to be wrong.
'windows950': 'cp950',
'ms950': 'cp950',
'950': 'cp950',
'cp950': {
type: '_dbcs',
table: function() { return require('./tables/cp950.json') },
},
// Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
'big5': 'big5hkscs',
'big5hkscs': {
type: '_dbcs',
table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) },
encodeSkipVals: [0xa2cc],
},
'cnbig5': 'big5hkscs',
'csbig5': 'big5hkscs',
'xxbig5': 'big5hkscs',
};
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/dbcs-data.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,311 |
```javascript
"use strict";
var Buffer = require("safer-buffer").Buffer;
// Multibyte codec. In this scheme, a character is represented by 1 or more bytes.
// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences.
// To save memory and loading time, we read table files only when requested.
exports._dbcs = DBCSCodec;
var UNASSIGNED = -1,
GB18030_CODE = -2,
SEQ_START = -10,
NODE_START = -1000,
UNASSIGNED_NODE = new Array(0x100),
DEF_CHAR = -1;
for (var i = 0; i < 0x100; i++)
UNASSIGNED_NODE[i] = UNASSIGNED;
// Class DBCSCodec reads and initializes mapping tables.
function DBCSCodec(codecOptions, iconv) {
this.encodingName = codecOptions.encodingName;
if (!codecOptions)
throw new Error("DBCS codec is called without the data.")
if (!codecOptions.table)
throw new Error("Encoding '" + this.encodingName + "' has no data.");
// Load tables.
var mappingTable = codecOptions.table();
// Decode tables: MBCS -> Unicode.
// decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256.
// Trie root is decodeTables[0].
// Values: >= 0 -> unicode character code. can be > 0xFFFF
// == UNASSIGNED -> unknown/unassigned sequence.
// == GB18030_CODE -> this is the end of a GB18030 4-byte sequence.
// <= NODE_START -> index of the next node in our trie to process next byte.
// <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq.
this.decodeTables = [];
this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node.
// Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here.
this.decodeTableSeq = [];
// Actual mapping tables consist of chunks. Use them to fill up decode tables.
for (var i = 0; i < mappingTable.length; i++)
this._addDecodeChunk(mappingTable[i]);
this.defaultCharUnicode = iconv.defaultCharUnicode;
// Encode tables: Unicode -> DBCS.
// `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance.
// Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null.
// Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.).
// == UNASSIGNED -> no conversion found. Output a default char.
// <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence.
this.encodeTable = [];
// `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of
// objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key
// means end of sequence (needed when one sequence is a strict subsequence of another).
// Objects are kept separately from encodeTable to increase performance.
this.encodeTableSeq = [];
// Some chars can be decoded, but need not be encoded.
var skipEncodeChars = {};
if (codecOptions.encodeSkipVals)
for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) {
var val = codecOptions.encodeSkipVals[i];
if (typeof val === 'number')
skipEncodeChars[val] = true;
else
for (var j = val.from; j <= val.to; j++)
skipEncodeChars[j] = true;
}
// Use decode trie to recursively fill out encode tables.
this._fillEncodeTable(0, 0, skipEncodeChars);
// Add more encoding pairs when needed.
if (codecOptions.encodeAdd) {
for (var uChar in codecOptions.encodeAdd)
if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
}
this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?'];
if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0);
// Load & create GB18030 tables when needed.
if (typeof codecOptions.gb18030 === 'function') {
this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges.
// Add GB18030 decode tables.
var thirdByteNodeIdx = this.decodeTables.length;
var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0);
var fourthByteNodeIdx = this.decodeTables.length;
var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0);
for (var i = 0x81; i <= 0xFE; i++) {
var secondByteNodeIdx = NODE_START - this.decodeTables[0][i];
var secondByteNode = this.decodeTables[secondByteNodeIdx];
for (var j = 0x30; j <= 0x39; j++)
secondByteNode[j] = NODE_START - thirdByteNodeIdx;
}
for (var i = 0x81; i <= 0xFE; i++)
thirdByteNode[i] = NODE_START - fourthByteNodeIdx;
for (var i = 0x30; i <= 0x39; i++)
fourthByteNode[i] = GB18030_CODE
}
}
DBCSCodec.prototype.encoder = DBCSEncoder;
DBCSCodec.prototype.decoder = DBCSDecoder;
// Decoder helpers
DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
var bytes = [];
for (; addr > 0; addr >>= 8)
bytes.push(addr & 0xFF);
if (bytes.length == 0)
bytes.push(0);
var node = this.decodeTables[0];
for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie.
var val = node[bytes[i]];
if (val == UNASSIGNED) { // Create new node.
node[bytes[i]] = NODE_START - this.decodeTables.length;
this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
}
else if (val <= NODE_START) { // Existing node.
node = this.decodeTables[NODE_START - val];
}
else
throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
}
return node;
}
DBCSCodec.prototype._addDecodeChunk = function(chunk) {
// First element of chunk is the hex mbcs code where we start.
var curAddr = parseInt(chunk[0], 16);
// Choose the decoding node where we'll write our chars.
var writeTable = this._getDecodeTrieNode(curAddr);
curAddr = curAddr & 0xFF;
// Write all other elements of the chunk to the table.
for (var k = 1; k < chunk.length; k++) {
var part = chunk[k];
if (typeof part === "string") { // String, write as-is.
for (var l = 0; l < part.length;) {
var code = part.charCodeAt(l++);
if (0xD800 <= code && code < 0xDC00) { // Decode surrogate
var codeTrail = part.charCodeAt(l++);
if (0xDC00 <= codeTrail && codeTrail < 0xE000)
writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00);
else
throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
}
else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used)
var len = 0xFFF - code + 2;
var seq = [];
for (var m = 0; m < len; m++)
seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq.
writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
this.decodeTableSeq.push(seq);
}
else
writeTable[curAddr++] = code; // Basic char
}
}
else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character.
var charCode = writeTable[curAddr - 1] + 1;
for (var l = 0; l < part; l++)
writeTable[curAddr++] = charCode++;
}
else
throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
}
if (curAddr > 0xFF)
throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
}
// Encoder helpers
DBCSCodec.prototype._getEncodeBucket = function(uCode) {
var high = uCode >> 8; // This could be > 0xFF because of astral characters.
if (this.encodeTable[high] === undefined)
this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand.
return this.encodeTable[high];
}
DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
var bucket = this._getEncodeBucket(uCode);
var low = uCode & 0xFF;
if (bucket[low] <= SEQ_START)
this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it.
else if (bucket[low] == UNASSIGNED)
bucket[low] = dbcsCode;
}
DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
// Get the root of character tree according to first character of the sequence.
var uCode = seq[0];
var bucket = this._getEncodeBucket(uCode);
var low = uCode & 0xFF;
var node;
if (bucket[low] <= SEQ_START) {
// There's already a sequence with - use it.
node = this.encodeTableSeq[SEQ_START-bucket[low]];
}
else {
// There was no sequence object - allocate a new one.
node = {};
if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence.
bucket[low] = SEQ_START - this.encodeTableSeq.length;
this.encodeTableSeq.push(node);
}
// Traverse the character tree, allocating new nodes as needed.
for (var j = 1; j < seq.length-1; j++) {
var oldVal = node[uCode];
if (typeof oldVal === 'object')
node = oldVal;
else {
node = node[uCode] = {}
if (oldVal !== undefined)
node[DEF_CHAR] = oldVal
}
}
// Set the leaf to given dbcsCode.
uCode = seq[seq.length-1];
node[uCode] = dbcsCode;
}
DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) {
var node = this.decodeTables[nodeIdx];
for (var i = 0; i < 0x100; i++) {
var uCode = node[i];
var mbCode = prefix + i;
if (skipEncodeChars[mbCode])
continue;
if (uCode >= 0)
this._setEncodeChar(uCode, mbCode);
else if (uCode <= NODE_START)
this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars);
else if (uCode <= SEQ_START)
this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
}
}
// == Encoder ==================================================================
function DBCSEncoder(options, codec) {
// Encoder state
this.leadSurrogate = -1;
this.seqObj = undefined;
// Static data
this.encodeTable = codec.encodeTable;
this.encodeTableSeq = codec.encodeTableSeq;
this.defaultCharSingleByte = codec.defCharSB;
this.gb18030 = codec.gb18030;
}
DBCSEncoder.prototype.write = function(str) {
var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)),
leadSurrogate = this.leadSurrogate,
seqObj = this.seqObj, nextChar = -1,
i = 0, j = 0;
while (true) {
// 0. Get next character.
if (nextChar === -1) {
if (i == str.length) break;
var uCode = str.charCodeAt(i++);
}
else {
var uCode = nextChar;
nextChar = -1;
}
// 1. Handle surrogates.
if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates.
if (uCode < 0xDC00) { // We've got lead surrogate.
if (leadSurrogate === -1) {
leadSurrogate = uCode;
continue;
} else {
leadSurrogate = uCode;
// Double lead surrogate found.
uCode = UNASSIGNED;
}
} else { // We've got trail surrogate.
if (leadSurrogate !== -1) {
uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00);
leadSurrogate = -1;
} else {
// Incomplete surrogate pair - only trail surrogate found.
uCode = UNASSIGNED;
}
}
}
else if (leadSurrogate !== -1) {
// Incomplete surrogate pair - only lead surrogate found.
nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char.
leadSurrogate = -1;
}
// 2. Convert uCode character.
var dbcsCode = UNASSIGNED;
if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence
var resCode = seqObj[uCode];
if (typeof resCode === 'object') { // Sequence continues.
seqObj = resCode;
continue;
} else if (typeof resCode == 'number') { // Sequence finished. Write it.
dbcsCode = resCode;
} else if (resCode == undefined) { // Current character is not part of the sequence.
// Try default character for this sequence
resCode = seqObj[DEF_CHAR];
if (resCode !== undefined) {
dbcsCode = resCode; // Found. Write it.
nextChar = uCode; // Current character will be written too in the next iteration.
} else {
// TODO: What if we have no default? (resCode == undefined)
// Then, we should write first char of the sequence as-is and try the rest recursively.
// Didn't do it for now because no encoding has this situation yet.
// Currently, just skip the sequence and write current char.
}
}
seqObj = undefined;
}
else if (uCode >= 0) { // Regular character
var subtable = this.encodeTable[uCode >> 8];
if (subtable !== undefined)
dbcsCode = subtable[uCode & 0xFF];
if (dbcsCode <= SEQ_START) { // Sequence start
seqObj = this.encodeTableSeq[SEQ_START-dbcsCode];
continue;
}
if (dbcsCode == UNASSIGNED && this.gb18030) {
// Use GB18030 algorithm to find character(s) to write.
var idx = findIdx(this.gb18030.uChars, uCode);
if (idx != -1) {
var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);
newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600;
newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260;
newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10;
newBuf[j++] = 0x30 + dbcsCode;
continue;
}
}
}
// 3. Write dbcsCode character.
if (dbcsCode === UNASSIGNED)
dbcsCode = this.defaultCharSingleByte;
if (dbcsCode < 0x100) {
newBuf[j++] = dbcsCode;
}
else if (dbcsCode < 0x10000) {
newBuf[j++] = dbcsCode >> 8; // high byte
newBuf[j++] = dbcsCode & 0xFF; // low byte
}
else {
newBuf[j++] = dbcsCode >> 16;
newBuf[j++] = (dbcsCode >> 8) & 0xFF;
newBuf[j++] = dbcsCode & 0xFF;
}
}
this.seqObj = seqObj;
this.leadSurrogate = leadSurrogate;
return newBuf.slice(0, j);
}
DBCSEncoder.prototype.end = function() {
if (this.leadSurrogate === -1 && this.seqObj === undefined)
return; // All clean. Most often case.
var newBuf = Buffer.alloc(10), j = 0;
if (this.seqObj) { // We're in the sequence.
var dbcsCode = this.seqObj[DEF_CHAR];
if (dbcsCode !== undefined) { // Write beginning of the sequence.
if (dbcsCode < 0x100) {
newBuf[j++] = dbcsCode;
}
else {
newBuf[j++] = dbcsCode >> 8; // high byte
newBuf[j++] = dbcsCode & 0xFF; // low byte
}
} else {
// See todo above.
}
this.seqObj = undefined;
}
if (this.leadSurrogate !== -1) {
// Incomplete surrogate pair - only lead surrogate found.
newBuf[j++] = this.defaultCharSingleByte;
this.leadSurrogate = -1;
}
return newBuf.slice(0, j);
}
// Export for testing
DBCSEncoder.prototype.findIdx = findIdx;
// == Decoder ==================================================================
function DBCSDecoder(options, codec) {
// Decoder state
this.nodeIdx = 0;
this.prevBuf = Buffer.alloc(0);
// Static data
this.decodeTables = codec.decodeTables;
this.decodeTableSeq = codec.decodeTableSeq;
this.defaultCharUnicode = codec.defaultCharUnicode;
this.gb18030 = codec.gb18030;
}
DBCSDecoder.prototype.write = function(buf) {
var newBuf = Buffer.alloc(buf.length*2),
nodeIdx = this.nodeIdx,
prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length,
seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence.
uCode;
if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later.
prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]);
for (var i = 0, j = 0; i < buf.length; i++) {
var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset];
// Lookup in current trie node.
var uCode = this.decodeTables[nodeIdx][curByte];
if (uCode >= 0) {
// Normal character, just use it.
}
else if (uCode === UNASSIGNED) { // Unknown char.
// TODO: Callback with seq.
//var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle).
uCode = this.defaultCharUnicode.charCodeAt(0);
}
else if (uCode === GB18030_CODE) {
var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30);
var idx = findIdx(this.gb18030.gbChars, ptr);
uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx];
}
else if (uCode <= NODE_START) { // Go to next trie node.
nodeIdx = NODE_START - uCode;
continue;
}
else if (uCode <= SEQ_START) { // Output a sequence of chars.
var seq = this.decodeTableSeq[SEQ_START - uCode];
for (var k = 0; k < seq.length - 1; k++) {
uCode = seq[k];
newBuf[j++] = uCode & 0xFF;
newBuf[j++] = uCode >> 8;
}
uCode = seq[seq.length-1];
}
else
throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
// Write the character to buffer, handling higher planes using surrogate pair.
if (uCode > 0xFFFF) {
uCode -= 0x10000;
var uCodeLead = 0xD800 + Math.floor(uCode / 0x400);
newBuf[j++] = uCodeLead & 0xFF;
newBuf[j++] = uCodeLead >> 8;
uCode = 0xDC00 + uCode % 0x400;
}
newBuf[j++] = uCode & 0xFF;
newBuf[j++] = uCode >> 8;
// Reset trie node.
nodeIdx = 0; seqStart = i+1;
}
this.nodeIdx = nodeIdx;
this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset);
return newBuf.slice(0, j).toString('ucs2');
}
DBCSDecoder.prototype.end = function() {
var ret = '';
// Try to parse all remaining chars.
while (this.prevBuf.length > 0) {
// Skip 1 character in the buffer.
ret += this.defaultCharUnicode;
var buf = this.prevBuf.slice(1);
// Parse remaining as usual.
this.prevBuf = Buffer.alloc(0);
this.nodeIdx = 0;
if (buf.length > 0)
ret += this.write(buf);
}
this.nodeIdx = 0;
return ret;
}
// Binary search for GB18030. Returns largest i such that table[i] <= val.
function findIdx(table, val) {
if (table[0] > val)
return -1;
var l = 0, r = table.length;
while (l < r-1) { // always table[l] <= val < table[r]
var mid = l + Math.floor((r-l+1)/2);
if (table[mid] <= val)
l = mid;
else
r = mid;
}
return l;
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/dbcs-codec.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 5,470 |
```javascript
"use strict";
var Buffer = require("safer-buffer").Buffer;
// Export Node.js internal encodings.
module.exports = {
// Encodings
utf8: { type: "_internal", bomAware: true},
cesu8: { type: "_internal", bomAware: true},
unicode11utf8: "utf8",
ucs2: { type: "_internal", bomAware: true},
utf16le: "ucs2",
binary: { type: "_internal" },
base64: { type: "_internal" },
hex: { type: "_internal" },
// Codec.
_internal: InternalCodec,
};
//your_sha256_hash--------------
function InternalCodec(codecOptions, iconv) {
this.enc = codecOptions.encodingName;
this.bomAware = codecOptions.bomAware;
if (this.enc === "base64")
this.encoder = InternalEncoderBase64;
else if (this.enc === "cesu8") {
this.enc = "utf8"; // Use utf8 for decoding.
this.encoder = InternalEncoderCesu8;
// Add decoder for versions of Node not supporting CESU-8
if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '') {
this.decoder = InternalDecoderCesu8;
this.defaultCharUnicode = iconv.defaultCharUnicode;
}
}
}
InternalCodec.prototype.encoder = InternalEncoder;
InternalCodec.prototype.decoder = InternalDecoder;
//your_sha256_hash--------------
// We use node.js internal decoder. Its signature is the same as ours.
var StringDecoder = require('string_decoder').StringDecoder;
if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.
StringDecoder.prototype.end = function() {};
function InternalDecoder(options, codec) {
StringDecoder.call(this, codec.enc);
}
InternalDecoder.prototype = StringDecoder.prototype;
//your_sha256_hash--------------
// Encoder is mostly trivial
function InternalEncoder(options, codec) {
this.enc = codec.enc;
}
InternalEncoder.prototype.write = function(str) {
return Buffer.from(str, this.enc);
}
InternalEncoder.prototype.end = function() {
}
//your_sha256_hash--------------
// Except base64 encoder, which must keep its state.
function InternalEncoderBase64(options, codec) {
this.prevStr = '';
}
InternalEncoderBase64.prototype.write = function(str) {
str = this.prevStr + str;
var completeQuads = str.length - (str.length % 4);
this.prevStr = str.slice(completeQuads);
str = str.slice(0, completeQuads);
return Buffer.from(str, "base64");
}
InternalEncoderBase64.prototype.end = function() {
return Buffer.from(this.prevStr, "base64");
}
//your_sha256_hash--------------
// CESU-8 encoder is also special.
function InternalEncoderCesu8(options, codec) {
}
InternalEncoderCesu8.prototype.write = function(str) {
var buf = Buffer.alloc(str.length * 3), bufIdx = 0;
for (var i = 0; i < str.length; i++) {
var charCode = str.charCodeAt(i);
// Naive implementation, but it works because CESU-8 is especially easy
// to convert from UTF-16 (which all JS strings are encoded in).
if (charCode < 0x80)
buf[bufIdx++] = charCode;
else if (charCode < 0x800) {
buf[bufIdx++] = 0xC0 + (charCode >>> 6);
buf[bufIdx++] = 0x80 + (charCode & 0x3f);
}
else { // charCode will always be < 0x10000 in javascript.
buf[bufIdx++] = 0xE0 + (charCode >>> 12);
buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f);
buf[bufIdx++] = 0x80 + (charCode & 0x3f);
}
}
return buf.slice(0, bufIdx);
}
InternalEncoderCesu8.prototype.end = function() {
}
//your_sha256_hash--------------
// CESU-8 decoder is not implemented in Node v4.0+
function InternalDecoderCesu8(options, codec) {
this.acc = 0;
this.contBytes = 0;
this.accBytes = 0;
this.defaultCharUnicode = codec.defaultCharUnicode;
}
InternalDecoderCesu8.prototype.write = function(buf) {
var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes,
res = '';
for (var i = 0; i < buf.length; i++) {
var curByte = buf[i];
if ((curByte & 0xC0) !== 0x80) { // Leading byte
if (contBytes > 0) { // Previous code is invalid
res += this.defaultCharUnicode;
contBytes = 0;
}
if (curByte < 0x80) { // Single-byte code
res += String.fromCharCode(curByte);
} else if (curByte < 0xE0) { // Two-byte code
acc = curByte & 0x1F;
contBytes = 1; accBytes = 1;
} else if (curByte < 0xF0) { // Three-byte code
acc = curByte & 0x0F;
contBytes = 2; accBytes = 1;
} else { // Four or more are not supported for CESU-8.
res += this.defaultCharUnicode;
}
} else { // Continuation byte
if (contBytes > 0) { // We're waiting for it.
acc = (acc << 6) | (curByte & 0x3f);
contBytes--; accBytes++;
if (contBytes === 0) {
// Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80)
if (accBytes === 2 && acc < 0x80 && acc > 0)
res += this.defaultCharUnicode;
else if (accBytes === 3 && acc < 0x800)
res += this.defaultCharUnicode;
else
// Actually add character.
res += String.fromCharCode(acc);
}
} else { // Unexpected continuation byte
res += this.defaultCharUnicode;
}
}
}
this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes;
return res;
}
InternalDecoderCesu8.prototype.end = function() {
var res = 0;
if (this.contBytes > 0)
res += this.defaultCharUnicode;
return res;
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/internal.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,484 |
```javascript
"use strict";
// Manually added data to be used by sbcs codec in addition to generated one.
module.exports = {
// Not supported by iconv, not sure why.
"10029": "maccenteuro",
"maccenteuro": {
"type": "_sbcs",
"chars": ""
},
"808": "cp808",
"ibm808": "cp808",
"cp808": {
"type": "_sbcs",
"chars": ""
},
"mik": {
"type": "_sbcs",
"chars": ""
},
// Aliases of generated encodings.
"ascii8bit": "ascii",
"usascii": "ascii",
"ansix34": "ascii",
"ansix341968": "ascii",
"ansix341986": "ascii",
"csascii": "ascii",
"cp367": "ascii",
"ibm367": "ascii",
"isoir6": "ascii",
"iso646us": "ascii",
"iso646irv": "ascii",
"us": "ascii",
"latin1": "iso88591",
"latin2": "iso88592",
"latin3": "iso88593",
"latin4": "iso88594",
"latin5": "iso88599",
"latin6": "iso885910",
"latin7": "iso885913",
"latin8": "iso885914",
"latin9": "iso885915",
"latin10": "iso885916",
"csisolatin1": "iso88591",
"csisolatin2": "iso88592",
"csisolatin3": "iso88593",
"csisolatin4": "iso88594",
"csisolatincyrillic": "iso88595",
"csisolatinarabic": "iso88596",
"csisolatingreek" : "iso88597",
"csisolatinhebrew": "iso88598",
"csisolatin5": "iso88599",
"csisolatin6": "iso885910",
"l1": "iso88591",
"l2": "iso88592",
"l3": "iso88593",
"l4": "iso88594",
"l5": "iso88599",
"l6": "iso885910",
"l7": "iso885913",
"l8": "iso885914",
"l9": "iso885915",
"l10": "iso885916",
"isoir14": "iso646jp",
"isoir57": "iso646cn",
"isoir100": "iso88591",
"isoir101": "iso88592",
"isoir109": "iso88593",
"isoir110": "iso88594",
"isoir144": "iso88595",
"isoir127": "iso88596",
"isoir126": "iso88597",
"isoir138": "iso88598",
"isoir148": "iso88599",
"isoir157": "iso885910",
"isoir166": "tis620",
"isoir179": "iso885913",
"isoir199": "iso885914",
"isoir203": "iso885915",
"isoir226": "iso885916",
"cp819": "iso88591",
"ibm819": "iso88591",
"cyrillic": "iso88595",
"arabic": "iso88596",
"arabic8": "iso88596",
"ecma114": "iso88596",
"asmo708": "iso88596",
"greek" : "iso88597",
"greek8" : "iso88597",
"ecma118" : "iso88597",
"elot928" : "iso88597",
"hebrew": "iso88598",
"hebrew8": "iso88598",
"turkish": "iso88599",
"turkish8": "iso88599",
"thai": "iso885911",
"thai8": "iso885911",
"celtic": "iso885914",
"celtic8": "iso885914",
"isoceltic": "iso885914",
"tis6200": "tis620",
"tis62025291": "tis620",
"tis62025330": "tis620",
"10000": "macroman",
"10006": "macgreek",
"10007": "maccyrillic",
"10079": "maciceland",
"10081": "macturkish",
"cspc8codepage437": "cp437",
"cspc775baltic": "cp775",
"cspc850multilingual": "cp850",
"cspcp852": "cp852",
"cspc862latinhebrew": "cp862",
"cpgr": "cp869",
"msee": "cp1250",
"mscyrl": "cp1251",
"msansi": "cp1252",
"msgreek": "cp1253",
"msturk": "cp1254",
"mshebr": "cp1255",
"msarab": "cp1256",
"winbaltrim": "cp1257",
"cp20866": "koi8r",
"20866": "koi8r",
"ibm878": "koi8r",
"cskoi8r": "koi8r",
"cp21866": "koi8u",
"21866": "koi8u",
"ibm1168": "koi8u",
"strk10482002": "rk1048",
"tcvn5712": "tcvn",
"tcvn57121": "tcvn",
"gb198880": "iso646cn",
"cn": "iso646cn",
"csiso14jisc6220ro": "iso646jp",
"jisc62201969ro": "iso646jp",
"jp": "iso646jp",
"cshproman8": "hproman8",
"r8": "hproman8",
"roman8": "hproman8",
"xroman8": "hproman8",
"ibm1051": "hproman8",
"mac": "macintosh",
"csmacintosh": "macintosh",
};
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-data.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,483 |
```javascript
"use strict";
var Buffer = require("safer-buffer").Buffer;
// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js
// == UTF16-BE codec. ==========================================================
exports.utf16be = Utf16BECodec;
function Utf16BECodec() {
}
Utf16BECodec.prototype.encoder = Utf16BEEncoder;
Utf16BECodec.prototype.decoder = Utf16BEDecoder;
Utf16BECodec.prototype.bomAware = true;
// -- Encoding
function Utf16BEEncoder() {
}
Utf16BEEncoder.prototype.write = function(str) {
var buf = Buffer.from(str, 'ucs2');
for (var i = 0; i < buf.length; i += 2) {
var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp;
}
return buf;
}
Utf16BEEncoder.prototype.end = function() {
}
// -- Decoding
function Utf16BEDecoder() {
this.overflowByte = -1;
}
Utf16BEDecoder.prototype.write = function(buf) {
if (buf.length == 0)
return '';
var buf2 = Buffer.alloc(buf.length + 1),
i = 0, j = 0;
if (this.overflowByte !== -1) {
buf2[0] = buf[0];
buf2[1] = this.overflowByte;
i = 1; j = 2;
}
for (; i < buf.length-1; i += 2, j+= 2) {
buf2[j] = buf[i+1];
buf2[j+1] = buf[i];
}
this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1;
return buf2.slice(0, j).toString('ucs2');
}
Utf16BEDecoder.prototype.end = function() {
}
// == UTF-16 codec =============================================================
// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic.
// Defaults to UTF-16LE, as it's prevalent and default in Node.
// path_to_url and path_to_url#utf-16le
// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'});
// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false).
exports.utf16 = Utf16Codec;
function Utf16Codec(codecOptions, iconv) {
this.iconv = iconv;
}
Utf16Codec.prototype.encoder = Utf16Encoder;
Utf16Codec.prototype.decoder = Utf16Decoder;
// -- Encoding (pass-through)
function Utf16Encoder(options, codec) {
options = options || {};
if (options.addBOM === undefined)
options.addBOM = true;
this.encoder = codec.iconv.getEncoder('utf-16le', options);
}
Utf16Encoder.prototype.write = function(str) {
return this.encoder.write(str);
}
Utf16Encoder.prototype.end = function() {
return this.encoder.end();
}
// -- Decoding
function Utf16Decoder(options, codec) {
this.decoder = null;
this.initialBytes = [];
this.initialBytesLen = 0;
this.options = options || {};
this.iconv = codec.iconv;
}
Utf16Decoder.prototype.write = function(buf) {
if (!this.decoder) {
// Codec is not chosen yet. Accumulate initial bytes.
this.initialBytes.push(buf);
this.initialBytesLen += buf.length;
if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below)
return '';
// We have enough bytes -> detect endianness.
var buf = Buffer.concat(this.initialBytes),
encoding = detectEncoding(buf, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
this.initialBytes.length = this.initialBytesLen = 0;
}
return this.decoder.write(buf);
}
Utf16Decoder.prototype.end = function() {
if (!this.decoder) {
var buf = Buffer.concat(this.initialBytes),
encoding = detectEncoding(buf, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
var res = this.decoder.write(buf),
trail = this.decoder.end();
return trail ? (res + trail) : res;
}
return this.decoder.end();
}
function detectEncoding(buf, defaultEncoding) {
var enc = defaultEncoding || 'utf-16le';
if (buf.length >= 2) {
// Check BOM.
if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM
enc = 'utf-16be';
else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM
enc = 'utf-16le';
else {
// No BOM found. Try to deduce encoding from initial content.
// Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon.
// So, we count ASCII as if it was LE or BE, and decide from that.
var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions
_len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even.
for (var i = 0; i < _len; i += 2) {
if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++;
if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++;
}
if (asciiCharsBE > asciiCharsLE)
enc = 'utf-16be';
else if (asciiCharsBE < asciiCharsLE)
enc = 'utf-16le';
}
}
return enc;
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/utf16.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,309 |
```javascript
var Syntax = require('esprima-fb').Syntax;
var jstransform = require('jstransform');
var through = require('through');
var utils = require('jstransform/src/utils');
var reserved = [
"break", "case", "catch", "continue", "default", "delete", "do", "else",
"finally", "for", "function", "if", "in", "instanceof", "new", "return",
"switch", "this", "throw", "try", "typeof", "var", "void", "while", "with",
"abstract", "boolean", "byte", "char", "class", "const", "debugger",
"double", "enum", "export", "extends", "final", "float", "goto",
"implements", "import", "int", "interface", "long", "native", "package",
"private", "protected", "public", "short", "static", "super",
"synchronized", "throws", "transient", "volatile",
];
var reservedDict = {};
reserved.forEach(function(k) {
reservedDict[k] = true;
});
// In: x.class = 3;
// Out: x["class"] = 3;
function visitMemberExpression(traverse, node, path, state) {
traverse(node.object, path, state);
utils.catchup(node.object.range[1], state);
utils.append('[', state);
utils.catchupWhiteSpace(node.property.range[0], state);
utils.append('"', state);
utils.catchup(node.property.range[1], state);
utils.append('"]', state);
return false;
}
visitMemberExpression.test = function(node, path, state) {
return node.type === Syntax.MemberExpression &&
node.property.type === Syntax.Identifier &&
reservedDict[node.property.name] === true;
};
// In: x = {class: 2};
// Out: x = {"class": 2};
function visitProperty(traverse, node, path, state) {
utils.catchup(node.key.range[0], state);
utils.append('"', state);
utils.catchup(node.key.range[1], state);
utils.append('"', state);
utils.catchup(node.value.range[0], state);
traverse(node.value, path, state);
return false;
}
visitProperty.test = function(node, path, state) {
return node.type === Syntax.Property &&
node.key.type === Syntax.Identifier &&
reservedDict[node.key.name] === true;
};
var reCommaOrComment = /,|\/\*.+?\*\/|\/\/[^\n]+/g;
function stripComma(value) {
return value.replace(reCommaOrComment, function(text) {
if (text === ',') {
return '';
} else {
// Preserve comments
return text;
}
});
}
// In: [1, 2, 3,]
// Out: [1, 2, 3]
function visitArrayOrObjectExpression(traverse, node, path, state) {
// Copy the opening '[' or '{'
utils.catchup(node.range[0] + 1, state);
var elements = node.type === Syntax.ArrayExpression ?
node.elements :
node.properties;
elements.forEach(function(element, i) {
if (element == null && i === elements.length - 1) {
throw new Error(
"Elisions ending an array are interpreted inconsistently " +
"in IE8; remove the extra comma or use 'undefined' explicitly");
}
if (element != null) {
// Copy commas from after previous element, if any
utils.catchup(element.range[0], state);
traverse(element, path, state);
}
});
// Skip over a trailing comma, if any
utils.catchup(node.range[1] - 1, state, stripComma);
utils.catchup(node.range[1], state);
return false;
}
visitArrayOrObjectExpression.test = function(node, path, state) {
return node.type === Syntax.ArrayExpression ||
node.type === Syntax.ObjectExpression;
};
var visitorList = [
visitMemberExpression,
visitProperty,
visitArrayOrObjectExpression
];
function transform(code) {
return jstransform.transform(visitorList, code).code;
}
function process(file) {
if (/\.json$/.test(file)) return through();
var data = '';
function write(chunk) {
data += chunk;
}
function compile() {
var source;
try {
source = transform(data);
} catch (e) {
return this.emit('error', e);
}
this.queue(source);
this.queue(null);
}
return through(write, compile);
}
module.exports = process;
module.exports.isReserved = function(word) {
return reservedDict.hasOwnProperty(word) ? !!reservedDict[word] : false;
};
module.exports.transform = transform;
module.exports.visitorList = visitorList;
``` | /content/code_sandbox/node_modules/es3ify/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,061 |
```javascript
"use strict";
var Buffer = require("safer-buffer").Buffer;
// UTF-7 codec, according to path_to_url
// See also below a UTF-7-IMAP codec, according to path_to_url#section-5.1.3
exports.utf7 = Utf7Codec;
exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7
function Utf7Codec(codecOptions, iconv) {
this.iconv = iconv;
};
Utf7Codec.prototype.encoder = Utf7Encoder;
Utf7Codec.prototype.decoder = Utf7Decoder;
Utf7Codec.prototype.bomAware = true;
// -- Encoding
var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
function Utf7Encoder(options, codec) {
this.iconv = codec.iconv;
}
Utf7Encoder.prototype.write = function(str) {
// Naive implementation.
// Non-direct chars are encoded as "+<base64>-"; single "+" char is encoded as "+-".
return Buffer.from(str.replace(nonDirectChars, function(chunk) {
return "+" + (chunk === '+' ? '' :
this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, ''))
+ "-";
}.bind(this)));
}
Utf7Encoder.prototype.end = function() {
}
// -- Decoding
function Utf7Decoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = '';
}
var base64Regex = /[A-Za-z0-9\/+]/;
var base64Chars = [];
for (var i = 0; i < 256; i++)
base64Chars[i] = base64Regex.test(String.fromCharCode(i));
var plusChar = '+'.charCodeAt(0),
minusChar = '-'.charCodeAt(0),
andChar = '&'.charCodeAt(0);
Utf7Decoder.prototype.write = function(buf) {
var res = "", lastI = 0,
inBase64 = this.inBase64,
base64Accum = this.base64Accum;
// The decoder is more involved as we must handle chunks in stream.
for (var i = 0; i < buf.length; i++) {
if (!inBase64) { // We're in direct mode.
// Write direct chars until '+'
if (buf[i] == plusChar) {
res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
lastI = i+1;
inBase64 = true;
}
} else { // We decode base64.
if (!base64Chars[buf[i]]) { // Base64 ended.
if (i == lastI && buf[i] == minusChar) {// "+-" -> "+"
res += "+";
} else {
var b64str = base64Accum + buf.slice(lastI, i).toString();
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
if (buf[i] != minusChar) // Minus is absorbed after base64.
i--;
lastI = i+1;
inBase64 = false;
base64Accum = '';
}
}
}
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
} else {
var b64str = base64Accum + buf.slice(lastI).toString();
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
b64str = b64str.slice(0, canBeDecoded);
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
this.inBase64 = inBase64;
this.base64Accum = base64Accum;
return res;
}
Utf7Decoder.prototype.end = function() {
var res = "";
if (this.inBase64 && this.base64Accum.length > 0)
res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
this.inBase64 = false;
this.base64Accum = '';
return res;
}
// UTF-7-IMAP codec.
// RFC3501 Sec. 5.1.3 Modified UTF-7 (path_to_url#section-5.1.3)
// Differences:
// * Base64 part is started by "&" instead of "+"
// * Direct characters are 0x20-0x7E, except "&" (0x26)
// * In Base64, "," is used instead of "/"
// * Base64 must not be used to represent direct characters.
// * No implicit shift back from Base64 (should always end with '-')
// * String must end in non-shifted position.
// * "-&" while in base64 is not allowed.
exports.utf7imap = Utf7IMAPCodec;
function Utf7IMAPCodec(codecOptions, iconv) {
this.iconv = iconv;
};
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;
Utf7IMAPCodec.prototype.bomAware = true;
// -- Encoding
function Utf7IMAPEncoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = Buffer.alloc(6);
this.base64AccumIdx = 0;
}
Utf7IMAPEncoder.prototype.write = function(str) {
var inBase64 = this.inBase64,
base64Accum = this.base64Accum,
base64AccumIdx = this.base64AccumIdx,
buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0;
for (var i = 0; i < str.length; i++) {
var uChar = str.charCodeAt(i);
if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'.
if (inBase64) {
if (base64AccumIdx > 0) {
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
inBase64 = false;
}
if (!inBase64) {
buf[bufIdx++] = uChar; // Write direct character
if (uChar === andChar) // Ampersand -> '&-'
buf[bufIdx++] = minusChar;
}
} else { // Non-direct character
if (!inBase64) {
buf[bufIdx++] = andChar; // Write '&', then go to base64 mode.
inBase64 = true;
}
if (inBase64) {
base64Accum[base64AccumIdx++] = uChar >> 8;
base64Accum[base64AccumIdx++] = uChar & 0xFF;
if (base64AccumIdx == base64Accum.length) {
bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx);
base64AccumIdx = 0;
}
}
}
}
this.inBase64 = inBase64;
this.base64AccumIdx = base64AccumIdx;
return buf.slice(0, bufIdx);
}
Utf7IMAPEncoder.prototype.end = function() {
var buf = Buffer.alloc(10), bufIdx = 0;
if (this.inBase64) {
if (this.base64AccumIdx > 0) {
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
this.base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
this.inBase64 = false;
}
return buf.slice(0, bufIdx);
}
// -- Decoding
function Utf7IMAPDecoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = '';
}
var base64IMAPChars = base64Chars.slice();
base64IMAPChars[','.charCodeAt(0)] = true;
Utf7IMAPDecoder.prototype.write = function(buf) {
var res = "", lastI = 0,
inBase64 = this.inBase64,
base64Accum = this.base64Accum;
// The decoder is more involved as we must handle chunks in stream.
// It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end).
for (var i = 0; i < buf.length; i++) {
if (!inBase64) { // We're in direct mode.
// Write direct chars until '&'
if (buf[i] == andChar) {
res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
lastI = i+1;
inBase64 = true;
}
} else { // We decode base64.
if (!base64IMAPChars[buf[i]]) { // Base64 ended.
if (i == lastI && buf[i] == minusChar) { // "&-" -> "&"
res += "&";
} else {
var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/');
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
if (buf[i] != minusChar) // Minus may be absorbed after base64.
i--;
lastI = i+1;
inBase64 = false;
base64Accum = '';
}
}
}
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
} else {
var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/');
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
b64str = b64str.slice(0, canBeDecoded);
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
this.inBase64 = inBase64;
this.base64Accum = base64Accum;
return res;
}
Utf7IMAPDecoder.prototype.end = function() {
var res = "";
if (this.inBase64 && this.base64Accum.length > 0)
res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
this.inBase64 = false;
this.base64Accum = '';
return res;
}
``` | /content/code_sandbox/node_modules/raw-body/node_modules/iconv-lite/encodings/utf7.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,535 |
```javascript
var transform = require('../index.js').transform;
describe('es3ify', function() {
it('should quote property keys', function() {
expect(transform('x = {dynamic: 0, static: 17};'))
.toEqual('x = {dynamic: 0, "static": 17};');
});
it('should quote member properties', function() {
expect(transform('x.dynamic++; x.static++;'))
.toEqual('x.dynamic++; x["static"]++;');
});
it('should remove trailing commas in arrays', function() {
expect(transform('[2, 3, 4,]'))
.toEqual('[2, 3, 4]');
});
it('should keep comments near a trailing comma', function() {
expect(transform('[2, 3, 4 /* = 2^2 */,// = 6 - 2\n]'))
.toEqual('[2, 3, 4 /* = 2^2 */// = 6 - 2\n]');
});
it('should remove trailing commas in objects', function() {
expect(transform('({x: 3, y: 4,})'))
.toEqual('({x: 3, y: 4})');
});
it('should transform everything at once', function() {
expect(transform('({a:2,\tfor :[2,,3,],}\n.class)'))
.toEqual('({a:2,\t"for" :[2,,3]}[\n"class"])');
});
});
``` | /content/code_sandbox/node_modules/es3ify/spec/es3ifyspec.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 329 |
```javascript
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
//
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
// various contributors and released under an MIT license.
//
// Git repositories for Acorn are available at
//
// path_to_url
// path_to_url
//
// Please use the [github bug tracker][ghbt] to report issues.
//
// [ghbt]: path_to_url
//
// This file defines the main parser interface. The library also comes
// with a [error-tolerant parser][dammit] and an
// [abstract syntax tree walker][walk], defined in other files.
//
// [dammit]: acorn_loose.js
// [walk]: util/walk.js
import {Parser} from "./state"
import {getOptions} from "./options"
import "./parseutil"
import "./statement"
import "./lval"
import "./expression"
export {Parser, plugins} from "./state"
export {defaultOptions} from "./options"
export {SourceLocation} from "./location"
export {getLineInfo} from "./location"
export {Node} from "./node"
export {TokenType, types as tokTypes} from "./tokentype"
export {TokContext, types as tokContexts} from "./tokencontext"
export {isIdentifierChar, isIdentifierStart} from "./identifier"
export {Token} from "./tokenize"
export {isNewLine, lineBreak, lineBreakG} from "./whitespace"
export const version = "1.2.2"
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
// returns an abstract syntax tree as specified by [Mozilla parser
// API][api].
//
// [api]: path_to_url
export function parse(input, options) {
let p = parser(options, input)
let startPos = p.pos, startLoc = p.options.locations && p.curPosition()
p.nextToken()
return p.parseTopLevel(p.options.program || p.startNodeAt(startPos, startLoc))
}
// This function tries to parse a single expression at a given
// offset in a string. Useful for parsing mixed-language formats
// that embed JavaScript expressions.
export function parseExpressionAt(input, pos, options) {
let p = parser(options, input, pos)
p.nextToken()
return p.parseExpression()
}
// Acorn is organized as a tokenizer and a recursive-descent parser.
// The `tokenize` export provides an interface to the tokenizer.
export function tokenizer(input, options) {
return parser(options, input)
}
function parser(options, input) {
return new Parser(getOptions(options), String(input))
}
``` | /content/code_sandbox/node_modules/acorn/src/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 576 |
```javascript
// ## Token types
// The assignment of fine-grained, information-carrying type objects
// allows the tokenizer to store the information it has about a
// token in a way that is very cheap for the parser to look up.
// All token type variables start with an underscore, to make them
// easy to recognize.
// The `beforeExpr` property is used to disambiguate between regular
// expressions and divisions. It is set on all token types that can
// be followed by an expression (thus, a slash after them would be a
// regular expression).
//
// `isLoop` marks a keyword as starting a loop, which is important
// to know when parsing a label, in order to allow or disallow
// continue jumps to that label.
export class TokenType {
constructor(label, conf = {}) {
this.label = label
this.keyword = conf.keyword
this.beforeExpr = !!conf.beforeExpr
this.startsExpr = !!conf.startsExpr
this.isLoop = !!conf.isLoop
this.isAssign = !!conf.isAssign
this.prefix = !!conf.prefix
this.postfix = !!conf.postfix
this.binop = conf.binop || null
this.updateContext = null
}
}
function binop(name, prec) {
return new TokenType(name, {beforeExpr: true, binop: prec})
}
const beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}
export const types = {
num: new TokenType("num", startsExpr),
regexp: new TokenType("regexp", startsExpr),
string: new TokenType("string", startsExpr),
name: new TokenType("name", startsExpr),
eof: new TokenType("eof"),
// Punctuation token types.
bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
bracketR: new TokenType("]"),
braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
braceR: new TokenType("}"),
parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
// Operators. These carry several kinds of properties to help the
// parser use them properly (the presence of these properties is
// what categorizes them as operators).
//
// `binop`, when present, specifies that this operator is a binary
// operator, and will refer to its precedence.
//
// `prefix` and `postfix` mark the operator as a prefix or postfix
// unary operator.
//
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
// binary operators with a very low precedence, that should result
// in AssignmentExpression nodes.
eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=", 6),
relational: binop("</>", 7),
bitShift: binop("<</>>", 8),
plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10)
}
// Map keyword names to token types.
export const keywords = {}
// Succinct definitions of keyword token types
function kw(name, options = {}) {
options.keyword = name
keywords[name] = types["_" + name] = new TokenType(name, options)
}
kw("break")
kw("case", beforeExpr)
kw("catch")
kw("continue")
kw("debugger")
kw("default")
kw("do", {isLoop: true})
kw("else", beforeExpr)
kw("finally")
kw("for", {isLoop: true})
kw("function", startsExpr)
kw("if")
kw("return", beforeExpr)
kw("switch")
kw("throw", beforeExpr)
kw("try")
kw("var")
kw("let")
kw("const")
kw("while", {isLoop: true})
kw("with")
kw("new", {beforeExpr: true, startsExpr: true})
kw("this", startsExpr)
kw("super", startsExpr)
kw("class")
kw("extends", beforeExpr)
kw("export")
kw("import")
kw("yield", {beforeExpr: true, startsExpr: true})
kw("null", startsExpr)
kw("true", startsExpr)
kw("false", startsExpr)
kw("in", {beforeExpr: true, binop: 7})
kw("instanceof", {beforeExpr: true, binop: 7})
kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true})
kw("void", {beforeExpr: true, prefix: true, startsExpr: true})
kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
``` | /content/code_sandbox/node_modules/acorn/src/tokentype.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,296 |
```javascript
import {types as tt} from "./tokentype"
import {Parser} from "./state"
import {reservedWords} from "./identifier"
import {has} from "./util"
const pp = Parser.prototype
// Convert existing expression atom to assignable pattern
// if possible.
pp.toAssignable = function(node, isBinding) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
break
case "ObjectExpression":
node.type = "ObjectPattern"
for (let i = 0; i < node.properties.length; i++) {
let prop = node.properties[i]
if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter")
this.toAssignable(prop.value, isBinding)
}
break
case "ArrayExpression":
node.type = "ArrayPattern"
this.toAssignableList(node.elements, isBinding)
break
case "AssignmentExpression":
if (node.operator === "=") {
node.type = "AssignmentPattern"
} else {
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.")
}
break
case "ParenthesizedExpression":
node.expression = this.toAssignable(node.expression, isBinding)
break
case "MemberExpression":
if (!isBinding) break
default:
this.raise(node.start, "Assigning to rvalue")
}
}
return node
}
// Convert list of expression atoms to binding list.
pp.toAssignableList = function(exprList, isBinding) {
let end = exprList.length
if (end) {
let last = exprList[end - 1]
if (last && last.type == "RestElement") {
--end
} else if (last && last.type == "SpreadElement") {
last.type = "RestElement"
let arg = last.argument
this.toAssignable(arg, isBinding)
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern")
this.unexpected(arg.start)
--end
}
}
for (let i = 0; i < end; i++) {
let elt = exprList[i]
if (elt) this.toAssignable(elt, isBinding)
}
return exprList
}
// Parses spread element.
pp.parseSpread = function(refShorthandDefaultPos) {
let node = this.startNode()
this.next()
node.argument = this.parseMaybeAssign(refShorthandDefaultPos)
return this.finishNode(node, "SpreadElement")
}
pp.parseRest = function() {
let node = this.startNode()
this.next()
node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()
return this.finishNode(node, "RestElement")
}
// Parses lvalue (assignable) atom.
pp.parseBindingAtom = function() {
if (this.options.ecmaVersion < 6) return this.parseIdent()
switch (this.type) {
case tt.name:
return this.parseIdent()
case tt.bracketL:
let node = this.startNode()
this.next()
node.elements = this.parseBindingList(tt.bracketR, true, true)
return this.finishNode(node, "ArrayPattern")
case tt.braceL:
return this.parseObj(true)
default:
this.unexpected()
}
}
pp.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
let elts = [], first = true
while (!this.eat(close)) {
if (first) first = false
else this.expect(tt.comma)
if (allowEmpty && this.type === tt.comma) {
elts.push(null)
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break
} else if (this.type === tt.ellipsis) {
let rest = this.parseRest()
this.parseBindingListItem(rest)
elts.push(rest)
this.expect(close)
break
} else {
let elem = this.parseMaybeDefault(this.start, this.startLoc)
this.parseBindingListItem(elem)
elts.push(elem)
}
}
return elts
}
pp.parseBindingListItem = function(param) {
return param
}
// Parses assignment pattern around given atom if possible.
pp.parseMaybeDefault = function(startPos, startLoc, left) {
if (Array.isArray(startPos)){
if (this.options.locations && noCalls === undefined) {
// shift arguments to left by one
left = startLoc
// flatten startPos
startLoc = startPos[1]
startPos = startPos[0]
}
}
left = left || this.parseBindingAtom()
if (!this.eat(tt.eq)) return left
let node = this.startNodeAt(startPos, startLoc)
node.operator = "="
node.left = left
node.right = this.parseMaybeAssign()
return this.finishNode(node, "AssignmentPattern")
}
// Verify that a node is an lval something that can be assigned
// to.
pp.checkLVal = function(expr, isBinding, checkClashes) {
switch (expr.type) {
case "Identifier":
if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name)))
this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode")
if (checkClashes) {
if (has(checkClashes, expr.name))
this.raise(expr.start, "Argument name clash in strict mode")
checkClashes[expr.name] = true
}
break
case "MemberExpression":
if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression")
break
case "ObjectPattern":
for (let i = 0; i < expr.properties.length; i++)
this.checkLVal(expr.properties[i].value, isBinding, checkClashes)
break
case "ArrayPattern":
for (let i = 0; i < expr.elements.length; i++) {
let elem = expr.elements[i]
if (elem) this.checkLVal(elem, isBinding, checkClashes)
}
break
case "AssignmentPattern":
this.checkLVal(expr.left, isBinding, checkClashes)
break
case "RestElement":
this.checkLVal(expr.argument, isBinding, checkClashes)
break
case "ParenthesizedExpression":
this.checkLVal(expr.expression, isBinding, checkClashes)
break
default:
this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue")
}
}
``` | /content/code_sandbox/node_modules/acorn/src/lval.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,500 |
```javascript
// The algorithm used to determine whether a regexp can appear at a
// given point in the program is loosely based on sweet.js' approach.
// See path_to_url
import {Parser} from "./state"
import {types as tt} from "./tokentype"
import {lineBreak} from "./whitespace"
export class TokContext {
constructor(token, isExpr, preserveSpace, override) {
this.token = token
this.isExpr = isExpr
this.preserveSpace = preserveSpace
this.override = override
}
}
export const types = {
b_stat: new TokContext("{", false),
b_expr: new TokContext("{", true),
b_tmpl: new TokContext("${", true),
p_stat: new TokContext("(", false),
p_expr: new TokContext("(", true),
q_tmpl: new TokContext("`", true, true, p => p.readTmplToken()),
f_expr: new TokContext("function", true)
}
const pp = Parser.prototype
pp.initialContext = function() {
return [types.b_stat]
}
pp.braceIsBlock = function(prevType) {
let parent
if (prevType === tt.colon && (parent = this.curContext()).token == "{")
return !parent.isExpr
if (prevType === tt._return)
return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof)
return true
if (prevType == tt.braceL)
return this.curContext() === types.b_stat
return !this.exprAllowed
}
pp.updateContext = function(prevType) {
let update, type = this.type
if (type.keyword && prevType == tt.dot)
this.exprAllowed = false
else if (update = type.updateContext)
update.call(this, prevType)
else
this.exprAllowed = type.beforeExpr
}
// Token-specific context update code
tt.parenR.updateContext = tt.braceR.updateContext = function() {
if (this.context.length == 1) {
this.exprAllowed = true
return
}
let out = this.context.pop()
if (out === types.b_stat && this.curContext() === types.f_expr) {
this.context.pop()
this.exprAllowed = false
} else if (out === types.b_tmpl) {
this.exprAllowed = true
} else {
this.exprAllowed = !out.isExpr
}
}
tt.braceL.updateContext = function(prevType) {
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)
this.exprAllowed = true
}
tt.dollarBraceL.updateContext = function() {
this.context.push(types.b_tmpl)
this.exprAllowed = true
}
tt.parenL.updateContext = function(prevType) {
let statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while
this.context.push(statementParens ? types.p_stat : types.p_expr)
this.exprAllowed = true
}
tt.incDec.updateContext = function() {
// tokExprAllowed stays unchanged
}
tt._function.updateContext = function() {
if (this.curContext() !== types.b_stat)
this.context.push(types.f_expr)
this.exprAllowed = false
}
tt.backQuote.updateContext = function() {
if (this.curContext() === types.q_tmpl)
this.context.pop()
else
this.context.push(types.q_tmpl)
this.exprAllowed = false
}
``` | /content/code_sandbox/node_modules/acorn/src/tokencontext.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 794 |
```javascript
import {Parser} from "./state"
import {lineBreakG} from "./whitespace"
import {deprecate} from "util"
// These are used when `options.locations` is on, for the
// `startLoc` and `endLoc` properties.
export class Position {
constructor(line, col) {
this.line = line
this.column = col
}
offset(n) {
return new Position(this.line, this.column + n)
}
}
export class SourceLocation {
constructor(p, start, end) {
this.start = start
this.end = end
if (p.sourceFile !== null) this.source = p.sourceFile
}
}
// The `getLineInfo` function is mostly useful when the
// `locations` option is off (for performance reasons) and you
// want to find the line/column position for a given character
// offset. `input` should be the code string that the offset refers
// into.
export function getLineInfo(input, offset) {
for (let line = 1, cur = 0;;) {
lineBreakG.lastIndex = cur
let match = lineBreakG.exec(input)
if (match && match.index < offset) {
++line
cur = match.index + match[0].length
} else {
return new Position(line, offset - cur)
}
}
}
const pp = Parser.prototype
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
// the location of the error, attaches the position to the end
// of the error message, and then raises a `SyntaxError` with that
// message.
pp.raise = function(pos, message) {
let loc = getLineInfo(this.input, pos)
message += " (" + loc.line + ":" + loc.column + ")"
let err = new SyntaxError(message)
err.pos = pos; err.loc = loc; err.raisedAt = this.pos
throw err
}
pp.curPosition = function() {
return new Position(this.curLine, this.pos - this.lineStart)
}
pp.markPosition = function() {
return this.options.locations ? [this.start, this.startLoc] : this.start
}
``` | /content/code_sandbox/node_modules/acorn/src/location.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 486 |
```javascript
import {Parser} from "./state"
import {SourceLocation} from "./location"
// Start an AST node, attaching a start offset.
const pp = Parser.prototype
export class Node {}
pp.startNode = function() {
let node = new Node
node.start = this.start
if (this.options.locations)
node.loc = new SourceLocation(this, this.startLoc)
if (this.options.directSourceFile)
node.sourceFile = this.options.directSourceFile
if (this.options.ranges)
node.range = [this.start, 0]
return node
}
pp.startNodeAt = function(pos, loc) {
let node = new Node
if (Array.isArray(pos)){
if (this.options.locations && loc === undefined) {
// flatten pos
loc = pos[1]
pos = pos[0]
}
}
node.start = pos
if (this.options.locations)
node.loc = new SourceLocation(this, loc)
if (this.options.directSourceFile)
node.sourceFile = this.options.directSourceFile
if (this.options.ranges)
node.range = [pos, 0]
return node
}
// Finish an AST node, adding `type` and `end` properties.
pp.finishNode = function(node, type) {
node.type = type
node.end = this.lastTokEnd
if (this.options.locations)
node.loc.end = this.lastTokEndLoc
if (this.options.ranges)
node.range[1] = this.lastTokEnd
return node
}
// Finish node at given position
pp.finishNodeAt = function(node, type, pos, loc) {
node.type = type
if (Array.isArray(pos)){
if (this.options.locations && loc === undefined) {
// flatten pos
loc = pos[1]
pos = pos[0]
}
}
node.end = pos
if (this.options.locations)
node.loc.end = loc
if (this.options.ranges)
node.range[1] = pos
return node
}
``` | /content/code_sandbox/node_modules/acorn/src/node.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 447 |
```javascript
import {types as tt} from "./tokentype"
import {Parser} from "./state"
import {lineBreak} from "./whitespace"
const pp = Parser.prototype
// ### Statement parsing
// Parse a program. Initializes the parser, reads any number of
// statements, and wraps them in a Program node. Optionally takes a
// `program` argument. If present, the statements will be appended
// to its body instead of creating a new node.
pp.parseTopLevel = function(node) {
let first = true
if (!node.body) node.body = []
while (this.type !== tt.eof) {
let stmt = this.parseStatement(true, true)
node.body.push(stmt)
if (first && this.isUseStrict(stmt)) this.setStrict(true)
first = false
}
this.next()
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType
}
return this.finishNode(node, "Program")
}
const loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"}
// Parse a single statement.
//
// If expecting a statement and finding a slash operator, parse a
// regular expression literal. This is to handle cases like
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
pp.parseStatement = function(declaration, topLevel) {
let starttype = this.type, node = this.startNode()
// Most types of statements are recognized by the keyword they
// start with. Many are trivial to parse, some require a bit of
// complexity.
switch (starttype) {
case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
case tt._debugger: return this.parseDebuggerStatement(node)
case tt._do: return this.parseDoStatement(node)
case tt._for: return this.parseForStatement(node)
case tt._function:
if (!declaration && this.options.ecmaVersion >= 6) this.unexpected()
return this.parseFunctionStatement(node)
case tt._class:
if (!declaration) this.unexpected()
return this.parseClass(node, true)
case tt._if: return this.parseIfStatement(node)
case tt._return: return this.parseReturnStatement(node)
case tt._switch: return this.parseSwitchStatement(node)
case tt._throw: return this.parseThrowStatement(node)
case tt._try: return this.parseTryStatement(node)
case tt._let: case tt._const: if (!declaration) this.unexpected() // NOTE: falls through to _var
case tt._var: return this.parseVarStatement(node, starttype)
case tt._while: return this.parseWhileStatement(node)
case tt._with: return this.parseWithStatement(node)
case tt.braceL: return this.parseBlock()
case tt.semi: return this.parseEmptyStatement(node)
case tt._export:
case tt._import:
if (!this.options.allowImportExportEverywhere) {
if (!topLevel)
this.raise(this.start, "'import' and 'export' may only appear at the top level")
if (!this.inModule)
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")
}
return starttype === tt._import ? this.parseImport(node) : this.parseExport(node)
// If the statement does not start with a statement keyword or a
// brace, it's an ExpressionStatement or LabeledStatement. We
// simply start parsing an expression, and afterwards, if the
// next token is a colon and the expression was a simple
// Identifier node, we switch to interpreting it as a label.
default:
let maybeName = this.value, expr = this.parseExpression()
if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon))
return this.parseLabeledStatement(node, maybeName, expr)
else return this.parseExpressionStatement(node, expr)
}
}
pp.parseBreakContinueStatement = function(node, keyword) {
let isBreak = keyword == "break"
this.next()
if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null
else if (this.type !== tt.name) this.unexpected()
else {
node.label = this.parseIdent()
this.semicolon()
}
// Verify that there is an actual destination to break or
// continue to.
for (var i = 0; i < this.labels.length; ++i) {
let lab = this.labels[i]
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) break
if (node.label && isBreak) break
}
}
if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword)
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
}
pp.parseDebuggerStatement = function(node) {
this.next()
this.semicolon()
return this.finishNode(node, "DebuggerStatement")
}
pp.parseDoStatement = function(node) {
this.next()
this.labels.push(loopLabel)
node.body = this.parseStatement(false)
this.labels.pop()
this.expect(tt._while)
node.test = this.parseParenExpression()
if (this.options.ecmaVersion >= 6)
this.eat(tt.semi)
else
this.semicolon()
return this.finishNode(node, "DoWhileStatement")
}
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
// the second parameter to `parseExpression`), and then check
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
pp.parseForStatement = function(node) {
this.next()
this.labels.push(loopLabel)
this.expect(tt.parenL)
if (this.type === tt.semi) return this.parseFor(node, null)
if (this.type === tt._var || this.type === tt._let || this.type === tt._const) {
let init = this.startNode(), varKind = this.type
this.next()
this.parseVar(init, true, varKind)
this.finishNode(init, "VariableDeclaration")
if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1 &&
!(varKind !== tt._var && init.declarations[0].init))
return this.parseForIn(node, init)
return this.parseFor(node, init)
}
let refShorthandDefaultPos = {start: 0}
let init = this.parseExpression(true, refShorthandDefaultPos)
if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
this.toAssignable(init)
this.checkLVal(init)
return this.parseForIn(node, init)
} else if (refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start)
}
return this.parseFor(node, init)
}
pp.parseFunctionStatement = function(node) {
this.next()
return this.parseFunction(node, true)
}
pp.parseIfStatement = function(node) {
this.next()
node.test = this.parseParenExpression()
node.consequent = this.parseStatement(false)
node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null
return this.finishNode(node, "IfStatement")
}
pp.parseReturnStatement = function(node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
this.raise(this.start, "'return' outside of function")
this.next()
// In `return` (and `break`/`continue`), the keywords with
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null
else { node.argument = this.parseExpression(); this.semicolon() }
return this.finishNode(node, "ReturnStatement")
}
pp.parseSwitchStatement = function(node) {
this.next()
node.discriminant = this.parseParenExpression()
node.cases = []
this.expect(tt.braceL)
this.labels.push(switchLabel)
// Statements under must be grouped (by label) in SwitchCase
// nodes. `cur` is used to keep the node that we are currently
// adding statements to.
for (var cur, sawDefault; this.type != tt.braceR;) {
if (this.type === tt._case || this.type === tt._default) {
let isCase = this.type === tt._case
if (cur) this.finishNode(cur, "SwitchCase")
node.cases.push(cur = this.startNode())
cur.consequent = []
this.next()
if (isCase) {
cur.test = this.parseExpression()
} else {
if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses")
sawDefault = true
cur.test = null
}
this.expect(tt.colon)
} else {
if (!cur) this.unexpected()
cur.consequent.push(this.parseStatement(true))
}
}
if (cur) this.finishNode(cur, "SwitchCase")
this.next() // Closing brace
this.labels.pop()
return this.finishNode(node, "SwitchStatement")
}
pp.parseThrowStatement = function(node) {
this.next()
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
this.raise(this.lastTokEnd, "Illegal newline after throw")
node.argument = this.parseExpression()
this.semicolon()
return this.finishNode(node, "ThrowStatement")
}
// Reused empty array added for node fields that are always empty.
const empty = []
pp.parseTryStatement = function(node) {
this.next()
node.block = this.parseBlock()
node.handler = null
if (this.type === tt._catch) {
let clause = this.startNode()
this.next()
this.expect(tt.parenL)
clause.param = this.parseBindingAtom()
this.checkLVal(clause.param, true)
this.expect(tt.parenR)
clause.guard = null
clause.body = this.parseBlock()
node.handler = this.finishNode(clause, "CatchClause")
}
node.guardedHandlers = empty
node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null
if (!node.handler && !node.finalizer)
this.raise(node.start, "Missing catch or finally clause")
return this.finishNode(node, "TryStatement")
}
pp.parseVarStatement = function(node, kind) {
this.next()
this.parseVar(node, false, kind)
this.semicolon()
return this.finishNode(node, "VariableDeclaration")
}
pp.parseWhileStatement = function(node) {
this.next()
node.test = this.parseParenExpression()
this.labels.push(loopLabel)
node.body = this.parseStatement(false)
this.labels.pop()
return this.finishNode(node, "WhileStatement")
}
pp.parseWithStatement = function(node) {
if (this.strict) this.raise(this.start, "'with' in strict mode")
this.next()
node.object = this.parseParenExpression()
node.body = this.parseStatement(false)
return this.finishNode(node, "WithStatement")
}
pp.parseEmptyStatement = function(node) {
this.next()
return this.finishNode(node, "EmptyStatement")
}
pp.parseLabeledStatement = function(node, maybeName, expr) {
for (let i = 0; i < this.labels.length; ++i)
if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared")
let kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null
this.labels.push({name: maybeName, kind: kind})
node.body = this.parseStatement(true)
this.labels.pop()
node.label = expr
return this.finishNode(node, "LabeledStatement")
}
pp.parseExpressionStatement = function(node, expr) {
node.expression = expr
this.semicolon()
return this.finishNode(node, "ExpressionStatement")
}
// Parse a semicolon-enclosed block of statements, handling `"use
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
pp.parseBlock = function(allowStrict) {
let node = this.startNode(), first = true, oldStrict
node.body = []
this.expect(tt.braceL)
while (!this.eat(tt.braceR)) {
let stmt = this.parseStatement(true)
node.body.push(stmt)
if (first && allowStrict && this.isUseStrict(stmt)) {
oldStrict = this.strict
this.setStrict(this.strict = true)
}
first = false
}
if (oldStrict === false) this.setStrict(false)
return this.finishNode(node, "BlockStatement")
}
// Parse a regular `for` loop. The disambiguation code in
// `parseStatement` will already have parsed the init statement or
// expression.
pp.parseFor = function(node, init) {
node.init = init
this.expect(tt.semi)
node.test = this.type === tt.semi ? null : this.parseExpression()
this.expect(tt.semi)
node.update = this.type === tt.parenR ? null : this.parseExpression()
this.expect(tt.parenR)
node.body = this.parseStatement(false)
this.labels.pop()
return this.finishNode(node, "ForStatement")
}
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
pp.parseForIn = function(node, init) {
let type = this.type === tt._in ? "ForInStatement" : "ForOfStatement"
this.next()
node.left = init
node.right = this.parseExpression()
this.expect(tt.parenR)
node.body = this.parseStatement(false)
this.labels.pop()
return this.finishNode(node, type)
}
// Parse a list of variable declarations.
pp.parseVar = function(node, isFor, kind) {
node.declarations = []
node.kind = kind.keyword
for (;;) {
let decl = this.startNode()
this.parseVarId(decl)
if (this.eat(tt.eq)) {
decl.init = this.parseMaybeAssign(isFor)
} else if (kind === tt._const && !(this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
this.unexpected()
} else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) {
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value")
} else {
decl.init = null
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
if (!this.eat(tt.comma)) break
}
return node
}
pp.parseVarId = function(decl) {
decl.id = this.parseBindingAtom()
this.checkLVal(decl.id, true)
}
// Parse a function declaration or literal (depending on the
// `isStatement` parameter).
pp.parseFunction = function(node, isStatement, allowExpressionBody) {
this.initFunction(node)
if (this.options.ecmaVersion >= 6)
node.generator = this.eat(tt.star)
if (isStatement || this.type === tt.name)
node.id = this.parseIdent()
this.parseFunctionParams(node)
this.parseFunctionBody(node, allowExpressionBody)
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
}
pp.parseFunctionParams = function(node) {
this.expect(tt.parenL)
node.params = this.parseBindingList(tt.parenR, false, false)
}
// Parse a class declaration or literal (depending on the
// `isStatement` parameter).
pp.parseClass = function(node, isStatement) {
this.next()
this.parseClassId(node, isStatement)
this.parseClassSuper(node)
let classBody = this.startNode()
let hadConstructor = false
classBody.body = []
this.expect(tt.braceL)
while (!this.eat(tt.braceR)) {
if (this.eat(tt.semi)) continue
let method = this.startNode()
let isGenerator = this.eat(tt.star)
let isMaybeStatic = this.type === tt.name && this.value === "static"
this.parsePropertyName(method)
method.static = isMaybeStatic && this.type !== tt.parenL
if (method.static) {
if (isGenerator) this.unexpected()
isGenerator = this.eat(tt.star)
this.parsePropertyName(method)
}
method.kind = "method"
if (!method.computed) {
let {key} = method
let isGetSet = false
if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) {
isGetSet = true
method.kind = key.name
key = this.parsePropertyName(method)
}
if (!method.static && (key.type === "Identifier" && key.name === "constructor" ||
key.type === "Literal" && key.value === "constructor")) {
if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class")
if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier")
if (isGenerator) this.raise(key.start, "Constructor can't be a generator")
method.kind = "constructor"
hadConstructor = true
}
}
this.parseClassMethod(classBody, method, isGenerator)
}
node.body = this.finishNode(classBody, "ClassBody")
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
}
pp.parseClassMethod = function(classBody, method, isGenerator) {
method.value = this.parseMethod(isGenerator)
classBody.body.push(this.finishNode(method, "MethodDefinition"))
}
pp.parseClassId = function(node, isStatement) {
node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null
}
pp.parseClassSuper = function(node) {
node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null
}
// Parses module export declaration.
pp.parseExport = function(node) {
this.next()
// export * from '...'
if (this.eat(tt.star)) {
this.expectContextual("from")
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
this.semicolon()
return this.finishNode(node, "ExportAllDeclaration")
}
if (this.eat(tt._default)) { // export default ...
let expr = this.parseMaybeAssign()
let needsSemi = true
if (expr.type == "FunctionExpression" ||
expr.type == "ClassExpression") {
needsSemi = false
if (expr.id) {
expr.type = expr.type == "FunctionExpression"
? "FunctionDeclaration"
: "ClassDeclaration"
}
}
node.declaration = expr
if (needsSemi) this.semicolon()
return this.finishNode(node, "ExportDefaultDeclaration")
}
// export var|const|let|function|class ...
if (this.shouldParseExportStatement()) {
node.declaration = this.parseStatement(true)
node.specifiers = []
node.source = null
} else { // export { x, y as z } [from '...']
node.declaration = null
node.specifiers = this.parseExportSpecifiers()
if (this.eatContextual("from")) {
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
} else {
node.source = null
}
this.semicolon()
}
return this.finishNode(node, "ExportNamedDeclaration")
}
pp.shouldParseExportStatement = function() {
return this.type.keyword
}
// Parses a comma-separated list of module exports.
pp.parseExportSpecifiers = function() {
let nodes = [], first = true
// export { x, y as z } [from '...']
this.expect(tt.braceL)
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma)
if (this.afterTrailingComma(tt.braceR)) break
} else first = false
let node = this.startNode()
node.local = this.parseIdent(this.type === tt._default)
node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local
nodes.push(this.finishNode(node, "ExportSpecifier"))
}
return nodes
}
// Parses import declaration.
pp.parseImport = function(node) {
this.next()
// import '...'
if (this.type === tt.string) {
node.specifiers = empty
node.source = this.parseExprAtom()
node.kind = ""
} else {
node.specifiers = this.parseImportSpecifiers()
this.expectContextual("from")
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
}
this.semicolon()
return this.finishNode(node, "ImportDeclaration")
}
// Parses a comma-separated list of module imports.
pp.parseImportSpecifiers = function() {
let nodes = [], first = true
if (this.type === tt.name) {
// import defaultObj, { x, y as z } from '...'
let node = this.startNode()
node.local = this.parseIdent()
this.checkLVal(node.local, true)
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"))
if (!this.eat(tt.comma)) return nodes
}
if (this.type === tt.star) {
let node = this.startNode()
this.next()
this.expectContextual("as")
node.local = this.parseIdent()
this.checkLVal(node.local, true)
nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"))
return nodes
}
this.expect(tt.braceL)
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma)
if (this.afterTrailingComma(tt.braceR)) break
} else first = false
let node = this.startNode()
node.imported = this.parseIdent(true)
node.local = this.eatContextual("as") ? this.parseIdent() : node.imported
this.checkLVal(node.local, true)
nodes.push(this.finishNode(node, "ImportSpecifier"))
}
return nodes
}
``` | /content/code_sandbox/node_modules/acorn/src/statement.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 5,101 |
```javascript
export function isArray(obj) {
return Object.prototype.toString.call(obj) === "[object Array]"
}
// Checks if an object has a property.
export function has(obj, propName) {
return Object.prototype.hasOwnProperty.call(obj, propName)
}
``` | /content/code_sandbox/node_modules/acorn/src/util.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 49 |
```javascript
import {types as tt} from "./tokentype"
import {Parser} from "./state"
import {lineBreak} from "./whitespace"
const pp = Parser.prototype
// ## Parser utilities
// Test whether a statement node is the string literal `"use strict"`.
pp.isUseStrict = function(stmt) {
return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" &&
stmt.expression.type === "Literal" && stmt.expression.value === "use strict"
}
// Predicate that tests whether the next token is of the given
// type, and if yes, consumes it as a side effect.
pp.eat = function(type) {
if (this.type === type) {
this.next()
return true
} else {
return false
}
}
// Tests whether parsed token is a contextual keyword.
pp.isContextual = function(name) {
return this.type === tt.name && this.value === name
}
// Consumes contextual keyword if possible.
pp.eatContextual = function(name) {
return this.value === name && this.eat(tt.name)
}
// Asserts that following token is given contextual keyword.
pp.expectContextual = function(name) {
if (!this.eatContextual(name)) this.unexpected()
}
// Test whether a semicolon can be inserted at the current position.
pp.canInsertSemicolon = function() {
return this.type === tt.eof ||
this.type === tt.braceR ||
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
}
pp.insertSemicolon = function() {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon)
this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)
return true
}
}
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
pp.semicolon = function() {
if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()
}
pp.afterTrailingComma = function(tokType) {
if (this.type == tokType) {
if (this.options.onTrailingComma)
this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)
this.next()
return true
}
}
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
pp.expect = function(type) {
this.eat(type) || this.unexpected()
}
// Raise an unexpected token error.
pp.unexpected = function(pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token")
}
``` | /content/code_sandbox/node_modules/acorn/src/parseutil.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 580 |
```javascript
import {reservedWords, keywords} from "./identifier"
import {types as tt} from "./tokentype"
import {lineBreak} from "./whitespace"
export function Parser(options, input, startPos) {
this.options = options
this.sourceFile = this.options.sourceFile || null
this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5]
this.isReservedWord = reservedWords[this.options.ecmaVersion]
this.input = input
// Load plugins
this.loadPlugins(this.options.plugins)
// Set up token state
// The current position of the tokenizer in the input.
if (startPos) {
this.pos = startPos
this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos))
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length
} else {
this.pos = this.lineStart = 0
this.curLine = 1
}
// Properties of the current token:
// Its type
this.type = tt.eof
// For tokens that include more information than their type, the value
this.value = null
// Its start and end offset
this.start = this.end = this.pos
// And, if locations are used, the {line, column} object
// corresponding to those offsets
this.startLoc = this.endLoc = null
// Position information for the previous token
this.lastTokEndLoc = this.lastTokStartLoc = null
this.lastTokStart = this.lastTokEnd = this.pos
// The context stack is used to superficially track syntactic
// context to predict whether a regular expression is allowed in a
// given position.
this.context = this.initialContext()
this.exprAllowed = true
// Figure out if it's a module code.
this.strict = this.inModule = this.options.sourceType === "module"
// Used to signify the start of a potential arrow function
this.potentialArrowAt = -1
// Flags to track whether we are in a function, a generator.
this.inFunction = this.inGenerator = false
// Labels in scope.
this.labels = []
// If enabled, skip leading hashbang line.
if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === '#!')
this.skipLineComment(2)
}
Parser.prototype.extend = function(name, f) {
this[name] = f(this[name])
}
// Registered plugins
export const plugins = {}
Parser.prototype.loadPlugins = function(plugins) {
for (let name in plugins) {
let plugin = exports.plugins[name]
if (!plugin) throw new Error("Plugin '" + name + "' not found")
plugin(this, plugins[name])
}
}
``` | /content/code_sandbox/node_modules/acorn/src/state.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 611 |
```javascript
// Matches a whole line break (where CRLF is considered a single
// line break). Used to count lines.
export const lineBreak = /\r\n?|\n|\u2028|\u2029/
export const lineBreakG = new RegExp(lineBreak.source, "g")
export function isNewLine(code) {
return code === 10 || code === 13 || code === 0x2028 || code == 0x2029
}
export const nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/
``` | /content/code_sandbox/node_modules/acorn/src/whitespace.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 132 |
```javascript
// A recursive descent parser operates by defining functions for all
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
// instead of `(!x)[1]` is handled by the fact that the parser
// function that parses unary prefix operators is called first, and
// in turn calls the function that parses `[]` subscripts that
// way, it'll receive the node for `x[1]` already parsed, and wraps
// *that* in the unary operator node.
//
// Acorn uses an [operator precedence parser][opp] to handle binary
// operator precedence, because it is much more compact than using
// the technique outlined above, which uses different, nesting
// functions to specify precedence, for all of the ten binary
// precedence levels that JavaScript defines.
//
// [opp]: path_to_url
import {types as tt} from "./tokentype"
import {Parser} from "./state"
import {reservedWords} from "./identifier"
import {has} from "./util"
const pp = Parser.prototype
// Check if property name clashes with already added.
// Object/class getters and setters are not allowed to clash
// either with each other or with an init property and in
// strict mode, init properties are also not allowed to be repeated.
pp.checkPropClash = function(prop, propHash) {
if (this.options.ecmaVersion >= 6) return
let key = prop.key, name
switch (key.type) {
case "Identifier": name = key.name; break
case "Literal": name = String(key.value); break
default: return
}
let kind = prop.kind || "init", other
if (has(propHash, name)) {
other = propHash[name]
let isGetSet = kind !== "init"
if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init))
this.raise(key.start, "Redefinition of property")
} else {
other = propHash[name] = {
init: false,
get: false,
set: false
}
}
other[kind] = true
}
// ### Expression parsing
// These nest, from the most general expression type at the top to
// 'atomic', nondivisible expression types at the bottom. Most of
// the functions will simply let the function(s) below them parse,
// and, *if* the syntactic construct they handle is present, wrap
// the AST node that the inner parser gave them in another node.
// Parse a full expression. The optional arguments are used to
// forbid the `in` operator (in for loops initalization expressions)
// and provide reference for storing '=' operator inside shorthand
// property assignment in contexts where both object expression
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
pp.parseExpression = function(noIn, refShorthandDefaultPos) {
let startPos = this.start, startLoc = this.startLoc
let expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos)
if (this.type === tt.comma) {
let node = this.startNodeAt(startPos, startLoc)
node.expressions = [expr]
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos))
return this.finishNode(node, "SequenceExpression")
}
return expr
}
// Parse an assignment expression. This includes applications of
// operators like `+=`.
pp.parseMaybeAssign = function(noIn, refShorthandDefaultPos, afterLeftParse) {
if (this.type == tt._yield && this.inGenerator) return this.parseYield()
let failOnShorthandAssign
if (!refShorthandDefaultPos) {
refShorthandDefaultPos = {start: 0}
failOnShorthandAssign = true
} else {
failOnShorthandAssign = false
}
let startPos = this.start, startLoc = this.startLoc
if (this.type == tt.parenL || this.type == tt.name)
this.potentialArrowAt = this.start
let left = this.parseMaybeConditional(noIn, refShorthandDefaultPos)
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)
if (this.type.isAssign) {
let node = this.startNodeAt(startPos, startLoc)
node.operator = this.value
node.left = this.type === tt.eq ? this.toAssignable(left) : left
refShorthandDefaultPos.start = 0 // reset because shorthand default was used correctly
this.checkLVal(left)
this.next()
node.right = this.parseMaybeAssign(noIn)
return this.finishNode(node, "AssignmentExpression")
} else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start)
}
return left
}
// Parse a ternary conditional (`?:`) operator.
pp.parseMaybeConditional = function(noIn, refShorthandDefaultPos) {
let startPos = this.start, startLoc = this.startLoc
let expr = this.parseExprOps(noIn, refShorthandDefaultPos)
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
if (this.eat(tt.question)) {
let node = this.startNodeAt(startPos, startLoc)
node.test = expr
node.consequent = this.parseMaybeAssign()
this.expect(tt.colon)
node.alternate = this.parseMaybeAssign(noIn)
return this.finishNode(node, "ConditionalExpression")
}
return expr
}
// Start the precedence parser.
pp.parseExprOps = function(noIn, refShorthandDefaultPos) {
let startPos = this.start, startLoc = this.startLoc
let expr = this.parseMaybeUnary(refShorthandDefaultPos)
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
return this.parseExprOp(expr, startPos, startLoc, -1, noIn)
}
// Parse binary operators with the operator precedence parsing
// algorithm. `left` is the left-hand side of the operator.
// `minPrec` provides context that allows the function to stop and
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
pp.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
let prec = this.type.binop
if (Array.isArray(leftStartPos)){
if (this.options.locations && noIn === undefined) {
// shift arguments to left by one
noIn = minPrec
minPrec = leftStartLoc
// flatten leftStartPos
leftStartLoc = leftStartPos[1]
leftStartPos = leftStartPos[0]
}
}
if (prec != null && (!noIn || this.type !== tt._in)) {
if (prec > minPrec) {
let node = this.startNodeAt(leftStartPos, leftStartLoc)
node.left = left
node.operator = this.value
let op = this.type
this.next()
let startPos = this.start, startLoc = this.startLoc
node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn)
this.finishNode(node, (op === tt.logicalOR || op === tt.logicalAND) ? "LogicalExpression" : "BinaryExpression")
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
}
}
return left
}
// Parse unary operators, both prefix and postfix.
pp.parseMaybeUnary = function(refShorthandDefaultPos) {
if (this.type.prefix) {
let node = this.startNode(), update = this.type === tt.incDec
node.operator = this.value
node.prefix = true
this.next()
node.argument = this.parseMaybeUnary()
if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start)
if (update) this.checkLVal(node.argument)
else if (this.strict && node.operator === "delete" &&
node.argument.type === "Identifier")
this.raise(node.start, "Deleting local variable in strict mode")
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
}
let startPos = this.start, startLoc = this.startLoc
let expr = this.parseExprSubscripts(refShorthandDefaultPos)
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
while (this.type.postfix && !this.canInsertSemicolon()) {
let node = this.startNodeAt(startPos, startLoc)
node.operator = this.value
node.prefix = false
node.argument = expr
this.checkLVal(expr)
this.next()
expr = this.finishNode(node, "UpdateExpression")
}
return expr
}
// Parse call, dot, and `[]`-subscript expressions.
pp.parseExprSubscripts = function(refShorthandDefaultPos) {
let startPos = this.start, startLoc = this.startLoc
let expr = this.parseExprAtom(refShorthandDefaultPos)
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
return this.parseSubscripts(expr, startPos, startLoc)
}
pp.parseSubscripts = function(base, startPos, startLoc, noCalls) {
if (Array.isArray(startPos)){
if (this.options.locations && noCalls === undefined) {
// shift arguments to left by one
noCalls = startLoc
// flatten startPos
startLoc = startPos[1]
startPos = startPos[0]
}
}
for (;;) {
if (this.eat(tt.dot)) {
let node = this.startNodeAt(startPos, startLoc)
node.object = base
node.property = this.parseIdent(true)
node.computed = false
base = this.finishNode(node, "MemberExpression")
} else if (this.eat(tt.bracketL)) {
let node = this.startNodeAt(startPos, startLoc)
node.object = base
node.property = this.parseExpression()
node.computed = true
this.expect(tt.bracketR)
base = this.finishNode(node, "MemberExpression")
} else if (!noCalls && this.eat(tt.parenL)) {
let node = this.startNodeAt(startPos, startLoc)
node.callee = base
node.arguments = this.parseExprList(tt.parenR, false)
base = this.finishNode(node, "CallExpression")
} else if (this.type === tt.backQuote) {
let node = this.startNodeAt(startPos, startLoc)
node.tag = base
node.quasi = this.parseTemplate()
base = this.finishNode(node, "TaggedTemplateExpression")
} else {
return base
}
}
}
// Parse an atomic expression either a single token that is an
// expression, an expression started by a keyword like `function` or
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
pp.parseExprAtom = function(refShorthandDefaultPos) {
let node, canBeArrow = this.potentialArrowAt == this.start
switch (this.type) {
case tt._this:
case tt._super:
let type = this.type === tt._this ? "ThisExpression" : "Super"
node = this.startNode()
this.next()
return this.finishNode(node, type)
case tt._yield:
if (this.inGenerator) this.unexpected()
case tt.name:
let startPos = this.start, startLoc = this.startLoc
let id = this.parseIdent(this.type !== tt.name)
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow))
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id])
return id
case tt.regexp:
let value = this.value
node = this.parseLiteral(value.value)
node.regex = {pattern: value.pattern, flags: value.flags}
return node
case tt.num: case tt.string:
return this.parseLiteral(this.value)
case tt._null: case tt._true: case tt._false:
node = this.startNode()
node.value = this.type === tt._null ? null : this.type === tt._true
node.raw = this.type.keyword
this.next()
return this.finishNode(node, "Literal")
case tt.parenL:
return this.parseParenAndDistinguishExpression(canBeArrow)
case tt.bracketL:
node = this.startNode()
this.next()
// check whether this is array comprehension or regular array
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
return this.parseComprehension(node, false)
}
node.elements = this.parseExprList(tt.bracketR, true, true, refShorthandDefaultPos)
return this.finishNode(node, "ArrayExpression")
case tt.braceL:
return this.parseObj(false, refShorthandDefaultPos)
case tt._function:
node = this.startNode()
this.next()
return this.parseFunction(node, false)
case tt._class:
return this.parseClass(this.startNode(), false)
case tt._new:
return this.parseNew()
case tt.backQuote:
return this.parseTemplate()
default:
this.unexpected()
}
}
pp.parseLiteral = function(value) {
let node = this.startNode()
node.value = value
node.raw = this.input.slice(this.start, this.end)
this.next()
return this.finishNode(node, "Literal")
}
pp.parseParenExpression = function() {
this.expect(tt.parenL)
let val = this.parseExpression()
this.expect(tt.parenR)
return val
}
pp.parseParenAndDistinguishExpression = function(canBeArrow) {
let startPos = this.start, startLoc = this.startLoc, val
if (this.options.ecmaVersion >= 6) {
this.next()
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
return this.parseComprehension(this.startNodeAt(startPos, startLoc), true)
}
let innerStartPos = this.start, innerStartLoc = this.startLoc
let exprList = [], first = true
let refShorthandDefaultPos = {start: 0}, spreadStart, innerParenStart
while (this.type !== tt.parenR) {
first ? first = false : this.expect(tt.comma)
if (this.type === tt.ellipsis) {
spreadStart = this.start
exprList.push(this.parseParenItem(this.parseRest()))
break
} else {
if (this.type === tt.parenL && !innerParenStart) {
innerParenStart = this.start
}
exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem))
}
}
let innerEndPos = this.start, innerEndLoc = this.startLoc
this.expect(tt.parenR)
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
if (innerParenStart) this.unexpected(innerParenStart)
return this.parseParenArrowList(startPos, startLoc, exprList)
}
if (!exprList.length) this.unexpected(this.lastTokStart)
if (spreadStart) this.unexpected(spreadStart)
if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start)
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc)
val.expressions = exprList
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc)
} else {
val = exprList[0]
}
} else {
val = this.parseParenExpression()
}
if (this.options.preserveParens) {
let par = this.startNodeAt(startPos, startLoc)
par.expression = val
return this.finishNode(par, "ParenthesizedExpression")
} else {
return val
}
}
pp.parseParenItem = function(item) {
return item
}
pp.parseParenArrowList = function(startPos, startLoc, exprList) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
}
// New's precedence is slightly tricky. It must allow its argument
// to be a `[]` or dot subscript expression, but not a call at
// least, not without wrapping it in parentheses. Thus, it uses the
const empty = []
pp.parseNew = function() {
let node = this.startNode()
let meta = this.parseIdent(true)
if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
node.meta = meta
node.property = this.parseIdent(true)
if (node.property.name !== "target")
this.raise(node.property.start, "The only valid meta property for new is new.target")
return this.finishNode(node, "MetaProperty")
}
let startPos = this.start, startLoc = this.startLoc
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)
if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false)
else node.arguments = empty
return this.finishNode(node, "NewExpression")
}
// Parse template expression.
pp.parseTemplateElement = function() {
let elem = this.startNode()
elem.value = {
raw: this.input.slice(this.start, this.end),
cooked: this.value
}
this.next()
elem.tail = this.type === tt.backQuote
return this.finishNode(elem, "TemplateElement")
}
pp.parseTemplate = function() {
let node = this.startNode()
this.next()
node.expressions = []
let curElt = this.parseTemplateElement()
node.quasis = [curElt]
while (!curElt.tail) {
this.expect(tt.dollarBraceL)
node.expressions.push(this.parseExpression())
this.expect(tt.braceR)
node.quasis.push(curElt = this.parseTemplateElement())
}
this.next()
return this.finishNode(node, "TemplateLiteral")
}
// Parse an object literal or binding pattern.
pp.parseObj = function(isPattern, refShorthandDefaultPos) {
let node = this.startNode(), first = true, propHash = {}
node.properties = []
this.next()
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma)
if (this.afterTrailingComma(tt.braceR)) break
} else first = false
let prop = this.startNode(), isGenerator, startPos, startLoc
if (this.options.ecmaVersion >= 6) {
prop.method = false
prop.shorthand = false
if (isPattern || refShorthandDefaultPos) {
startPos = this.start
startLoc = this.startLoc
}
if (!isPattern)
isGenerator = this.eat(tt.star)
}
this.parsePropertyName(prop)
this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos)
this.checkPropClash(prop, propHash)
node.properties.push(this.finishNode(prop, "Property"))
}
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
}
pp.parsePropertyValue = function(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos) {
if (this.eat(tt.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos)
prop.kind = "init"
} else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {
if (isPattern) this.unexpected()
prop.kind = "init"
prop.method = true
prop.value = this.parseMethod(isGenerator)
} else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
(prop.key.name === "get" || prop.key.name === "set") &&
(this.type != tt.comma && this.type != tt.braceR)) {
if (isGenerator || isPattern) this.unexpected()
prop.kind = prop.key.name
this.parsePropertyName(prop)
prop.value = this.parseMethod(false)
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
prop.kind = "init"
if (isPattern) {
if (this.isKeyword(prop.key.name) ||
(this.strict && (reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name))) ||
(!this.options.allowReserved && this.isReservedWord(prop.key.name)))
this.raise(prop.key.start, "Binding " + prop.key.name)
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)
} else if (this.type === tt.eq && refShorthandDefaultPos) {
if (!refShorthandDefaultPos.start)
refShorthandDefaultPos.start = this.start
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)
} else {
prop.value = prop.key
}
prop.shorthand = true
} else this.unexpected()
}
pp.parsePropertyName = function(prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(tt.bracketL)) {
prop.computed = true
prop.key = this.parseMaybeAssign()
this.expect(tt.bracketR)
return prop.key
} else {
prop.computed = false
}
}
return prop.key = (this.type === tt.num || this.type === tt.string) ? this.parseExprAtom() : this.parseIdent(true)
}
// Initialize empty function node.
pp.initFunction = function(node) {
node.id = null
if (this.options.ecmaVersion >= 6) {
node.generator = false
node.expression = false
}
}
// Parse object or class method.
pp.parseMethod = function(isGenerator) {
let node = this.startNode()
this.initFunction(node)
this.expect(tt.parenL)
node.params = this.parseBindingList(tt.parenR, false, false)
let allowExpressionBody
if (this.options.ecmaVersion >= 6) {
node.generator = isGenerator
allowExpressionBody = true
} else {
allowExpressionBody = false
}
this.parseFunctionBody(node, allowExpressionBody)
return this.finishNode(node, "FunctionExpression")
}
// Parse arrow function expression with given parameters.
pp.parseArrowExpression = function(node, params) {
this.initFunction(node)
node.params = this.toAssignableList(params, true)
this.parseFunctionBody(node, true)
return this.finishNode(node, "ArrowFunctionExpression")
}
// Parse function body and check parameters.
pp.parseFunctionBody = function(node, allowExpression) {
let isExpression = allowExpression && this.type !== tt.braceL
if (isExpression) {
node.body = this.parseMaybeAssign()
node.expression = true
} else {
// Start a new scope with regard to labels and the `inFunction`
// flag (restore them to their old value afterwards).
let oldInFunc = this.inFunction, oldInGen = this.inGenerator, oldLabels = this.labels
this.inFunction = true; this.inGenerator = node.generator; this.labels = []
node.body = this.parseBlock(true)
node.expression = false
this.inFunction = oldInFunc; this.inGenerator = oldInGen; this.labels = oldLabels
}
// If this is a strict mode function, verify that argument names
// are not repeated, and it does not try to bind the words `eval`
// or `arguments`.
if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) {
let nameHash = {}, oldStrict = this.strict
this.strict = true
if (node.id)
this.checkLVal(node.id, true)
for (let i = 0; i < node.params.length; i++)
this.checkLVal(node.params[i], true, nameHash)
this.strict = oldStrict
}
}
// Parses a comma-separated list of expressions, and returns them as
// an array. `close` is the token type that ends the list, and
// `allowEmpty` can be turned on to allow subsequent commas with
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
pp.parseExprList = function(close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) {
let elts = [], first = true
while (!this.eat(close)) {
if (!first) {
this.expect(tt.comma)
if (allowTrailingComma && this.afterTrailingComma(close)) break
} else first = false
if (allowEmpty && this.type === tt.comma) {
elts.push(null)
} else {
if (this.type === tt.ellipsis)
elts.push(this.parseSpread(refShorthandDefaultPos))
else
elts.push(this.parseMaybeAssign(false, refShorthandDefaultPos))
}
}
return elts
}
// Parse the next token as an identifier. If `liberal` is true (used
// when parsing properties), it will also convert keywords into
// identifiers.
pp.parseIdent = function(liberal) {
let node = this.startNode()
if (liberal && this.options.allowReserved == "never") liberal = false
if (this.type === tt.name) {
if (!liberal &&
((!this.options.allowReserved && this.isReservedWord(this.value)) ||
(this.strict && reservedWords.strict(this.value)) &&
(this.options.ecmaVersion >= 6 ||
this.input.slice(this.start, this.end).indexOf("\\") == -1)))
this.raise(this.start, "The keyword '" + this.value + "' is reserved")
node.name = this.value
} else if (liberal && this.type.keyword) {
node.name = this.type.keyword
} else {
this.unexpected()
}
this.next()
return this.finishNode(node, "Identifier")
}
// Parses yield expression inside generator.
pp.parseYield = function() {
let node = this.startNode()
this.next()
if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.startsExpr)) {
node.delegate = false
node.argument = null
} else {
node.delegate = this.eat(tt.star)
node.argument = this.parseMaybeAssign()
}
return this.finishNode(node, "YieldExpression")
}
// Parses array and generator comprehensions.
pp.parseComprehension = function(node, isGenerator) {
node.blocks = []
while (this.type === tt._for) {
let block = this.startNode()
this.next()
this.expect(tt.parenL)
block.left = this.parseBindingAtom()
this.checkLVal(block.left, true)
this.expectContextual("of")
block.right = this.parseExpression()
this.expect(tt.parenR)
node.blocks.push(this.finishNode(block, "ComprehensionBlock"))
}
node.filter = this.eat(tt._if) ? this.parseParenExpression() : null
node.body = this.parseExpression()
this.expect(isGenerator ? tt.parenR : tt.bracketR)
node.generator = isGenerator
return this.finishNode(node, "ComprehensionExpression")
}
``` | /content/code_sandbox/node_modules/acorn/src/expression.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 6,147 |
```javascript
import {isIdentifierStart, isIdentifierChar} from "./identifier"
import {types as tt, keywords as keywordTypes} from "./tokentype"
import {Parser} from "./state"
import {SourceLocation} from "./location"
import {lineBreak, lineBreakG, isNewLine, nonASCIIwhitespace} from "./whitespace"
// Object type used to represent tokens. Note that normally, tokens
// simply exist as properties on the parser object. This is only
// used for the onToken callback and the external tokenizer.
export class Token {
constructor(p) {
this.type = p.type
this.value = p.value
this.start = p.start
this.end = p.end
if (p.options.locations)
this.loc = new SourceLocation(p, p.startLoc, p.endLoc)
if (p.options.ranges)
this.range = [p.start, p.end]
}
}
// ## Tokenizer
const pp = Parser.prototype
// Are we running under Rhino?
const isRhino = typeof Packages !== "undefined"
// Move to the next token
pp.next = function() {
if (this.options.onToken)
this.options.onToken(new Token(this))
this.lastTokEnd = this.end
this.lastTokStart = this.start
this.lastTokEndLoc = this.endLoc
this.lastTokStartLoc = this.startLoc
this.nextToken()
}
pp.getToken = function() {
this.next()
return new Token(this)
}
// If we're in an ES6 environment, make parsers iterable
if (typeof Symbol !== "undefined")
pp[Symbol.iterator] = function () {
let self = this
return {next: function () {
let token = self.getToken()
return {
done: token.type === tt.eof,
value: token
}
}}
}
// Toggle strict mode. Re-reads the next number or string to please
// pedantic tests (`"use strict"; 010;` should fail).
pp.setStrict = function(strict) {
this.strict = strict
if (this.type !== tt.num && this.type !== tt.string) return
this.pos = this.start
if (this.options.locations) {
while (this.pos < this.lineStart) {
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1
--this.curLine
}
}
this.nextToken()
}
pp.curContext = function() {
return this.context[this.context.length - 1]
}
// Read a single token, updating the parser object's token-related
// properties.
pp.nextToken = function() {
let curContext = this.curContext()
if (!curContext || !curContext.preserveSpace) this.skipSpace()
this.start = this.pos
if (this.options.locations) this.startLoc = this.curPosition()
if (this.pos >= this.input.length) return this.finishToken(tt.eof)
if (curContext.override) return curContext.override(this)
else this.readToken(this.fullCharCodeAtPos())
}
pp.readToken = function(code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that.
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
return this.readWord()
return this.getTokenFromCode(code)
}
pp.fullCharCodeAtPos = function() {
let code = this.input.charCodeAt(this.pos)
if (code <= 0xd7ff || code >= 0xe000) return code
let next = this.input.charCodeAt(this.pos + 1)
return (code << 10) + next - 0x35fdc00
}
pp.skipBlockComment = function() {
let startLoc = this.options.onComment && this.options.locations && this.curPosition()
let start = this.pos, end = this.input.indexOf("*/", this.pos += 2)
if (end === -1) this.raise(this.pos - 2, "Unterminated comment")
this.pos = end + 2
if (this.options.locations) {
lineBreakG.lastIndex = start
let match
while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
++this.curLine
this.lineStart = match.index + match[0].length
}
}
if (this.options.onComment)
this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
startLoc, this.options.locations && this.curPosition())
}
pp.skipLineComment = function(startSkip) {
let start = this.pos
let startLoc = this.options.onComment && this.options.locations && this.curPosition()
let ch = this.input.charCodeAt(this.pos+=startSkip)
while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
++this.pos
ch = this.input.charCodeAt(this.pos)
}
if (this.options.onComment)
this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
startLoc, this.options.locations && this.curPosition())
}
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
pp.skipSpace = function() {
while (this.pos < this.input.length) {
let ch = this.input.charCodeAt(this.pos)
if (ch === 32) { // ' '
++this.pos
} else if (ch === 13) {
++this.pos
let next = this.input.charCodeAt(this.pos)
if (next === 10) {
++this.pos
}
if (this.options.locations) {
++this.curLine
this.lineStart = this.pos
}
} else if (ch === 10 || ch === 8232 || ch === 8233) {
++this.pos
if (this.options.locations) {
++this.curLine
this.lineStart = this.pos
}
} else if (ch > 8 && ch < 14) {
++this.pos
} else if (ch === 47) { // '/'
let next = this.input.charCodeAt(this.pos + 1)
if (next === 42) { // '*'
this.skipBlockComment()
} else if (next === 47) { // '/'
this.skipLineComment(2)
} else break
} else if (ch === 160) { // '\xa0'
++this.pos
} else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
++this.pos
} else {
break
}
}
}
// Called at the end of every token. Sets `end`, `val`, and
// maintains `context` and `exprAllowed`, and skips the space after
// the token, so that the next one's `start` will point at the
// right position.
pp.finishToken = function(type, val) {
this.end = this.pos
if (this.options.locations) this.endLoc = this.curPosition()
let prevType = this.type
this.type = type
this.value = val
this.updateContext(prevType)
}
// ### Token reading
// This is the function that is called to fetch the next token. It
// is somewhat obscure, because it works in character codes rather
// than characters, and because operator parsing has been inlined
// into it.
//
// All in the name of speed.
//
pp.readToken_dot = function() {
let next = this.input.charCodeAt(this.pos + 1)
if (next >= 48 && next <= 57) return this.readNumber(true)
let next2 = this.input.charCodeAt(this.pos + 2)
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
this.pos += 3
return this.finishToken(tt.ellipsis)
} else {
++this.pos
return this.finishToken(tt.dot)
}
}
pp.readToken_slash = function() { // '/'
let next = this.input.charCodeAt(this.pos + 1)
if (this.exprAllowed) {++this.pos; return this.readRegexp();}
if (next === 61) return this.finishOp(tt.assign, 2)
return this.finishOp(tt.slash, 1)
}
pp.readToken_mult_modulo = function(code) { // '%*'
let next = this.input.charCodeAt(this.pos + 1)
if (next === 61) return this.finishOp(tt.assign, 2)
return this.finishOp(code === 42 ? tt.star : tt.modulo, 1)
}
pp.readToken_pipe_amp = function(code) { // '|&'
let next = this.input.charCodeAt(this.pos + 1)
if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2)
if (next === 61) return this.finishOp(tt.assign, 2)
return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1)
}
pp.readToken_caret = function() { // '^'
let next = this.input.charCodeAt(this.pos + 1)
if (next === 61) return this.finishOp(tt.assign, 2)
return this.finishOp(tt.bitwiseXOR, 1)
}
pp.readToken_plus_min = function(code) { // '+-'
let next = this.input.charCodeAt(this.pos + 1)
if (next === code) {
if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&
lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {
// A `-->` line comment
this.skipLineComment(3)
this.skipSpace()
return this.nextToken()
}
return this.finishOp(tt.incDec, 2)
}
if (next === 61) return this.finishOp(tt.assign, 2)
return this.finishOp(tt.plusMin, 1)
}
pp.readToken_lt_gt = function(code) { // '<>'
let next = this.input.charCodeAt(this.pos + 1)
let size = 1
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2
if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)
return this.finishOp(tt.bitShift, size)
}
if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&
this.input.charCodeAt(this.pos + 3) == 45) {
if (this.inModule) this.unexpected()
// `<!--`, an XML-style comment that should be interpreted as a line comment
this.skipLineComment(4)
this.skipSpace()
return this.nextToken()
}
if (next === 61)
size = this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2
return this.finishOp(tt.relational, size)
}
pp.readToken_eq_excl = function(code) { // '=!'
let next = this.input.charCodeAt(this.pos + 1)
if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2)
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
this.pos += 2
return this.finishToken(tt.arrow)
}
return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1)
}
pp.getTokenFromCode = function(code) {
switch (code) {
// The interpretation of a dot depends on whether it is followed
// by a digit or another two dots.
case 46: // '.'
return this.readToken_dot()
// Punctuation tokens.
case 40: ++this.pos; return this.finishToken(tt.parenL)
case 41: ++this.pos; return this.finishToken(tt.parenR)
case 59: ++this.pos; return this.finishToken(tt.semi)
case 44: ++this.pos; return this.finishToken(tt.comma)
case 91: ++this.pos; return this.finishToken(tt.bracketL)
case 93: ++this.pos; return this.finishToken(tt.bracketR)
case 123: ++this.pos; return this.finishToken(tt.braceL)
case 125: ++this.pos; return this.finishToken(tt.braceR)
case 58: ++this.pos; return this.finishToken(tt.colon)
case 63: ++this.pos; return this.finishToken(tt.question)
case 96: // '`'
if (this.options.ecmaVersion < 6) break
++this.pos
return this.finishToken(tt.backQuote)
case 48: // '0'
let next = this.input.charCodeAt(this.pos + 1)
if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
if (this.options.ecmaVersion >= 6) {
if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
}
// Anything else beginning with a digit is an integer, octal
// number, or float.
case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9
return this.readNumber(false)
// Quotes produce strings.
case 34: case 39: // '"', "'"
return this.readString(code)
// Operators are parsed inline in tiny state machines. '=' (61) is
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
case 47: // '/'
return this.readToken_slash()
case 37: case 42: // '%*'
return this.readToken_mult_modulo(code)
case 124: case 38: // '|&'
return this.readToken_pipe_amp(code)
case 94: // '^'
return this.readToken_caret()
case 43: case 45: // '+-'
return this.readToken_plus_min(code)
case 60: case 62: // '<>'
return this.readToken_lt_gt(code)
case 61: case 33: // '=!'
return this.readToken_eq_excl(code)
case 126: // '~'
return this.finishOp(tt.prefix, 1)
}
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'")
}
pp.finishOp = function(type, size) {
let str = this.input.slice(this.pos, this.pos + size)
this.pos += size
return this.finishToken(type, str)
}
var regexpUnicodeSupport = false
try { new RegExp("\uffff", "u"); regexpUnicodeSupport = true }
catch(e) {}
// Parse a regular expression. Some context-awareness is necessary,
// since a '/' inside a '[]' set does not end the expression.
pp.readRegexp = function() {
let escaped, inClass, start = this.pos
for (;;) {
if (this.pos >= this.input.length) this.raise(start, "Unterminated regular expression")
let ch = this.input.charAt(this.pos)
if (lineBreak.test(ch)) this.raise(start, "Unterminated regular expression")
if (!escaped) {
if (ch === "[") inClass = true
else if (ch === "]" && inClass) inClass = false
else if (ch === "/" && !inClass) break
escaped = ch === "\\"
} else escaped = false
++this.pos
}
let content = this.input.slice(start, this.pos)
++this.pos
// Need to use `readWord1` because '\uXXXX' sequences are allowed
// here (don't ask).
let mods = this.readWord1()
let tmp = content
if (mods) {
let validFlags = /^[gmsiy]*$/
if (this.options.ecmaVersion >= 6) validFlags = /^[gmsiyu]*$/
if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag")
if (mods.indexOf('u') >= 0 && !regexpUnicodeSupport) {
// Replace each astral symbol and every Unicode escape sequence that
// possibly represents an astral symbol or a paired surrogate with a
// single ASCII symbol to avoid throwing on regular expressions that
// are only valid in combination with the `/u` flag.
// Note: replacing with the ASCII symbol `x` might cause false
// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
// perfectly valid pattern that is equivalent to `[a-b]`, but it would
// be replaced by `[x-b]` which throws an error.
tmp = tmp.replace(/\\u([a-fA-F0-9]{4})|\\u\{([0-9a-fA-F]+)\}|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x")
}
}
// Detect invalid regular expressions.
let value = null
// Rhino's regular expression parser is flaky and throws uncatchable exceptions,
// so don't do detection if we are running under Rhino
if (!isRhino) {
try {
new RegExp(tmp)
} catch (e) {
if (e instanceof SyntaxError) this.raise(start, "Error parsing regular expression: " + e.message)
this.raise(e)
}
// Get a regular expression object for this pattern-flag pair, or `null` in
// case the current environment doesn't support the flags it uses.
try {
value = new RegExp(content, mods)
} catch (err) {}
}
return this.finishToken(tt.regexp, {pattern: content, flags: mods, value: value})
}
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
pp.readInt = function(radix, len) {
let start = this.pos, total = 0
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
let code = this.input.charCodeAt(this.pos), val
if (code >= 97) val = code - 97 + 10; // a
else if (code >= 65) val = code - 65 + 10; // A
else if (code >= 48 && code <= 57) val = code - 48; // 0-9
else val = Infinity
if (val >= radix) break
++this.pos
total = total * radix + val
}
if (this.pos === start || len != null && this.pos - start !== len) return null
return total
}
pp.readRadixNumber = function(radix) {
this.pos += 2; // 0x
let val = this.readInt(radix)
if (val == null) this.raise(this.start + 2, "Expected number in radix " + radix)
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number")
return this.finishToken(tt.num, val)
}
// Read an integer, octal integer, or floating-point number.
pp.readNumber = function(startsWithDot) {
let start = this.pos, isFloat = false, octal = this.input.charCodeAt(this.pos) === 48
if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number")
if (this.input.charCodeAt(this.pos) === 46) {
++this.pos
this.readInt(10)
isFloat = true
}
let next = this.input.charCodeAt(this.pos)
if (next === 69 || next === 101) { // 'eE'
next = this.input.charCodeAt(++this.pos)
if (next === 43 || next === 45) ++this.pos; // '+-'
if (this.readInt(10) === null) this.raise(start, "Invalid number")
isFloat = true
}
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number")
let str = this.input.slice(start, this.pos), val
if (isFloat) val = parseFloat(str)
else if (!octal || str.length === 1) val = parseInt(str, 10)
else if (/[89]/.test(str) || this.strict) this.raise(start, "Invalid number")
else val = parseInt(str, 8)
return this.finishToken(tt.num, val)
}
// Read a string value, interpreting backslash-escapes.
pp.readCodePoint = function() {
let ch = this.input.charCodeAt(this.pos), code
if (ch === 123) {
if (this.options.ecmaVersion < 6) this.unexpected()
++this.pos
code = this.readHexChar(this.input.indexOf('}', this.pos) - this.pos)
++this.pos
if (code > 0x10FFFF) this.unexpected()
} else {
code = this.readHexChar(4)
}
return code
}
function codePointToString(code) {
// UTF-16 Decoding
if (code <= 0xFFFF) return String.fromCharCode(code)
return String.fromCharCode(((code - 0x10000) >> 10) + 0xD800,
((code - 0x10000) & 1023) + 0xDC00)
}
pp.readString = function(quote) {
let out = "", chunkStart = ++this.pos
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated string constant")
let ch = this.input.charCodeAt(this.pos)
if (ch === quote) break
if (ch === 92) { // '\'
out += this.input.slice(chunkStart, this.pos)
out += this.readEscapedChar()
chunkStart = this.pos
} else {
if (isNewLine(ch)) this.raise(this.start, "Unterminated string constant")
++this.pos
}
}
out += this.input.slice(chunkStart, this.pos++)
return this.finishToken(tt.string, out)
}
// Reads template string tokens.
pp.readTmplToken = function() {
let out = "", chunkStart = this.pos
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template")
let ch = this.input.charCodeAt(this.pos)
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
if (this.pos === this.start && this.type === tt.template) {
if (ch === 36) {
this.pos += 2
return this.finishToken(tt.dollarBraceL)
} else {
++this.pos
return this.finishToken(tt.backQuote)
}
}
out += this.input.slice(chunkStart, this.pos)
return this.finishToken(tt.template, out)
}
if (ch === 92) { // '\'
out += this.input.slice(chunkStart, this.pos)
out += this.readEscapedChar()
chunkStart = this.pos
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.pos)
++this.pos
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
++this.pos
out += "\n"
} else {
out += String.fromCharCode(ch)
}
if (this.options.locations) {
++this.curLine
this.lineStart = this.pos
}
chunkStart = this.pos
} else {
++this.pos
}
}
}
// Used to read escaped characters
pp.readEscapedChar = function() {
let ch = this.input.charCodeAt(++this.pos)
let octal = /^[0-7]+/.exec(this.input.slice(this.pos, this.pos + 3))
if (octal) octal = octal[0]
while (octal && parseInt(octal, 8) > 255) octal = octal.slice(0, -1)
if (octal === "0") octal = null
++this.pos
if (octal) {
if (this.strict) this.raise(this.pos - 2, "Octal literal in strict mode")
this.pos += octal.length - 1
return String.fromCharCode(parseInt(octal, 8))
} else {
switch (ch) {
case 110: return "\n"; // 'n' -> '\n'
case 114: return "\r"; // 'r' -> '\r'
case 120: return String.fromCharCode(this.readHexChar(2)); // 'x'
case 117: return codePointToString(this.readCodePoint()); // 'u'
case 116: return "\t"; // 't' -> '\t'
case 98: return "\b"; // 'b' -> '\b'
case 118: return "\u000b"; // 'v' -> '\u000b'
case 102: return "\f"; // 'f' -> '\f'
case 48: return "\0"; // 0 -> '\0'
case 13: if (this.input.charCodeAt(this.pos) === 10) ++this.pos; // '\r\n'
case 10: // ' \n'
if (this.options.locations) { this.lineStart = this.pos; ++this.curLine }
return ""
default: return String.fromCharCode(ch)
}
}
}
// Used to read character escape sequences ('\x', '\u', '\U').
pp.readHexChar = function(len) {
let n = this.readInt(16, len)
if (n === null) this.raise(this.start, "Bad character escape sequence")
return n
}
// Used to signal to callers of `readWord1` whether the word
// contained any escape sequences. This is needed because words with
// escape sequences must not be interpreted as keywords.
var containsEsc
// Read an identifier, and return it as a string. Sets `containsEsc`
// to whether the word contained a '\u' escape.
//
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
pp.readWord1 = function() {
containsEsc = false
let word = "", first = true, chunkStart = this.pos
let astral = this.options.ecmaVersion >= 6
while (this.pos < this.input.length) {
let ch = this.fullCharCodeAtPos()
if (isIdentifierChar(ch, astral)) {
this.pos += ch <= 0xffff ? 1 : 2
} else if (ch === 92) { // "\"
containsEsc = true
word += this.input.slice(chunkStart, this.pos)
let escStart = this.pos
if (this.input.charCodeAt(++this.pos) != 117) // "u"
this.raise(this.pos, "Expecting Unicode escape sequence \\uXXXX")
++this.pos
let esc = this.readCodePoint()
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
this.raise(escStart, "Invalid Unicode escape")
word += codePointToString(esc)
chunkStart = this.pos
} else {
break
}
first = false
}
return word + this.input.slice(chunkStart, this.pos)
}
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
pp.readWord = function() {
let word = this.readWord1()
let type = tt.name
if ((this.options.ecmaVersion >= 6 || !containsEsc) && this.isKeyword(word))
type = keywordTypes[word]
return this.finishToken(type, word)
}
``` | /content/code_sandbox/node_modules/acorn/src/tokenize.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 6,279 |
```javascript
// This is a trick taken from Esprima. It turns out that, on
// non-Chrome browsers, to check whether a string is in a set, a
// predicate containing a big ugly `switch` statement is faster than
// a regular expression, and on Chrome the two are about on par.
// This function uses `eval` (non-lexical) to produce such a
// predicate from a space-separated string of words.
//
// It starts by sorting the words by length.
function makePredicate(words) {
words = words.split(" ")
let f = "", cats = []
out: for (let i = 0; i < words.length; ++i) {
for (let j = 0; j < cats.length; ++j)
if (cats[j][0].length == words[i].length) {
cats[j].push(words[i])
continue out
}
cats.push([words[i]])
}
function compareTo(arr) {
if (arr.length == 1) return f += "return str === " + JSON.stringify(arr[0]) + ";"
f += "switch(str){"
for (let i = 0; i < arr.length; ++i) f += "case " + JSON.stringify(arr[i]) + ":"
f += "return true}return false;"
}
// When there are more than three length categories, an outer
// switch first dispatches on the lengths, to save on comparisons.
if (cats.length > 3) {
cats.sort((a, b) => b.length - a.length)
f += "switch(str.length){"
for (let i = 0; i < cats.length; ++i) {
let cat = cats[i]
f += "case " + cat[0].length + ":"
compareTo(cat)
}
f += "}"
// Otherwise, simply generate a flat `switch` statement.
} else {
compareTo(words)
}
return new Function("str", f)
}
// Reserved word lists for various dialects of the language
export const reservedWords = {
3: makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),
5: makePredicate("class enum extends super const export import"),
6: makePredicate("enum await"),
strict: makePredicate("implements interface let package private protected public static yield"),
strictBind: makePredicate("eval arguments")
}
// And the keywords
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"
export const keywords = {
5: makePredicate(ecma5AndLessKeywords),
6: makePredicate(ecma5AndLessKeywords + " let const class extends export import yield super")
}
// ## Character categories
// Big ugly regular expressions that match characters in the
// whitespace, identifier, and identifier-start categories. These
// are only applied when a character is found to actually have a
// code point above 128.
// Generated by `tools/generate-identifier-regex.js`.
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b2\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua7ad\ua7b0\ua7b1\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab5f\uab64\uab65\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d01-\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2d\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]")
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]")
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
// offset starts at 0x10000, and each pair of numbers represents an
// offset to the next range, and then a size of the range. They were
// generated by tools/generate-identifier-regex.js
var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541]
var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239]
// This has a complexity linear to the value of the code. The
// assumption is that looking up astral identifier characters is
// rare.
function isInAstralSet(code, set) {
let pos = 0x10000
for (let i = 0; i < set.length; i += 2) {
pos += set[i]
if (pos > code) return false
pos += set[i + 1]
if (pos >= code) return true
}
}
// Test whether a given character code starts an identifier.
export function isIdentifierStart(code, astral) {
if (code < 65) return code === 36
if (code < 91) return true
if (code < 97) return code === 95
if (code < 123) return true
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))
if (astral === false) return false
return isInAstralSet(code, astralIdentifierStartCodes)
}
// Test whether a given character is part of an identifier.
export function isIdentifierChar(code, astral) {
if (code < 48) return code === 36
if (code < 58) return true
if (code < 65) return false
if (code < 91) return true
if (code < 97) return code === 95
if (code < 123) return true
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))
if (astral === false) return false
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
}
``` | /content/code_sandbox/node_modules/acorn/src/identifier.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 6,432 |
```javascript
// Acorn: Loose parser
//
// This module provides an alternative parser (`parse_dammit`) that
// exposes that same interface as `parse`, but will try to parse
// anything as JavaScript, repairing syntax error the best it can.
// There are circumstances in which it will raise an error and give
// up, but they are very rare. The resulting AST will be a mostly
// valid JavaScript AST (as per the [Mozilla parser API][api], except
// that:
//
// - Return outside functions is allowed
//
// - Label consistency (no conflicts, break only to existing labels)
// is not enforced.
//
// - Bogus Identifier nodes with a name of `""` are inserted whenever
// the parser got too confused to return anything meaningful.
//
// [api]: path_to_url
//
// The expected use for this is to *first* try `acorn.parse`, and only
// if that fails switch to `parse_dammit`. The loose parser might
// parse badly indented code incorrectly, so **don't** use it as
// your default parser.
//
// Quite a lot of acorn.js is duplicated here. The alternative was to
// add a *lot* of extra cruft to that file, making it less readable
// and slower. Copying and editing the code allowed me to make
// invasive changes and simplifications without creating a complicated
// tangle.
import * as acorn from ".."
import {LooseParser} from "./state"
import "./tokenize"
import "./parseutil"
import "./statement"
import "./expression"
export {LooseParser} from "./state"
acorn.defaultOptions.tabSize = 4
export function parse_dammit(input, options) {
let p = new LooseParser(input, options)
p.next()
return p.parseTopLevel()
}
acorn.parse_dammit = parse_dammit
acorn.LooseParser = LooseParser
``` | /content/code_sandbox/node_modules/acorn/src/loose/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 410 |
```javascript
``` | /content/code_sandbox/node_modules/acorn/src/loose/acorn_loose.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1 |
```javascript
import {has, isArray} from "./util"
import {SourceLocation} from "./location"
// A second optional argument can be given to further configure
// the parser process. These options are recognized:
export const defaultOptions = {
// `ecmaVersion` indicates the ECMAScript version to parse. Must
// be either 3, or 5, or 6. This influences support for strict
// mode, the set of reserved words, support for getters and
// setters and other features.
ecmaVersion: 5,
// Source type ("script" or "module") for different semantics
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called
// when a semicolon is automatically inserted. It will be passed
// th position of the comma as an offset, and if `locations` is
// enabled, it is given the location as a `{line, column}` object
// as second argument.
onInsertedSemicolon: null,
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
// trailing commas.
onTrailingComma: null,
// By default, reserved words are not enforced. Disable
// `allowReserved` to enforce them. When this option has the
// value "never", reserved words and keywords can also not be
// used as property names.
allowReserved: true,
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// appearing at the top of the program.
allowImportExportEverywhere: false,
// When enabled, hashbang directive in the beginning of file
// is allowed and treated as a line comment.
allowHashBang: false,
// When `locations` is on, `loc` properties holding objects with
// `start` and `end` properties in `{line, column}` form (with
// line being 1-based and column 0-based) will be attached to the
// nodes.
locations: false,
// A function can be passed as `onToken` option, which will
// cause Acorn to call that function with object in the same
// format as tokenize() returns. Note that you are not
// allowed to call the parser from the callbackthat will
// corrupt its internal state.
onToken: null,
// A function can be passed as `onComment` option, which will
// cause Acorn to call that function with `(block, text, start,
// end)` parameters whenever a comment is skipped. `block` is a
// boolean indicating whether this is a block (`/* */`) comment,
// `text` is the content of the comment, and `start` and `end` are
// character offsets that denote the start and end of the comment.
// When the `locations` option is on, two more parameters are
// passed, the full `{line, column}` locations of the start and
// end of the comments. Note that you are not allowed to call the
// parser from the callbackthat will corrupt its internal state.
onComment: null,
// Nodes have their start and end characters offsets recorded in
// `start` and `end` properties (directly on the node, rather than
// the `loc` object, which holds line/column data. To also add a
// [semi-standardized][range] `range` property holding a `[start,
// end]` array with the same numbers, set the `ranges` option to
// `true`.
//
// [range]: path_to_url
ranges: false,
// It is possible to parse multiple files into a single AST by
// passing the tree produced by parsing the first file as
// `program` option in subsequent parses. This will add the
// toplevel forms of the parsed file to the `Program` (top) node
// of an existing parse tree.
program: null,
// When `locations` is on, you can pass this to record the source
// file in every node's `loc` object.
sourceFile: null,
// This value, if given, is stored in every node, whether
// `locations` is on or off.
directSourceFile: null,
// When enabled, parenthesized expressions are represented by
// (non-standard) ParenthesizedExpression nodes
preserveParens: false,
plugins: {}
}
// Interpret and default an options object
export function getOptions(opts) {
let options = {}
for (let opt in defaultOptions)
options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]
if (isArray(options.onToken)) {
let tokens = options.onToken
options.onToken = (token) => tokens.push(token)
}
if (isArray(options.onComment))
options.onComment = pushComment(options, options.onComment)
return options
}
function pushComment(options, array) {
return function (block, text, start, end, startLoc, endLoc) {
let comment = {
type: block ? 'Block' : 'Line',
value: text,
start: start,
end: end
}
if (options.locations)
comment.loc = new SourceLocation(this, startLoc, endLoc)
if (options.ranges)
comment.range = [start, end]
array.push(comment)
}
}
``` | /content/code_sandbox/node_modules/acorn/src/options.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,220 |
```javascript
import {LooseParser} from "./state"
import {isDummy} from "./parseutil"
import {getLineInfo, tokTypes as tt} from ".."
const lp = LooseParser.prototype
lp.parseTopLevel = function() {
let node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0)
node.body = []
while (this.tok.type !== tt.eof) node.body.push(this.parseStatement())
this.last = this.tok
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType
}
return this.finishNode(node, "Program")
}
lp.parseStatement = function() {
let starttype = this.tok.type, node = this.startNode()
switch (starttype) {
case tt._break: case tt._continue:
this.next()
let isBreak = starttype === tt._break
if (this.semicolon() || this.canInsertSemicolon()) {
node.label = null
} else {
node.label = this.tok.type === tt.name ? this.parseIdent() : null
this.semicolon()
}
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
case tt._debugger:
this.next()
this.semicolon()
return this.finishNode(node, "DebuggerStatement")
case tt._do:
this.next()
node.body = this.parseStatement()
node.test = this.eat(tt._while) ? this.parseParenExpression() : this.dummyIdent()
this.semicolon()
return this.finishNode(node, "DoWhileStatement")
case tt._for:
this.next()
this.pushCx()
this.expect(tt.parenL)
if (this.tok.type === tt.semi) return this.parseFor(node, null)
if (this.tok.type === tt._var || this.tok.type === tt._let || this.tok.type === tt._const) {
let init = this.parseVar(true)
if (init.declarations.length === 1 && (this.tok.type === tt._in || this.isContextual("of"))) {
return this.parseForIn(node, init)
}
return this.parseFor(node, init)
}
let init = this.parseExpression(true)
if (this.tok.type === tt._in || this.isContextual("of"))
return this.parseForIn(node, this.toAssignable(init))
return this.parseFor(node, init)
case tt._function:
this.next()
return this.parseFunction(node, true)
case tt._if:
this.next()
node.test = this.parseParenExpression()
node.consequent = this.parseStatement()
node.alternate = this.eat(tt._else) ? this.parseStatement() : null
return this.finishNode(node, "IfStatement")
case tt._return:
this.next()
if (this.eat(tt.semi) || this.canInsertSemicolon()) node.argument = null
else { node.argument = this.parseExpression(); this.semicolon() }
return this.finishNode(node, "ReturnStatement")
case tt._switch:
let blockIndent = this.curIndent, line = this.curLineStart
this.next()
node.discriminant = this.parseParenExpression()
node.cases = []
this.pushCx()
this.expect(tt.braceL)
let cur
while (!this.closes(tt.braceR, blockIndent, line, true)) {
if (this.tok.type === tt._case || this.tok.type === tt._default) {
let isCase = this.tok.type === tt._case
if (cur) this.finishNode(cur, "SwitchCase")
node.cases.push(cur = this.startNode())
cur.consequent = []
this.next()
if (isCase) cur.test = this.parseExpression()
else cur.test = null
this.expect(tt.colon)
} else {
if (!cur) {
node.cases.push(cur = this.startNode())
cur.consequent = []
cur.test = null
}
cur.consequent.push(this.parseStatement())
}
}
if (cur) this.finishNode(cur, "SwitchCase")
this.popCx()
this.eat(tt.braceR)
return this.finishNode(node, "SwitchStatement")
case tt._throw:
this.next()
node.argument = this.parseExpression()
this.semicolon()
return this.finishNode(node, "ThrowStatement")
case tt._try:
this.next()
node.block = this.parseBlock()
node.handler = null
if (this.tok.type === tt._catch) {
let clause = this.startNode()
this.next()
this.expect(tt.parenL)
clause.param = this.toAssignable(this.parseExprAtom(), true)
this.expect(tt.parenR)
clause.guard = null
clause.body = this.parseBlock()
node.handler = this.finishNode(clause, "CatchClause")
}
node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null
if (!node.handler && !node.finalizer) return node.block
return this.finishNode(node, "TryStatement")
case tt._var:
case tt._let:
case tt._const:
return this.parseVar()
case tt._while:
this.next()
node.test = this.parseParenExpression()
node.body = this.parseStatement()
return this.finishNode(node, "WhileStatement")
case tt._with:
this.next()
node.object = this.parseParenExpression()
node.body = this.parseStatement()
return this.finishNode(node, "WithStatement")
case tt.braceL:
return this.parseBlock()
case tt.semi:
this.next()
return this.finishNode(node, "EmptyStatement")
case tt._class:
return this.parseClass(true)
case tt._import:
return this.parseImport()
case tt._export:
return this.parseExport()
default:
let expr = this.parseExpression()
if (isDummy(expr)) {
this.next()
if (this.tok.type === tt.eof) return this.finishNode(node, "EmptyStatement")
return this.parseStatement()
} else if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) {
node.body = this.parseStatement()
node.label = expr
return this.finishNode(node, "LabeledStatement")
} else {
node.expression = expr
this.semicolon()
return this.finishNode(node, "ExpressionStatement")
}
}
}
lp.parseBlock = function() {
let node = this.startNode()
this.pushCx()
this.expect(tt.braceL)
let blockIndent = this.curIndent, line = this.curLineStart
node.body = []
while (!this.closes(tt.braceR, blockIndent, line, true))
node.body.push(this.parseStatement())
this.popCx()
this.eat(tt.braceR)
return this.finishNode(node, "BlockStatement")
}
lp.parseFor = function(node, init) {
node.init = init
node.test = node.update = null
if (this.eat(tt.semi) && this.tok.type !== tt.semi) node.test = this.parseExpression()
if (this.eat(tt.semi) && this.tok.type !== tt.parenR) node.update = this.parseExpression()
this.popCx()
this.expect(tt.parenR)
node.body = this.parseStatement()
return this.finishNode(node, "ForStatement")
}
lp.parseForIn = function(node, init) {
let type = this.tok.type === tt._in ? "ForInStatement" : "ForOfStatement"
this.next()
node.left = init
node.right = this.parseExpression()
this.popCx()
this.expect(tt.parenR)
node.body = this.parseStatement()
return this.finishNode(node, type)
}
lp.parseVar = function(noIn) {
let node = this.startNode()
node.kind = this.tok.type.keyword
this.next()
node.declarations = []
do {
let decl = this.startNode()
decl.id = this.options.ecmaVersion >= 6 ? this.toAssignable(this.parseExprAtom(), true) : this.parseIdent()
decl.init = this.eat(tt.eq) ? this.parseMaybeAssign(noIn) : null
node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
} while (this.eat(tt.comma))
if (!node.declarations.length) {
let decl = this.startNode()
decl.id = this.dummyIdent()
node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
}
if (!noIn) this.semicolon()
return this.finishNode(node, "VariableDeclaration")
}
lp.parseClass = function(isStatement) {
let node = this.startNode()
this.next()
if (this.tok.type === tt.name) node.id = this.parseIdent()
else if (isStatement) node.id = this.dummyIdent()
else node.id = null
node.superClass = this.eat(tt._extends) ? this.parseExpression() : null
node.body = this.startNode()
node.body.body = []
this.pushCx()
let indent = this.curIndent + 1, line = this.curLineStart
this.eat(tt.braceL)
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart }
while (!this.closes(tt.braceR, indent, line)) {
if (this.semicolon()) continue
let method = this.startNode(), isGenerator
if (this.options.ecmaVersion >= 6) {
method.static = false
isGenerator = this.eat(tt.star)
}
this.parsePropertyName(method)
if (isDummy(method.key)) { if (isDummy(this.parseMaybeAssign())) this.next(); this.eat(tt.comma); continue }
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
(this.tok.type != tt.parenL && this.tok.type != tt.braceL)) {
method.static = true
isGenerator = this.eat(tt.star)
this.parsePropertyName(method)
} else {
method.static = false
}
if (this.options.ecmaVersion >= 5 && method.key.type === "Identifier" &&
!method.computed && (method.key.name === "get" || method.key.name === "set") &&
this.tok.type !== tt.parenL && this.tok.type !== tt.braceL) {
method.kind = method.key.name
this.parsePropertyName(method)
method.value = this.parseMethod(false)
} else {
if (!method.computed && !method.static && !isGenerator && (
method.key.type === "Identifier" && method.key.name === "constructor" ||
method.key.type === "Literal" && method.key.value === "constructor")) {
method.kind = "constructor"
} else {
method.kind = "method"
}
method.value = this.parseMethod(isGenerator)
}
node.body.body.push(this.finishNode(method, "MethodDefinition"))
}
this.popCx()
if (!this.eat(tt.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start
if (this.options.locations) this.last.loc.end = this.tok.loc.start
}
this.semicolon()
this.finishNode(node.body, "ClassBody")
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
}
lp.parseFunction = function(node, isStatement) {
this.initFunction(node)
if (this.options.ecmaVersion >= 6) {
node.generator = this.eat(tt.star)
}
if (this.tok.type === tt.name) node.id = this.parseIdent()
else if (isStatement) node.id = this.dummyIdent()
node.params = this.parseFunctionParams()
node.body = this.parseBlock()
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
}
lp.parseExport = function() {
let node = this.startNode()
this.next()
if (this.eat(tt.star)) {
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
return this.finishNode(node, "ExportAllDeclaration")
}
if (this.eat(tt._default)) {
let expr = this.parseMaybeAssign()
if (expr.id) {
switch (expr.type) {
case "FunctionExpression": expr.type = "FunctionDeclaration"; break
case "ClassExpression": expr.type = "ClassDeclaration"; break
}
}
node.declaration = expr
this.semicolon()
return this.finishNode(node, "ExportDefaultDeclaration")
}
if (this.tok.type.keyword) {
node.declaration = this.parseStatement()
node.specifiers = []
node.source = null
} else {
node.declaration = null
node.specifiers = this.parseExportSpecifierList()
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
this.semicolon()
}
return this.finishNode(node, "ExportNamedDeclaration")
}
lp.parseImport = function() {
let node = this.startNode()
this.next()
if (this.tok.type === tt.string) {
node.specifiers = []
node.source = this.parseExprAtom()
node.kind = ''
} else {
let elt
if (this.tok.type === tt.name && this.tok.value !== "from") {
elt = this.startNode()
elt.local = this.parseIdent()
this.finishNode(elt, "ImportDefaultSpecifier")
this.eat(tt.comma)
}
node.specifiers = this.parseImportSpecifierList()
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
if (elt) node.specifiers.unshift(elt)
}
this.semicolon()
return this.finishNode(node, "ImportDeclaration")
}
lp.parseImportSpecifierList = function() {
let elts = []
if (this.tok.type === tt.star) {
let elt = this.startNode()
this.next()
if (this.eatContextual("as")) elt.local = this.parseIdent()
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"))
} else {
let indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart
this.pushCx()
this.eat(tt.braceL)
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart
while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
let elt = this.startNode()
if (this.eat(tt.star)) {
if (this.eatContextual("as")) elt.local = this.parseIdent()
this.finishNode(elt, "ImportNamespaceSpecifier")
} else {
if (this.isContextual("from")) break
elt.imported = this.parseIdent()
elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported
this.finishNode(elt, "ImportSpecifier")
}
elts.push(elt)
this.eat(tt.comma)
}
this.eat(tt.braceR)
this.popCx()
}
return elts
}
lp.parseExportSpecifierList = function() {
let elts = []
let indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart
this.pushCx()
this.eat(tt.braceL)
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart
while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
if (this.isContextual("from")) break
let elt = this.startNode()
elt.local = this.parseIdent()
elt.exported = this.eatContextual("as") ? this.parseIdent() : elt.local
this.finishNode(elt, "ExportSpecifier")
elts.push(elt)
this.eat(tt.comma)
}
this.eat(tt.braceR)
this.popCx()
return elts
}
``` | /content/code_sandbox/node_modules/acorn/src/loose/statement.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 3,634 |
```javascript
import {LooseParser} from "./state"
import {isDummy} from "./parseutil"
import {tokTypes as tt} from ".."
const lp = LooseParser.prototype
lp.checkLVal = function(expr, binding) {
if (!expr) return expr
switch (expr.type) {
case "Identifier":
return expr
case "MemberExpression":
return binding ? this.dummyIdent() : expr
case "ParenthesizedExpression":
expr.expression = this.checkLVal(expr.expression, binding)
return expr
// FIXME recursively check contents
case "ObjectPattern":
case "ArrayPattern":
case "RestElement":
case "AssignmentPattern":
if (this.options.ecmaVersion >= 6) return expr
default:
return this.dummyIdent()
}
}
lp.parseExpression = function(noIn) {
let start = this.storeCurrentPos()
let expr = this.parseMaybeAssign(noIn)
if (this.tok.type === tt.comma) {
let node = this.startNodeAt(start)
node.expressions = [expr]
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn))
return this.finishNode(node, "SequenceExpression")
}
return expr
}
lp.parseParenExpression = function() {
this.pushCx()
this.expect(tt.parenL)
let val = this.parseExpression()
this.popCx()
this.expect(tt.parenR)
return val
}
lp.parseMaybeAssign = function(noIn) {
let start = this.storeCurrentPos()
let left = this.parseMaybeConditional(noIn)
if (this.tok.type.isAssign) {
let node = this.startNodeAt(start)
node.operator = this.tok.value
node.left = this.tok.type === tt.eq ? this.toAssignable(left) : this.checkLVal(left)
this.next()
node.right = this.parseMaybeAssign(noIn)
return this.finishNode(node, "AssignmentExpression")
}
return left
}
lp.parseMaybeConditional = function(noIn) {
let start = this.storeCurrentPos()
let expr = this.parseExprOps(noIn)
if (this.eat(tt.question)) {
let node = this.startNodeAt(start)
node.test = expr
node.consequent = this.parseMaybeAssign()
node.alternate = this.expect(tt.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent()
return this.finishNode(node, "ConditionalExpression")
}
return expr
}
lp.parseExprOps = function(noIn) {
let start = this.storeCurrentPos()
let indent = this.curIndent, line = this.curLineStart
return this.parseExprOp(this.parseMaybeUnary(noIn), start, -1, noIn, indent, line)
}
lp.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) return left
let prec = this.tok.type.binop
if (prec != null && (!noIn || this.tok.type !== tt._in)) {
if (prec > minPrec) {
let node = this.startNodeAt(start)
node.left = left
node.operator = this.tok.value
this.next()
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) {
node.right = this.dummyIdent()
} else {
let rightStart = this.storeCurrentPos()
node.right = this.parseExprOp(this.parseMaybeUnary(noIn), rightStart, prec, noIn, indent, line)
}
this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression")
return this.parseExprOp(node, start, minPrec, noIn, indent, line)
}
}
return left
}
lp.parseMaybeUnary = function(noIn) {
if (this.tok.type.prefix) {
let node = this.startNode(), update = this.tok.type === tt.incDec
node.operator = this.tok.value
node.prefix = true
this.next()
node.argument = this.parseMaybeUnary(noIn)
if (update) node.argument = this.checkLVal(node.argument)
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
} else if (this.tok.type === tt.ellipsis) {
let node = this.startNode()
this.next()
node.argument = this.parseMaybeUnary(noIn)
return this.finishNode(node, "SpreadElement")
}
let start = this.storeCurrentPos()
let expr = this.parseExprSubscripts()
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
let node = this.startNodeAt(start)
node.operator = this.tok.value
node.prefix = false
node.argument = this.checkLVal(expr)
this.next()
expr = this.finishNode(node, "UpdateExpression")
}
return expr
}
lp.parseExprSubscripts = function() {
let start = this.storeCurrentPos()
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart)
}
lp.parseSubscripts = function(base, start, noCalls, startIndent, line) {
for (;;) {
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) {
if (this.tok.type == tt.dot && this.curIndent == startIndent)
--startIndent
else
return base
}
if (this.eat(tt.dot)) {
let node = this.startNodeAt(start)
node.object = base
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine())
node.property = this.dummyIdent()
else
node.property = this.parsePropertyAccessor() || this.dummyIdent()
node.computed = false
base = this.finishNode(node, "MemberExpression")
} else if (this.tok.type == tt.bracketL) {
this.pushCx()
this.next()
let node = this.startNodeAt(start)
node.object = base
node.property = this.parseExpression()
node.computed = true
this.popCx()
this.expect(tt.bracketR)
base = this.finishNode(node, "MemberExpression")
} else if (!noCalls && this.tok.type == tt.parenL) {
let node = this.startNodeAt(start)
node.callee = base
node.arguments = this.parseExprList(tt.parenR)
base = this.finishNode(node, "CallExpression")
} else if (this.tok.type == tt.backQuote) {
let node = this.startNodeAt(start)
node.tag = base
node.quasi = this.parseTemplate()
base = this.finishNode(node, "TaggedTemplateExpression")
} else {
return base
}
}
}
lp.parseExprAtom = function() {
let node
switch (this.tok.type) {
case tt._this:
case tt._super:
let type = this.tok.type === tt._this ? "ThisExpression" : "Super"
node = this.startNode()
this.next()
return this.finishNode(node, type)
case tt.name:
let start = this.storeCurrentPos()
let id = this.parseIdent()
return this.eat(tt.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id]) : id
case tt.regexp:
node = this.startNode()
let val = this.tok.value
node.regex = {pattern: val.pattern, flags: val.flags}
node.value = val.value
node.raw = this.input.slice(this.tok.start, this.tok.end)
this.next()
return this.finishNode(node, "Literal")
case tt.num: case tt.string:
node = this.startNode()
node.value = this.tok.value
node.raw = this.input.slice(this.tok.start, this.tok.end)
this.next()
return this.finishNode(node, "Literal")
case tt._null: case tt._true: case tt._false:
node = this.startNode()
node.value = this.tok.type === tt._null ? null : this.tok.type === tt._true
node.raw = this.tok.type.keyword
this.next()
return this.finishNode(node, "Literal")
case tt.parenL:
let parenStart = this.storeCurrentPos()
this.next()
let inner = this.parseExpression()
this.expect(tt.parenR)
if (this.eat(tt.arrow)) {
return this.parseArrowExpression(this.startNodeAt(parenStart), inner.expressions || (isDummy(inner) ? [] : [inner]))
}
if (this.options.preserveParens) {
let par = this.startNodeAt(parenStart)
par.expression = inner
inner = this.finishNode(par, "ParenthesizedExpression")
}
return inner
case tt.bracketL:
node = this.startNode()
node.elements = this.parseExprList(tt.bracketR, true)
return this.finishNode(node, "ArrayExpression")
case tt.braceL:
return this.parseObj()
case tt._class:
return this.parseClass()
case tt._function:
node = this.startNode()
this.next()
return this.parseFunction(node, false)
case tt._new:
return this.parseNew()
case tt._yield:
node = this.startNode()
this.next()
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type != tt.star && !this.tok.type.startsExpr)) {
node.delegate = false
node.argument = null
} else {
node.delegate = this.eat(tt.star)
node.argument = this.parseMaybeAssign()
}
return this.finishNode(node, "YieldExpression")
case tt.backQuote:
return this.parseTemplate()
default:
return this.dummyIdent()
}
}
lp.parseNew = function() {
let node = this.startNode(), startIndent = this.curIndent, line = this.curLineStart
let meta = this.parseIdent(true)
if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
node.meta = meta
node.property = this.parseIdent(true)
return this.finishNode(node, "MetaProperty")
}
let start = this.storeCurrentPos()
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line)
if (this.tok.type == tt.parenL) {
node.arguments = this.parseExprList(tt.parenR)
} else {
node.arguments = []
}
return this.finishNode(node, "NewExpression")
}
lp.parseTemplateElement = function() {
let elem = this.startNode()
elem.value = {
raw: this.input.slice(this.tok.start, this.tok.end),
cooked: this.tok.value
}
this.next()
elem.tail = this.tok.type === tt.backQuote
return this.finishNode(elem, "TemplateElement")
}
lp.parseTemplate = function() {
let node = this.startNode()
this.next()
node.expressions = []
let curElt = this.parseTemplateElement()
node.quasis = [curElt]
while (!curElt.tail) {
this.next()
node.expressions.push(this.parseExpression())
if (this.expect(tt.braceR)) {
curElt = this.parseTemplateElement()
} else {
curElt = this.startNode()
curElt.value = {cooked: '', raw: ''}
curElt.tail = true
}
node.quasis.push(curElt)
}
this.expect(tt.backQuote)
return this.finishNode(node, "TemplateLiteral")
}
lp.parseObj = function() {
let node = this.startNode()
node.properties = []
this.pushCx()
let indent = this.curIndent + 1, line = this.curLineStart
this.eat(tt.braceL)
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart }
while (!this.closes(tt.braceR, indent, line)) {
let prop = this.startNode(), isGenerator, start
if (this.options.ecmaVersion >= 6) {
start = this.storeCurrentPos()
prop.method = false
prop.shorthand = false
isGenerator = this.eat(tt.star)
}
this.parsePropertyName(prop)
if (isDummy(prop.key)) { if (isDummy(this.parseMaybeAssign())) this.next(); this.eat(tt.comma); continue }
if (this.eat(tt.colon)) {
prop.kind = "init"
prop.value = this.parseMaybeAssign()
} else if (this.options.ecmaVersion >= 6 && (this.tok.type === tt.parenL || this.tok.type === tt.braceL)) {
prop.kind = "init"
prop.method = true
prop.value = this.parseMethod(isGenerator)
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
(this.tok.type != tt.comma && this.tok.type != tt.braceR)) {
prop.kind = prop.key.name
this.parsePropertyName(prop)
prop.value = this.parseMethod(false)
} else {
prop.kind = "init"
if (this.options.ecmaVersion >= 6) {
if (this.eat(tt.eq)) {
let assign = this.startNodeAt(start)
assign.operator = "="
assign.left = prop.key
assign.right = this.parseMaybeAssign()
prop.value = this.finishNode(assign, "AssignmentExpression")
} else {
prop.value = prop.key
}
} else {
prop.value = this.dummyIdent()
}
prop.shorthand = true
}
node.properties.push(this.finishNode(prop, "Property"))
this.eat(tt.comma)
}
this.popCx()
if (!this.eat(tt.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start
if (this.options.locations) this.last.loc.end = this.tok.loc.start
}
return this.finishNode(node, "ObjectExpression")
}
lp.parsePropertyName = function(prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(tt.bracketL)) {
prop.computed = true
prop.key = this.parseExpression()
this.expect(tt.bracketR)
return
} else {
prop.computed = false
}
}
let key = (this.tok.type === tt.num || this.tok.type === tt.string) ? this.parseExprAtom() : this.parseIdent()
prop.key = key || this.dummyIdent()
}
lp.parsePropertyAccessor = function() {
if (this.tok.type === tt.name || this.tok.type.keyword) return this.parseIdent()
}
lp.parseIdent = function() {
let name = this.tok.type === tt.name ? this.tok.value : this.tok.type.keyword
if (!name) return this.dummyIdent()
let node = this.startNode()
this.next()
node.name = name
return this.finishNode(node, "Identifier")
}
lp.initFunction = function(node) {
node.id = null
node.params = []
if (this.options.ecmaVersion >= 6) {
node.generator = false
node.expression = false
}
}
// Convert existing expression atom to assignable pattern
// if possible.
lp.toAssignable = function(node, binding) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "ObjectExpression":
node.type = "ObjectPattern"
let props = node.properties
for (let i = 0; i < props.length; i++)
this.toAssignable(props[i].value, binding)
break
case "ArrayExpression":
node.type = "ArrayPattern"
this.toAssignableList(node.elements, binding)
break
case "SpreadElement":
node.type = "RestElement"
node.argument = this.toAssignable(node.argument, binding)
break
case "AssignmentExpression":
node.type = "AssignmentPattern"
break
}
}
return this.checkLVal(node, binding)
}
lp.toAssignableList = function(exprList, binding) {
for (let i = 0; i < exprList.length; i++)
exprList[i] = this.toAssignable(exprList[i], binding)
return exprList
}
lp.parseFunctionParams = function(params) {
params = this.parseExprList(tt.parenR)
return this.toAssignableList(params, true)
}
lp.parseMethod = function(isGenerator) {
let node = this.startNode()
this.initFunction(node)
node.params = this.parseFunctionParams()
node.generator = isGenerator || false
node.expression = this.options.ecmaVersion >= 6 && this.tok.type !== tt.braceL
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock()
return this.finishNode(node, "FunctionExpression")
}
lp.parseArrowExpression = function(node, params) {
this.initFunction(node)
node.params = this.toAssignableList(params, true)
node.expression = this.tok.type !== tt.braceL
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock()
return this.finishNode(node, "ArrowFunctionExpression")
}
lp.parseExprList = function(close, allowEmpty) {
this.pushCx()
let indent = this.curIndent, line = this.curLineStart, elts = []
this.next(); // Opening bracket
while (!this.closes(close, indent + 1, line)) {
if (this.eat(tt.comma)) {
elts.push(allowEmpty ? null : this.dummyIdent())
continue
}
let elt = this.parseMaybeAssign()
if (isDummy(elt)) {
if (this.closes(close, indent, line)) break
this.next()
} else {
elts.push(elt)
}
this.eat(tt.comma)
}
this.popCx()
if (!this.eat(close)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start
if (this.options.locations) this.last.loc.end = this.tok.loc.start
}
return elts
}
``` | /content/code_sandbox/node_modules/acorn/src/loose/expression.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 4,126 |
```javascript
import {LooseParser} from "./state"
import {Node, SourceLocation, lineBreak, isNewLine, tokTypes as tt} from ".."
const lp = LooseParser.prototype
lp.startNode = function() {
let node = new Node
node.start = this.tok.start
if (this.options.locations)
node.loc = new SourceLocation(this.toks, this.tok.loc.start)
if (this.options.directSourceFile)
node.sourceFile = this.options.directSourceFile
if (this.options.ranges)
node.range = [this.tok.start, 0]
return node
}
lp.storeCurrentPos = function() {
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
}
lp.startNodeAt = function(pos) {
let node = new Node
if (this.options.locations) {
node.start = pos[0]
node.loc = new SourceLocation(this.toks, pos[1])
pos = pos[0]
} else {
node.start = pos
}
if (this.options.directSourceFile)
node.sourceFile = this.options.directSourceFile
if (this.options.ranges)
node.range = [pos, 0]
return node
}
lp.finishNode = function(node, type) {
node.type = type
node.end = this.last.end
if (this.options.locations)
node.loc.end = this.last.loc.end
if (this.options.ranges)
node.range[1] = this.last.end
return node
}
lp.dummyIdent = function() {
let dummy = this.startNode()
dummy.name = ""
return this.finishNode(dummy, "Identifier")
}
export function isDummy(node) { return node.name == "" }
lp.eat = function(type) {
if (this.tok.type === type) {
this.next()
return true
} else {
return false
}
}
lp.isContextual = function(name) {
return this.tok.type === tt.name && this.tok.value === name
}
lp.eatContextual = function(name) {
return this.tok.value === name && this.eat(tt.name)
}
lp.canInsertSemicolon = function() {
return this.tok.type === tt.eof || this.tok.type === tt.braceR ||
lineBreak.test(this.input.slice(this.last.end, this.tok.start))
}
lp.semicolon = function() {
return this.eat(tt.semi)
}
lp.expect = function(type) {
if (this.eat(type)) return true
for (let i = 1; i <= 2; i++) {
if (this.lookAhead(i).type == type) {
for (let j = 0; j < i; j++) this.next()
return true
}
}
}
lp.pushCx = function() {
this.context.push(this.curIndent)
}
lp.popCx = function() {
this.curIndent = this.context.pop()
}
lp.lineEnd = function(pos) {
while (pos < this.input.length && !isNewLine(this.input.charCodeAt(pos))) ++pos
return pos
}
lp.indentationAfter = function(pos) {
for (let count = 0;; ++pos) {
let ch = this.input.charCodeAt(pos)
if (ch === 32) ++count
else if (ch === 9) count += this.options.tabSize
else return count
}
}
lp.closes = function(closeTok, indent, line, blockHeuristic) {
if (this.tok.type === closeTok || this.tok.type === tt.eof) return true
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
(!blockHeuristic || this.nextLineStart >= this.input.length ||
this.indentationAfter(this.nextLineStart) < indent)
}
lp.tokenStartsLine = function() {
for (let p = this.tok.start - 1; p >= this.curLineStart; --p) {
let ch = this.input.charCodeAt(p)
if (ch !== 9 && ch !== 32) return false
}
return true
}
``` | /content/code_sandbox/node_modules/acorn/src/loose/parseutil.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 901 |
```javascript
import {tokenizer, SourceLocation, tokTypes as tt} from ".."
export function LooseParser(input, options) {
this.toks = tokenizer(input, options)
this.options = this.toks.options
this.input = this.toks.input
this.tok = this.last = {type: tt.eof, start: 0, end: 0}
if (this.options.locations) {
let here = this.toks.curPosition()
this.tok.loc = new SourceLocation(this.toks, here, here)
}
this.ahead = []; // Tokens ahead
this.context = []; // Indentation contexted
this.curIndent = 0
this.curLineStart = 0
this.nextLineStart = this.lineEnd(this.curLineStart) + 1
}
``` | /content/code_sandbox/node_modules/acorn/src/loose/state.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 171 |
```javascript
import {tokTypes as tt, Token, isNewLine, SourceLocation, getLineInfo, lineBreakG} from ".."
import {LooseParser} from "./state"
const lp = LooseParser.prototype
function isSpace(ch) {
return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || isNewLine(ch)
}
lp.next = function() {
this.last = this.tok
if (this.ahead.length)
this.tok = this.ahead.shift()
else
this.tok = this.readToken()
if (this.tok.start >= this.nextLineStart) {
while (this.tok.start >= this.nextLineStart) {
this.curLineStart = this.nextLineStart
this.nextLineStart = this.lineEnd(this.curLineStart) + 1
}
this.curIndent = this.indentationAfter(this.curLineStart)
}
}
lp.readToken = function() {
for (;;) {
try {
this.toks.next()
if (this.toks.type === tt.dot &&
this.input.substr(this.toks.end, 1) === "." &&
this.options.ecmaVersion >= 6) {
this.toks.end++
this.toks.type = tt.ellipsis
}
return new Token(this.toks)
} catch(e) {
if (!(e instanceof SyntaxError)) throw e
// Try to skip some text, based on the error message, and then continue
let msg = e.message, pos = e.raisedAt, replace = true
if (/unterminated/i.test(msg)) {
pos = this.lineEnd(e.pos + 1)
if (/string/.test(msg)) {
replace = {start: e.pos, end: pos, type: tt.string, value: this.input.slice(e.pos + 1, pos)}
} else if (/regular expr/i.test(msg)) {
let re = this.input.slice(e.pos, pos)
try { re = new RegExp(re) } catch(e) {}
replace = {start: e.pos, end: pos, type: tt.regexp, value: re}
} else if (/template/.test(msg)) {
replace = {start: e.pos, end: pos,
type: tt.template,
value: this.input.slice(e.pos, pos)}
} else {
replace = false
}
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos
} else if (/character escape|expected hexadecimal/i.test(msg)) {
while (pos < this.input.length) {
let ch = this.input.charCodeAt(pos++)
if (ch === 34 || ch === 39 || isNewLine(ch)) break
}
} else if (/unexpected character/i.test(msg)) {
pos++
replace = false
} else if (/regular expression/i.test(msg)) {
replace = true
} else {
throw e
}
this.resetTo(pos)
if (replace === true) replace = {start: pos, end: pos, type: tt.name, value: ""}
if (replace) {
if (this.options.locations)
replace.loc = new SourceLocation(
this.toks,
getLineInfo(this.input, replace.start),
getLineInfo(this.input, replace.end))
return replace
}
}
}
}
lp.resetTo = function(pos) {
this.toks.pos = pos
let ch = this.input.charAt(pos - 1)
this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) ||
/[enwfd]/.test(ch) &&
/\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos))
if (this.options.locations) {
this.toks.curLine = 1
this.toks.lineStart = lineBreakG.lastIndex = 0
let match
while ((match = lineBreakG.exec(this.input)) && match.index < pos) {
++this.toks.curLine
this.toks.lineStart = match.index + match[0].length
}
}
}
lp.lookAhead = function(n) {
while (n > this.ahead.length)
this.ahead.push(this.readToken())
return this.ahead[n - 1]
}
``` | /content/code_sandbox/node_modules/acorn/src/loose/tokenize.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 992 |
```shell
node bin/build-acorn.js
node bin/without_eval > dist/acorn_csp.js
``` | /content/code_sandbox/node_modules/acorn/bin/prepublish.sh | shell | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 21 |
```javascript
// Note: run `npm install unicode-7.0.0` first.
// Which Unicode version should be used?
var version = '7.0.0';
var start = require('unicode-' + version + '/properties/ID_Start/code-points')
.filter(function(ch) { return ch > 127; });
var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/properties/ID_Continue/code-points')
.filter(function(ch) { return ch > 127 && start.indexOf(ch) == -1; }));
function pad(str, width) {
while (str.length < width) str = "0" + str;
return str;
}
function esc(code) {
var hex = code.toString(16);
if (hex.length <= 2) return "\\x" + pad(hex, 2);
else return "\\u" + pad(hex, 4);
}
function generate(chars) {
var astral = [], re = "";
for (var i = 0, at = 0x10000; i < chars.length; i++) {
var from = chars[i], to = from;
while (i < chars.length - 1 && chars[i + 1] == to + 1) {
i++;
to++;
}
if (to <= 0xffff) {
if (from == to) re += esc(from);
else if (from + 1 == to) re += esc(from) + esc(to);
else re += esc(from) + "-" + esc(to);
} else {
astral.push(from - at, to - from);
at = to;
}
}
return {nonASCII: re, astral: astral};
}
var startData = generate(start), contData = generate(cont);
console.log(" var nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\";");
console.log(" var nonASCIIidentifierChars = \"" + contData.nonASCII + "\";");
console.log(" var astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";");
console.log(" var astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";");
``` | /content/code_sandbox/node_modules/acorn/bin/generate-identifier-regex.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 472 |
```shell
# Combine existing list of authors with everyone known in git, sort, add header.
tail --lines=+3 AUTHORS > AUTHORS.tmp
git log --format='%aN' | grep -v abraidwood >> AUTHORS.tmp
echo -e "List of Acorn contributors. Updated before every release.\n" > AUTHORS
sort -u AUTHORS.tmp >> AUTHORS
rm -f AUTHORS.tmp
``` | /content/code_sandbox/node_modules/acorn/bin/update_authors.sh | shell | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 81 |
```javascript
// AST walker module for Mozilla Parser API compatible trees
// A simple walk is one where you simply specify callbacks to be
// called on specific nodes. The last two arguments are optional. A
// simple use would be
//
// walk.simple(myTree, {
// Expression: function(node) { ... }
// });
//
// to do something with all expressions. All Parser API node types
// can be used to identify node types, as well as Expression,
// Statement, and ScopeBody, which denote categories of nodes.
//
// The base argument can be used to pass a custom (recursive)
// walker, and state can be used to give this walked an initial
// state.
export function simple(node, visitors, base, state) {
if (!base) base = exports.base
;(function c(node, st, override) {
let type = override || node.type, found = visitors[type]
base[type](node, st, c)
if (found) found(node, st)
})(node, state)
}
// An ancestor walk builds up an array of ancestor nodes (including
// the current node) and passes them to the callback as the state parameter.
export function ancestor(node, visitors, base, state) {
if (!base) base = exports.base
if (!state) state = []
;(function c(node, st, override) {
let type = override || node.type, found = visitors[type]
if (node != st[st.length - 1]) {
st = st.slice()
st.push(node)
}
base[type](node, st, c)
if (found) found(node, st)
})(node, state)
}
// A recursive walk is one where your functions override the default
// walkers. They can modify and replace the state parameter that's
// threaded through the walk, and can opt how and whether to walk
// their child nodes (by calling their third argument on these
// nodes).
export function recursive(node, state, funcs, base) {
let visitor = funcs ? exports.make(funcs, base) : base
;(function c(node, st, override) {
visitor[override || node.type](node, st, c)
})(node, state)
}
function makeTest(test) {
if (typeof test == "string")
return type => type == test
else if (!test)
return () => true
else
return test
}
class Found {
constructor(node, state) { this.node = node; this.state = state }
}
// Find a node with a given start, end, and type (all are optional,
// null can be used as wildcard). Returns a {node, state} object, or
// undefined when it doesn't find a matching node.
export function findNodeAt(node, start, end, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
try {
;(function c(node, st, override) {
let type = override || node.type
if ((start == null || node.start <= start) &&
(end == null || node.end >= end))
base[type](node, st, c)
if (test(type, node) &&
(start == null || node.start == start) &&
(end == null || node.end == end))
throw new Found(node, st)
})(node, state)
} catch (e) {
if (e instanceof Found) return e
throw e
}
}
// Find the innermost node of a given type that contains the given
// position. Interface similar to findNodeAt.
export function findNodeAround(node, pos, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
try {
;(function c(node, st, override) {
let type = override || node.type
if (node.start > pos || node.end < pos) return
base[type](node, st, c)
if (test(type, node)) throw new Found(node, st)
})(node, state)
} catch (e) {
if (e instanceof Found) return e
throw e
}
}
// Find the outermost matching node after a given position.
export function findNodeAfter(node, pos, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
try {
;(function c(node, st, override) {
if (node.end < pos) return
let type = override || node.type
if (node.start >= pos && test(type, node)) throw new Found(node, st)
base[type](node, st, c)
})(node, state)
} catch (e) {
if (e instanceof Found) return e
throw e
}
}
// Find the outermost matching node before a given position.
export function findNodeBefore(node, pos, test, base, state) {
test = makeTest(test)
if (!base) base = exports.base
let max
;(function c(node, st, override) {
if (node.start > pos) return
let type = override || node.type
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
max = new Found(node, st)
base[type](node, st, c)
})(node, state)
return max
}
// Used to create a custom walker. Will fill in all missing node
// type properties with the defaults.
export function make(funcs, base) {
if (!base) base = exports.base
let visitor = {}
for (var type in base) visitor[type] = base[type]
for (var type in funcs) visitor[type] = funcs[type]
return visitor
}
function skipThrough(node, st, c) { c(node, st) }
function ignore(_node, _st, _c) {}
// Node walkers.
export const base = {}
base.Program = base.BlockStatement = (node, st, c) => {
for (let i = 0; i < node.body.length; ++i)
c(node.body[i], st, "Statement")
}
base.Statement = skipThrough
base.EmptyStatement = ignore
base.ExpressionStatement = base.ParenthesizedExpression =
(node, st, c) => c(node.expression, st, "Expression")
base.IfStatement = (node, st, c) => {
c(node.test, st, "Expression")
c(node.consequent, st, "Statement")
if (node.alternate) c(node.alternate, st, "Statement")
}
base.LabeledStatement = (node, st, c) => c(node.body, st, "Statement")
base.BreakStatement = base.ContinueStatement = ignore
base.WithStatement = (node, st, c) => {
c(node.object, st, "Expression")
c(node.body, st, "Statement")
}
base.SwitchStatement = (node, st, c) => {
c(node.discriminant, st, "Expression")
for (let i = 0; i < node.cases.length; ++i) {
let cs = node.cases[i]
if (cs.test) c(cs.test, st, "Expression")
for (let j = 0; j < cs.consequent.length; ++j)
c(cs.consequent[j], st, "Statement")
}
}
base.ReturnStatement = base.YieldExpression = (node, st, c) => {
if (node.argument) c(node.argument, st, "Expression")
}
base.ThrowStatement = base.SpreadElement = base.RestElement =
(node, st, c) => c(node.argument, st, "Expression")
base.TryStatement = (node, st, c) => {
c(node.block, st, "Statement")
if (node.handler) c(node.handler.body, st, "ScopeBody")
if (node.finalizer) c(node.finalizer, st, "Statement")
}
base.WhileStatement = base.DoWhileStatement = (node, st, c) => {
c(node.test, st, "Expression")
c(node.body, st, "Statement")
}
base.ForStatement = (node, st, c) => {
if (node.init) c(node.init, st, "ForInit")
if (node.test) c(node.test, st, "Expression")
if (node.update) c(node.update, st, "Expression")
c(node.body, st, "Statement")
}
base.ForInStatement = base.ForOfStatement = (node, st, c) => {
c(node.left, st, "ForInit")
c(node.right, st, "Expression")
c(node.body, st, "Statement")
}
base.ForInit = (node, st, c) => {
if (node.type == "VariableDeclaration") c(node, st)
else c(node, st, "Expression")
}
base.DebuggerStatement = ignore
base.FunctionDeclaration = (node, st, c) => c(node, st, "Function")
base.VariableDeclaration = (node, st, c) => {
for (let i = 0; i < node.declarations.length; ++i) {
let decl = node.declarations[i]
if (decl.init) c(decl.init, st, "Expression")
}
}
base.Function = (node, st, c) => c(node.body, st, "ScopeBody")
base.ScopeBody = (node, st, c) => c(node, st, "Statement")
base.Expression = skipThrough
base.ThisExpression = base.Super = base.MetaProperty = ignore
base.ArrayExpression = base.ArrayPattern = (node, st, c) => {
for (let i = 0; i < node.elements.length; ++i) {
let elt = node.elements[i]
if (elt) c(elt, st, "Expression")
}
}
base.ObjectExpression = base.ObjectPattern = (node, st, c) => {
for (let i = 0; i < node.properties.length; ++i)
c(node.properties[i], st)
}
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration
base.SequenceExpression = base.TemplateLiteral = (node, st, c) => {
for (let i = 0; i < node.expressions.length; ++i)
c(node.expressions[i], st, "Expression")
}
base.UnaryExpression = base.UpdateExpression = (node, st, c) => {
c(node.argument, st, "Expression")
}
base.BinaryExpression = base.AssignmentExpression = base.AssignmentPattern = base.LogicalExpression = (node, st, c) => {
c(node.left, st, "Expression")
c(node.right, st, "Expression")
}
base.ConditionalExpression = (node, st, c) => {
c(node.test, st, "Expression")
c(node.consequent, st, "Expression")
c(node.alternate, st, "Expression")
}
base.NewExpression = base.CallExpression = (node, st, c) => {
c(node.callee, st, "Expression")
if (node.arguments) for (let i = 0; i < node.arguments.length; ++i)
c(node.arguments[i], st, "Expression")
}
base.MemberExpression = (node, st, c) => {
c(node.object, st, "Expression")
if (node.computed) c(node.property, st, "Expression")
}
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = (node, st, c) => c(node.declaration, st)
base.ImportDeclaration = (node, st, c) => {
for (let i = 0; i < node.specifiers.length; i++)
c(node.specifiers[i], st)
}
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore
base.TaggedTemplateExpression = (node, st, c) => {
c(node.tag, st, "Expression")
c(node.quasi, st)
}
base.ClassDeclaration = base.ClassExpression = (node, st, c) => {
if (node.superClass) c(node.superClass, st, "Expression")
for (let i = 0; i < node.body.body.length; i++)
c(node.body.body[i], st)
}
base.MethodDefinition = base.Property = (node, st, c) => {
if (node.computed) c(node.key, st, "Expression")
c(node.value, st, "Expression")
}
base.ComprehensionExpression = (node, st, c) => {
for (let i = 0; i < node.blocks.length; i++)
c(node.blocks[i].right, st, "Expression")
c(node.body, st, "Expression")
}
``` | /content/code_sandbox/node_modules/acorn/src/walk/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,760 |
```javascript
var fs = require("fs"), path = require("path")
var stream = require("stream")
var browserify = require("browserify")
var babelify = require("babelify").configure({loose: "all"})
process.chdir(path.resolve(__dirname, ".."))
browserify({standalone: "acorn"})
.plugin(require('browserify-derequire'))
.transform(babelify)
.require("./src/index.js", {entry: true})
.bundle()
.on("error", function (err) { console.log("Error: " + err.message) })
.pipe(fs.createWriteStream("dist/acorn.js"))
function acornShim(file) {
var tr = new stream.Transform
if (file == path.resolve(__dirname, "../src/index.js")) {
var sent = false
tr._transform = function(chunk, _, callback) {
if (!sent) {
sent = true
callback(null, "module.exports = typeof acorn != 'undefined' ? acorn : _dereq_(\"./acorn\")")
} else {
callback()
}
}
} else {
tr._transform = function(chunk, _, callback) { callback(null, chunk) }
}
return tr
}
browserify({standalone: "acorn.loose"})
.plugin(require('browserify-derequire'))
.transform(acornShim)
.transform(babelify)
.require("./src/loose/index.js", {entry: true})
.bundle()
.on("error", function (err) { console.log("Error: " + err.message) })
.pipe(fs.createWriteStream("dist/acorn_loose.js"))
browserify({standalone: "acorn.walk"})
.plugin(require('browserify-derequire'))
.transform(acornShim)
.transform(babelify)
.require("./src/walk/index.js", {entry: true})
.bundle()
.on("error", function (err) { console.log("Error: " + err.message) })
.pipe(fs.createWriteStream("dist/walk.js"))
``` | /content/code_sandbox/node_modules/acorn/bin/build-acorn.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 451 |
```javascript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).loose = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
exports.parse_dammit = parse_dammit;
exports.__esModule = true;
// Acorn: Loose parser
//
// This module provides an alternative parser (`parse_dammit`) that
// exposes that same interface as `parse`, but will try to parse
// anything as JavaScript, repairing syntax error the best it can.
// There are circumstances in which it will raise an error and give
// up, but they are very rare. The resulting AST will be a mostly
// valid JavaScript AST (as per the [Mozilla parser API][api], except
// that:
//
// - Return outside functions is allowed
//
// - Label consistency (no conflicts, break only to existing labels)
// is not enforced.
//
// - Bogus Identifier nodes with a name of `""` are inserted whenever
// the parser got too confused to return anything meaningful.
//
// [api]: path_to_url
//
// The expected use for this is to *first* try `acorn.parse`, and only
// if that fails switch to `parse_dammit`. The loose parser might
// parse badly indented code incorrectly, so **don't** use it as
// your default parser.
//
// Quite a lot of acorn.js is duplicated here. The alternative was to
// add a *lot* of extra cruft to that file, making it less readable
// and slower. Copying and editing the code allowed me to make
// invasive changes and simplifications without creating a complicated
// tangle.
var acorn = _interopRequireWildcard(_dereq_(".."));
var _state = _dereq_("./state");
var LooseParser = _state.LooseParser;
_dereq_("./tokenize");
_dereq_("./parseutil");
_dereq_("./statement");
_dereq_("./expression");
exports.LooseParser = _state.LooseParser;
acorn.defaultOptions.tabSize = 4;
function parse_dammit(input, options) {
var p = new LooseParser(input, options);
p.next();
return p.parseTopLevel();
}
acorn.parse_dammit = parse_dammit;
acorn.LooseParser = LooseParser;
},{"..":2,"./expression":3,"./parseutil":4,"./state":5,"./statement":6,"./tokenize":7}],2:[function(_dereq_,module,exports){
"use strict";
module.exports = typeof acorn != "undefined" ? acorn : _dereq_("./acorn");
},{}],3:[function(_dereq_,module,exports){
"use strict";
var LooseParser = _dereq_("./state").LooseParser;
var isDummy = _dereq_("./parseutil").isDummy;
var tt = _dereq_("..").tokTypes;
var lp = LooseParser.prototype;
lp.checkLVal = function (expr, binding) {
if (!expr) return expr;
switch (expr.type) {
case "Identifier":
return expr;
case "MemberExpression":
return binding ? this.dummyIdent() : expr;
case "ParenthesizedExpression":
expr.expression = this.checkLVal(expr.expression, binding);
return expr;
// FIXME recursively check contents
case "ObjectPattern":
case "ArrayPattern":
case "RestElement":
case "AssignmentPattern":
if (this.options.ecmaVersion >= 6) return expr;
default:
return this.dummyIdent();
}
};
lp.parseExpression = function (noIn) {
var start = this.storeCurrentPos();
var expr = this.parseMaybeAssign(noIn);
if (this.tok.type === tt.comma) {
var node = this.startNodeAt(start);
node.expressions = [expr];
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn));
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
lp.parseParenExpression = function () {
this.pushCx();
this.expect(tt.parenL);
var val = this.parseExpression();
this.popCx();
this.expect(tt.parenR);
return val;
};
lp.parseMaybeAssign = function (noIn) {
var start = this.storeCurrentPos();
var left = this.parseMaybeConditional(noIn);
if (this.tok.type.isAssign) {
var node = this.startNodeAt(start);
node.operator = this.tok.value;
node.left = this.tok.type === tt.eq ? this.toAssignable(left) : this.checkLVal(left);
this.next();
node.right = this.parseMaybeAssign(noIn);
return this.finishNode(node, "AssignmentExpression");
}
return left;
};
lp.parseMaybeConditional = function (noIn) {
var start = this.storeCurrentPos();
var expr = this.parseExprOps(noIn);
if (this.eat(tt.question)) {
var node = this.startNodeAt(start);
node.test = expr;
node.consequent = this.parseMaybeAssign();
node.alternate = this.expect(tt.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent();
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
lp.parseExprOps = function (noIn) {
var start = this.storeCurrentPos();
var indent = this.curIndent,
line = this.curLineStart;
return this.parseExprOp(this.parseMaybeUnary(noIn), start, -1, noIn, indent, line);
};
lp.parseExprOp = function (left, start, minPrec, noIn, indent, line) {
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) return left;
var prec = this.tok.type.binop;
if (prec != null && (!noIn || this.tok.type !== tt._in)) {
if (prec > minPrec) {
var node = this.startNodeAt(start);
node.left = left;
node.operator = this.tok.value;
this.next();
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) {
node.right = this.dummyIdent();
} else {
var rightStart = this.storeCurrentPos();
node.right = this.parseExprOp(this.parseMaybeUnary(noIn), rightStart, prec, noIn, indent, line);
}
this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression");
return this.parseExprOp(node, start, minPrec, noIn, indent, line);
}
}
return left;
};
lp.parseMaybeUnary = function (noIn) {
if (this.tok.type.prefix) {
var node = this.startNode(),
update = this.tok.type === tt.incDec;
node.operator = this.tok.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary(noIn);
if (update) node.argument = this.checkLVal(node.argument);
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
} else if (this.tok.type === tt.ellipsis) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeUnary(noIn);
return this.finishNode(node, "SpreadElement");
}
var start = this.storeCurrentPos();
var expr = this.parseExprSubscripts();
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
var node = this.startNodeAt(start);
node.operator = this.tok.value;
node.prefix = false;
node.argument = this.checkLVal(expr);
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
return expr;
};
lp.parseExprSubscripts = function () {
var start = this.storeCurrentPos();
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart);
};
lp.parseSubscripts = function (base, start, noCalls, startIndent, line) {
for (;;) {
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) {
if (this.tok.type == tt.dot && this.curIndent == startIndent) --startIndent;else return base;
}
if (this.eat(tt.dot)) {
var node = this.startNodeAt(start);
node.object = base;
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) node.property = this.dummyIdent();else node.property = this.parsePropertyAccessor() || this.dummyIdent();
node.computed = false;
base = this.finishNode(node, "MemberExpression");
} else if (this.tok.type == tt.bracketL) {
this.pushCx();
this.next();
var node = this.startNodeAt(start);
node.object = base;
node.property = this.parseExpression();
node.computed = true;
this.popCx();
this.expect(tt.bracketR);
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.tok.type == tt.parenL) {
var node = this.startNodeAt(start);
node.callee = base;
node.arguments = this.parseExprList(tt.parenR);
base = this.finishNode(node, "CallExpression");
} else if (this.tok.type == tt.backQuote) {
var node = this.startNodeAt(start);
node.tag = base;
node.quasi = this.parseTemplate();
base = this.finishNode(node, "TaggedTemplateExpression");
} else {
return base;
}
}
};
lp.parseExprAtom = function () {
var node = undefined;
switch (this.tok.type) {
case tt._this:
case tt._super:
var type = this.tok.type === tt._this ? "ThisExpression" : "Super";
node = this.startNode();
this.next();
return this.finishNode(node, type);
case tt.name:
var start = this.storeCurrentPos();
var id = this.parseIdent();
return this.eat(tt.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id]) : id;
case tt.regexp:
node = this.startNode();
var val = this.tok.value;
node.regex = { pattern: val.pattern, flags: val.flags };
node.value = val.value;
node.raw = this.input.slice(this.tok.start, this.tok.end);
this.next();
return this.finishNode(node, "Literal");
case tt.num:case tt.string:
node = this.startNode();
node.value = this.tok.value;
node.raw = this.input.slice(this.tok.start, this.tok.end);
this.next();
return this.finishNode(node, "Literal");
case tt._null:case tt._true:case tt._false:
node = this.startNode();
node.value = this.tok.type === tt._null ? null : this.tok.type === tt._true;
node.raw = this.tok.type.keyword;
this.next();
return this.finishNode(node, "Literal");
case tt.parenL:
var parenStart = this.storeCurrentPos();
this.next();
var inner = this.parseExpression();
this.expect(tt.parenR);
if (this.eat(tt.arrow)) {
return this.parseArrowExpression(this.startNodeAt(parenStart), inner.expressions || (isDummy(inner) ? [] : [inner]));
}
if (this.options.preserveParens) {
var par = this.startNodeAt(parenStart);
par.expression = inner;
inner = this.finishNode(par, "ParenthesizedExpression");
}
return inner;
case tt.bracketL:
node = this.startNode();
node.elements = this.parseExprList(tt.bracketR, true);
return this.finishNode(node, "ArrayExpression");
case tt.braceL:
return this.parseObj();
case tt._class:
return this.parseClass();
case tt._function:
node = this.startNode();
this.next();
return this.parseFunction(node, false);
case tt._new:
return this.parseNew();
case tt._yield:
node = this.startNode();
this.next();
if (this.semicolon() || this.canInsertSemicolon() || this.tok.type != tt.star && !this.tok.type.startsExpr) {
node.delegate = false;
node.argument = null;
} else {
node.delegate = this.eat(tt.star);
node.argument = this.parseMaybeAssign();
}
return this.finishNode(node, "YieldExpression");
case tt.backQuote:
return this.parseTemplate();
default:
return this.dummyIdent();
}
};
lp.parseNew = function () {
var node = this.startNode(),
startIndent = this.curIndent,
line = this.curLineStart;
var meta = this.parseIdent(true);
if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
node.meta = meta;
node.property = this.parseIdent(true);
return this.finishNode(node, "MetaProperty");
}
var start = this.storeCurrentPos();
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
if (this.tok.type == tt.parenL) {
node.arguments = this.parseExprList(tt.parenR);
} else {
node.arguments = [];
}
return this.finishNode(node, "NewExpression");
};
lp.parseTemplateElement = function () {
var elem = this.startNode();
elem.value = {
raw: this.input.slice(this.tok.start, this.tok.end),
cooked: this.tok.value
};
this.next();
elem.tail = this.tok.type === tt.backQuote;
return this.finishNode(elem, "TemplateElement");
};
lp.parseTemplate = function () {
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement();
node.quasis = [curElt];
while (!curElt.tail) {
this.next();
node.expressions.push(this.parseExpression());
if (this.expect(tt.braceR)) {
curElt = this.parseTemplateElement();
} else {
curElt = this.startNode();
curElt.value = { cooked: "", raw: "" };
curElt.tail = true;
}
node.quasis.push(curElt);
}
this.expect(tt.backQuote);
return this.finishNode(node, "TemplateLiteral");
};
lp.parseObj = function () {
var node = this.startNode();
node.properties = [];
this.pushCx();
var indent = this.curIndent + 1,
line = this.curLineStart;
this.eat(tt.braceL);
if (this.curIndent + 1 < indent) {
indent = this.curIndent;line = this.curLineStart;
}
while (!this.closes(tt.braceR, indent, line)) {
var prop = this.startNode(),
isGenerator = undefined,
start = undefined;
if (this.options.ecmaVersion >= 6) {
start = this.storeCurrentPos();
prop.method = false;
prop.shorthand = false;
isGenerator = this.eat(tt.star);
}
this.parsePropertyName(prop);
if (isDummy(prop.key)) {
if (isDummy(this.parseMaybeAssign())) this.next();this.eat(tt.comma);continue;
}
if (this.eat(tt.colon)) {
prop.kind = "init";
prop.value = this.parseMaybeAssign();
} else if (this.options.ecmaVersion >= 6 && (this.tok.type === tt.parenL || this.tok.type === tt.braceL)) {
prop.kind = "init";
prop.method = true;
prop.value = this.parseMethod(isGenerator);
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" && !prop.computed && (prop.key.name === "get" || prop.key.name === "set") && (this.tok.type != tt.comma && this.tok.type != tt.braceR)) {
prop.kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
} else {
prop.kind = "init";
if (this.options.ecmaVersion >= 6) {
if (this.eat(tt.eq)) {
var assign = this.startNodeAt(start);
assign.operator = "=";
assign.left = prop.key;
assign.right = this.parseMaybeAssign();
prop.value = this.finishNode(assign, "AssignmentExpression");
} else {
prop.value = prop.key;
}
} else {
prop.value = this.dummyIdent();
}
prop.shorthand = true;
}
node.properties.push(this.finishNode(prop, "Property"));
this.eat(tt.comma);
}
this.popCx();
if (!this.eat(tt.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start;
if (this.options.locations) this.last.loc.end = this.tok.loc.start;
}
return this.finishNode(node, "ObjectExpression");
};
lp.parsePropertyName = function (prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(tt.bracketL)) {
prop.computed = true;
prop.key = this.parseExpression();
this.expect(tt.bracketR);
return;
} else {
prop.computed = false;
}
}
var key = this.tok.type === tt.num || this.tok.type === tt.string ? this.parseExprAtom() : this.parseIdent();
prop.key = key || this.dummyIdent();
};
lp.parsePropertyAccessor = function () {
if (this.tok.type === tt.name || this.tok.type.keyword) return this.parseIdent();
};
lp.parseIdent = function () {
var name = this.tok.type === tt.name ? this.tok.value : this.tok.type.keyword;
if (!name) return this.dummyIdent();
var node = this.startNode();
this.next();
node.name = name;
return this.finishNode(node, "Identifier");
};
lp.initFunction = function (node) {
node.id = null;
node.params = [];
if (this.options.ecmaVersion >= 6) {
node.generator = false;
node.expression = false;
}
};
// Convert existing expression atom to assignable pattern
// if possible.
lp.toAssignable = function (node, binding) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "ObjectExpression":
node.type = "ObjectPattern";
var props = node.properties;
for (var i = 0; i < props.length; i++) {
this.toAssignable(props[i].value, binding);
}break;
case "ArrayExpression":
node.type = "ArrayPattern";
this.toAssignableList(node.elements, binding);
break;
case "SpreadElement":
node.type = "RestElement";
node.argument = this.toAssignable(node.argument, binding);
break;
case "AssignmentExpression":
node.type = "AssignmentPattern";
break;
}
}
return this.checkLVal(node, binding);
};
lp.toAssignableList = function (exprList, binding) {
for (var i = 0; i < exprList.length; i++) {
exprList[i] = this.toAssignable(exprList[i], binding);
}return exprList;
};
lp.parseFunctionParams = function (params) {
params = this.parseExprList(tt.parenR);
return this.toAssignableList(params, true);
};
lp.parseMethod = function (isGenerator) {
var node = this.startNode();
this.initFunction(node);
node.params = this.parseFunctionParams();
node.generator = isGenerator || false;
node.expression = this.options.ecmaVersion >= 6 && this.tok.type !== tt.braceL;
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
return this.finishNode(node, "FunctionExpression");
};
lp.parseArrowExpression = function (node, params) {
this.initFunction(node);
node.params = this.toAssignableList(params, true);
node.expression = this.tok.type !== tt.braceL;
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
return this.finishNode(node, "ArrowFunctionExpression");
};
lp.parseExprList = function (close, allowEmpty) {
this.pushCx();
var indent = this.curIndent,
line = this.curLineStart,
elts = [];
this.next(); // Opening bracket
while (!this.closes(close, indent + 1, line)) {
if (this.eat(tt.comma)) {
elts.push(allowEmpty ? null : this.dummyIdent());
continue;
}
var elt = this.parseMaybeAssign();
if (isDummy(elt)) {
if (this.closes(close, indent, line)) break;
this.next();
} else {
elts.push(elt);
}
this.eat(tt.comma);
}
this.popCx();
if (!this.eat(close)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start;
if (this.options.locations) this.last.loc.end = this.tok.loc.start;
}
return elts;
};
},{"..":2,"./parseutil":4,"./state":5}],4:[function(_dereq_,module,exports){
"use strict";
exports.isDummy = isDummy;
exports.__esModule = true;
var LooseParser = _dereq_("./state").LooseParser;
var _ = _dereq_("..");
var Node = _.Node;
var SourceLocation = _.SourceLocation;
var lineBreak = _.lineBreak;
var isNewLine = _.isNewLine;
var tt = _.tokTypes;
var lp = LooseParser.prototype;
lp.startNode = function () {
var node = new Node();
node.start = this.tok.start;
if (this.options.locations) node.loc = new SourceLocation(this.toks, this.tok.loc.start);
if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
if (this.options.ranges) node.range = [this.tok.start, 0];
return node;
};
lp.storeCurrentPos = function () {
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start;
};
lp.startNodeAt = function (pos) {
var node = new Node();
if (this.options.locations) {
node.start = pos[0];
node.loc = new SourceLocation(this.toks, pos[1]);
pos = pos[0];
} else {
node.start = pos;
}
if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
if (this.options.ranges) node.range = [pos, 0];
return node;
};
lp.finishNode = function (node, type) {
node.type = type;
node.end = this.last.end;
if (this.options.locations) node.loc.end = this.last.loc.end;
if (this.options.ranges) node.range[1] = this.last.end;
return node;
};
lp.dummyIdent = function () {
var dummy = this.startNode();
dummy.name = "";
return this.finishNode(dummy, "Identifier");
};
function isDummy(node) {
return node.name == "";
}
lp.eat = function (type) {
if (this.tok.type === type) {
this.next();
return true;
} else {
return false;
}
};
lp.isContextual = function (name) {
return this.tok.type === tt.name && this.tok.value === name;
};
lp.eatContextual = function (name) {
return this.tok.value === name && this.eat(tt.name);
};
lp.canInsertSemicolon = function () {
return this.tok.type === tt.eof || this.tok.type === tt.braceR || lineBreak.test(this.input.slice(this.last.end, this.tok.start));
};
lp.semicolon = function () {
return this.eat(tt.semi);
};
lp.expect = function (type) {
if (this.eat(type)) return true;
for (var i = 1; i <= 2; i++) {
if (this.lookAhead(i).type == type) {
for (var j = 0; j < i; j++) {
this.next();
}return true;
}
}
};
lp.pushCx = function () {
this.context.push(this.curIndent);
};
lp.popCx = function () {
this.curIndent = this.context.pop();
};
lp.lineEnd = function (pos) {
while (pos < this.input.length && !isNewLine(this.input.charCodeAt(pos))) ++pos;
return pos;
};
lp.indentationAfter = function (pos) {
for (var count = 0;; ++pos) {
var ch = this.input.charCodeAt(pos);
if (ch === 32) ++count;else if (ch === 9) count += this.options.tabSize;else return count;
}
};
lp.closes = function (closeTok, indent, line, blockHeuristic) {
if (this.tok.type === closeTok || this.tok.type === tt.eof) return true;
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() && (!blockHeuristic || this.nextLineStart >= this.input.length || this.indentationAfter(this.nextLineStart) < indent);
};
lp.tokenStartsLine = function () {
for (var p = this.tok.start - 1; p >= this.curLineStart; --p) {
var ch = this.input.charCodeAt(p);
if (ch !== 9 && ch !== 32) return false;
}
return true;
};
},{"..":2,"./state":5}],5:[function(_dereq_,module,exports){
"use strict";
exports.LooseParser = LooseParser;
exports.__esModule = true;
var _ = _dereq_("..");
var tokenizer = _.tokenizer;
var SourceLocation = _.SourceLocation;
var tt = _.tokTypes;
function LooseParser(input, options) {
this.toks = tokenizer(input, options);
this.options = this.toks.options;
this.input = this.toks.input;
this.tok = this.last = { type: tt.eof, start: 0, end: 0 };
if (this.options.locations) {
var here = this.toks.curPosition();
this.tok.loc = new SourceLocation(this.toks, here, here);
}
this.ahead = []; // Tokens ahead
this.context = []; // Indentation contexted
this.curIndent = 0;
this.curLineStart = 0;
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
}
},{"..":2}],6:[function(_dereq_,module,exports){
"use strict";
var LooseParser = _dereq_("./state").LooseParser;
var isDummy = _dereq_("./parseutil").isDummy;
var _ = _dereq_("..");
var getLineInfo = _.getLineInfo;
var tt = _.tokTypes;
var lp = LooseParser.prototype;
lp.parseTopLevel = function () {
var node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0);
node.body = [];
while (this.tok.type !== tt.eof) node.body.push(this.parseStatement());
this.last = this.tok;
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType;
}
return this.finishNode(node, "Program");
};
lp.parseStatement = function () {
var starttype = this.tok.type,
node = this.startNode();
switch (starttype) {
case tt._break:case tt._continue:
this.next();
var isBreak = starttype === tt._break;
if (this.semicolon() || this.canInsertSemicolon()) {
node.label = null;
} else {
node.label = this.tok.type === tt.name ? this.parseIdent() : null;
this.semicolon();
}
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
case tt._debugger:
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
case tt._do:
this.next();
node.body = this.parseStatement();
node.test = this.eat(tt._while) ? this.parseParenExpression() : this.dummyIdent();
this.semicolon();
return this.finishNode(node, "DoWhileStatement");
case tt._for:
this.next();
this.pushCx();
this.expect(tt.parenL);
if (this.tok.type === tt.semi) return this.parseFor(node, null);
if (this.tok.type === tt._var || this.tok.type === tt._let || this.tok.type === tt._const) {
var _init = this.parseVar(true);
if (_init.declarations.length === 1 && (this.tok.type === tt._in || this.isContextual("of"))) {
return this.parseForIn(node, _init);
}
return this.parseFor(node, _init);
}
var init = this.parseExpression(true);
if (this.tok.type === tt._in || this.isContextual("of")) return this.parseForIn(node, this.toAssignable(init));
return this.parseFor(node, init);
case tt._function:
this.next();
return this.parseFunction(node, true);
case tt._if:
this.next();
node.test = this.parseParenExpression();
node.consequent = this.parseStatement();
node.alternate = this.eat(tt._else) ? this.parseStatement() : null;
return this.finishNode(node, "IfStatement");
case tt._return:
this.next();
if (this.eat(tt.semi) || this.canInsertSemicolon()) node.argument = null;else {
node.argument = this.parseExpression();this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
case tt._switch:
var blockIndent = this.curIndent,
line = this.curLineStart;
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
this.pushCx();
this.expect(tt.braceL);
var cur = undefined;
while (!this.closes(tt.braceR, blockIndent, line, true)) {
if (this.tok.type === tt._case || this.tok.type === tt._default) {
var isCase = this.tok.type === tt._case;
if (cur) this.finishNode(cur, "SwitchCase");
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) cur.test = this.parseExpression();else cur.test = null;
this.expect(tt.colon);
} else {
if (!cur) {
node.cases.push(cur = this.startNode());
cur.consequent = [];
cur.test = null;
}
cur.consequent.push(this.parseStatement());
}
}
if (cur) this.finishNode(cur, "SwitchCase");
this.popCx();
this.eat(tt.braceR);
return this.finishNode(node, "SwitchStatement");
case tt._throw:
this.next();
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
case tt._try:
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.tok.type === tt._catch) {
var clause = this.startNode();
this.next();
this.expect(tt.parenL);
clause.param = this.toAssignable(this.parseExprAtom(), true);
this.expect(tt.parenR);
clause.guard = null;
clause.body = this.parseBlock();
node.handler = this.finishNode(clause, "CatchClause");
}
node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) return node.block;
return this.finishNode(node, "TryStatement");
case tt._var:
case tt._let:
case tt._const:
return this.parseVar();
case tt._while:
this.next();
node.test = this.parseParenExpression();
node.body = this.parseStatement();
return this.finishNode(node, "WhileStatement");
case tt._with:
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement();
return this.finishNode(node, "WithStatement");
case tt.braceL:
return this.parseBlock();
case tt.semi:
this.next();
return this.finishNode(node, "EmptyStatement");
case tt._class:
return this.parseClass(true);
case tt._import:
return this.parseImport();
case tt._export:
return this.parseExport();
default:
var expr = this.parseExpression();
if (isDummy(expr)) {
this.next();
if (this.tok.type === tt.eof) return this.finishNode(node, "EmptyStatement");
return this.parseStatement();
} else if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) {
node.body = this.parseStatement();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
} else {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
}
}
};
lp.parseBlock = function () {
var node = this.startNode();
this.pushCx();
this.expect(tt.braceL);
var blockIndent = this.curIndent,
line = this.curLineStart;
node.body = [];
while (!this.closes(tt.braceR, blockIndent, line, true)) node.body.push(this.parseStatement());
this.popCx();
this.eat(tt.braceR);
return this.finishNode(node, "BlockStatement");
};
lp.parseFor = function (node, init) {
node.init = init;
node.test = node.update = null;
if (this.eat(tt.semi) && this.tok.type !== tt.semi) node.test = this.parseExpression();
if (this.eat(tt.semi) && this.tok.type !== tt.parenR) node.update = this.parseExpression();
this.popCx();
this.expect(tt.parenR);
node.body = this.parseStatement();
return this.finishNode(node, "ForStatement");
};
lp.parseForIn = function (node, init) {
var type = this.tok.type === tt._in ? "ForInStatement" : "ForOfStatement";
this.next();
node.left = init;
node.right = this.parseExpression();
this.popCx();
this.expect(tt.parenR);
node.body = this.parseStatement();
return this.finishNode(node, type);
};
lp.parseVar = function (noIn) {
var node = this.startNode();
node.kind = this.tok.type.keyword;
this.next();
node.declarations = [];
do {
var decl = this.startNode();
decl.id = this.options.ecmaVersion >= 6 ? this.toAssignable(this.parseExprAtom(), true) : this.parseIdent();
decl.init = this.eat(tt.eq) ? this.parseMaybeAssign(noIn) : null;
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
} while (this.eat(tt.comma));
if (!node.declarations.length) {
var decl = this.startNode();
decl.id = this.dummyIdent();
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
}
if (!noIn) this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
lp.parseClass = function (isStatement) {
var node = this.startNode();
this.next();
if (this.tok.type === tt.name) node.id = this.parseIdent();else if (isStatement) node.id = this.dummyIdent();else node.id = null;
node.superClass = this.eat(tt._extends) ? this.parseExpression() : null;
node.body = this.startNode();
node.body.body = [];
this.pushCx();
var indent = this.curIndent + 1,
line = this.curLineStart;
this.eat(tt.braceL);
if (this.curIndent + 1 < indent) {
indent = this.curIndent;line = this.curLineStart;
}
while (!this.closes(tt.braceR, indent, line)) {
if (this.semicolon()) continue;
var method = this.startNode(),
isGenerator = undefined;
if (this.options.ecmaVersion >= 6) {
method["static"] = false;
isGenerator = this.eat(tt.star);
}
this.parsePropertyName(method);
if (isDummy(method.key)) {
if (isDummy(this.parseMaybeAssign())) this.next();this.eat(tt.comma);continue;
}
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" && (this.tok.type != tt.parenL && this.tok.type != tt.braceL)) {
method["static"] = true;
isGenerator = this.eat(tt.star);
this.parsePropertyName(method);
} else {
method["static"] = false;
}
if (this.options.ecmaVersion >= 5 && method.key.type === "Identifier" && !method.computed && (method.key.name === "get" || method.key.name === "set") && this.tok.type !== tt.parenL && this.tok.type !== tt.braceL) {
method.kind = method.key.name;
this.parsePropertyName(method);
method.value = this.parseMethod(false);
} else {
if (!method.computed && !method["static"] && !isGenerator && (method.key.type === "Identifier" && method.key.name === "constructor" || method.key.type === "Literal" && method.key.value === "constructor")) {
method.kind = "constructor";
} else {
method.kind = "method";
}
method.value = this.parseMethod(isGenerator);
}
node.body.body.push(this.finishNode(method, "MethodDefinition"));
}
this.popCx();
if (!this.eat(tt.braceR)) {
// If there is no closing brace, make the node span to the start
// of the next token (this is useful for Tern)
this.last.end = this.tok.start;
if (this.options.locations) this.last.loc.end = this.tok.loc.start;
}
this.semicolon();
this.finishNode(node.body, "ClassBody");
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
lp.parseFunction = function (node, isStatement) {
this.initFunction(node);
if (this.options.ecmaVersion >= 6) {
node.generator = this.eat(tt.star);
}
if (this.tok.type === tt.name) node.id = this.parseIdent();else if (isStatement) node.id = this.dummyIdent();
node.params = this.parseFunctionParams();
node.body = this.parseBlock();
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
};
lp.parseExport = function () {
var node = this.startNode();
this.next();
if (this.eat(tt.star)) {
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
return this.finishNode(node, "ExportAllDeclaration");
}
if (this.eat(tt._default)) {
var expr = this.parseMaybeAssign();
if (expr.id) {
switch (expr.type) {
case "FunctionExpression":
expr.type = "FunctionDeclaration";break;
case "ClassExpression":
expr.type = "ClassDeclaration";break;
}
}
node.declaration = expr;
this.semicolon();
return this.finishNode(node, "ExportDefaultDeclaration");
}
if (this.tok.type.keyword) {
node.declaration = this.parseStatement();
node.specifiers = [];
node.source = null;
} else {
node.declaration = null;
node.specifiers = this.parseExportSpecifierList();
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
this.semicolon();
}
return this.finishNode(node, "ExportNamedDeclaration");
};
lp.parseImport = function () {
var node = this.startNode();
this.next();
if (this.tok.type === tt.string) {
node.specifiers = [];
node.source = this.parseExprAtom();
node.kind = "";
} else {
var elt = undefined;
if (this.tok.type === tt.name && this.tok.value !== "from") {
elt = this.startNode();
elt.local = this.parseIdent();
this.finishNode(elt, "ImportDefaultSpecifier");
this.eat(tt.comma);
}
node.specifiers = this.parseImportSpecifierList();
node.source = this.eatContextual("from") ? this.parseExprAtom() : null;
if (elt) node.specifiers.unshift(elt);
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
lp.parseImportSpecifierList = function () {
var elts = [];
if (this.tok.type === tt.star) {
var elt = this.startNode();
this.next();
if (this.eatContextual("as")) elt.local = this.parseIdent();
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"));
} else {
var indent = this.curIndent,
line = this.curLineStart,
continuedLine = this.nextLineStart;
this.pushCx();
this.eat(tt.braceL);
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart;
while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
var elt = this.startNode();
if (this.eat(tt.star)) {
if (this.eatContextual("as")) elt.local = this.parseIdent();
this.finishNode(elt, "ImportNamespaceSpecifier");
} else {
if (this.isContextual("from")) break;
elt.imported = this.parseIdent();
elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported;
this.finishNode(elt, "ImportSpecifier");
}
elts.push(elt);
this.eat(tt.comma);
}
this.eat(tt.braceR);
this.popCx();
}
return elts;
};
lp.parseExportSpecifierList = function () {
var elts = [];
var indent = this.curIndent,
line = this.curLineStart,
continuedLine = this.nextLineStart;
this.pushCx();
this.eat(tt.braceL);
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart;
while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
if (this.isContextual("from")) break;
var elt = this.startNode();
elt.local = this.parseIdent();
elt.exported = this.eatContextual("as") ? this.parseIdent() : elt.local;
this.finishNode(elt, "ExportSpecifier");
elts.push(elt);
this.eat(tt.comma);
}
this.eat(tt.braceR);
this.popCx();
return elts;
};
},{"..":2,"./parseutil":4,"./state":5}],7:[function(_dereq_,module,exports){
"use strict";
var _ = _dereq_("..");
var tt = _.tokTypes;
var Token = _.Token;
var isNewLine = _.isNewLine;
var SourceLocation = _.SourceLocation;
var getLineInfo = _.getLineInfo;
var lineBreakG = _.lineBreakG;
var LooseParser = _dereq_("./state").LooseParser;
var lp = LooseParser.prototype;
function isSpace(ch) {
return ch < 14 && ch > 8 || ch === 32 || ch === 160 || isNewLine(ch);
}
lp.next = function () {
this.last = this.tok;
if (this.ahead.length) this.tok = this.ahead.shift();else this.tok = this.readToken();
if (this.tok.start >= this.nextLineStart) {
while (this.tok.start >= this.nextLineStart) {
this.curLineStart = this.nextLineStart;
this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
}
this.curIndent = this.indentationAfter(this.curLineStart);
}
};
lp.readToken = function () {
for (;;) {
try {
this.toks.next();
if (this.toks.type === tt.dot && this.input.substr(this.toks.end, 1) === "." && this.options.ecmaVersion >= 6) {
this.toks.end++;
this.toks.type = tt.ellipsis;
}
return new Token(this.toks);
} catch (e) {
if (!(e instanceof SyntaxError)) throw e;
// Try to skip some text, based on the error message, and then continue
var msg = e.message,
pos = e.raisedAt,
replace = true;
if (/unterminated/i.test(msg)) {
pos = this.lineEnd(e.pos + 1);
if (/string/.test(msg)) {
replace = { start: e.pos, end: pos, type: tt.string, value: this.input.slice(e.pos + 1, pos) };
} else if (/regular expr/i.test(msg)) {
var re = this.input.slice(e.pos, pos);
try {
re = new RegExp(re);
} catch (e) {}
replace = { start: e.pos, end: pos, type: tt.regexp, value: re };
} else if (/template/.test(msg)) {
replace = { start: e.pos, end: pos,
type: tt.template,
value: this.input.slice(e.pos, pos) };
} else {
replace = false;
}
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos;
} else if (/character escape|expected hexadecimal/i.test(msg)) {
while (pos < this.input.length) {
var ch = this.input.charCodeAt(pos++);
if (ch === 34 || ch === 39 || isNewLine(ch)) break;
}
} else if (/unexpected character/i.test(msg)) {
pos++;
replace = false;
} else if (/regular expression/i.test(msg)) {
replace = true;
} else {
throw e;
}
this.resetTo(pos);
if (replace === true) replace = { start: pos, end: pos, type: tt.name, value: "" };
if (replace) {
if (this.options.locations) replace.loc = new SourceLocation(this.toks, getLineInfo(this.input, replace.start), getLineInfo(this.input, replace.end));
return replace;
}
}
}
};
lp.resetTo = function (pos) {
this.toks.pos = pos;
var ch = this.input.charAt(pos - 1);
this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) || /[enwfd]/.test(ch) && /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos));
if (this.options.locations) {
this.toks.curLine = 1;
this.toks.lineStart = lineBreakG.lastIndex = 0;
var match = undefined;
while ((match = lineBreakG.exec(this.input)) && match.index < pos) {
++this.toks.curLine;
this.toks.lineStart = match.index + match[0].length;
}
}
};
lp.lookAhead = function (n) {
while (n > this.ahead.length) this.ahead.push(this.readToken());
return this.ahead[n - 1];
};
},{"..":2,"./state":5}]},{},[1])(1)
});
``` | /content/code_sandbox/node_modules/acorn/dist/acorn_loose.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 10,961 |
```javascript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).walk = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
// AST walker module for Mozilla Parser API compatible trees
// A simple walk is one where you simply specify callbacks to be
// called on specific nodes. The last two arguments are optional. A
// simple use would be
//
// walk.simple(myTree, {
// Expression: function(node) { ... }
// });
//
// to do something with all expressions. All Parser API node types
// can be used to identify node types, as well as Expression,
// Statement, and ScopeBody, which denote categories of nodes.
//
// The base argument can be used to pass a custom (recursive)
// walker, and state can be used to give this walked an initial
// state.
exports.simple = simple;
// An ancestor walk builds up an array of ancestor nodes (including
// the current node) and passes them to the callback as the state parameter.
exports.ancestor = ancestor;
// A recursive walk is one where your functions override the default
// walkers. They can modify and replace the state parameter that's
// threaded through the walk, and can opt how and whether to walk
// their child nodes (by calling their third argument on these
// nodes).
exports.recursive = recursive;
// Find a node with a given start, end, and type (all are optional,
// null can be used as wildcard). Returns a {node, state} object, or
// undefined when it doesn't find a matching node.
exports.findNodeAt = findNodeAt;
// Find the innermost node of a given type that contains the given
// position. Interface similar to findNodeAt.
exports.findNodeAround = findNodeAround;
// Find the outermost matching node after a given position.
exports.findNodeAfter = findNodeAfter;
// Find the outermost matching node before a given position.
exports.findNodeBefore = findNodeBefore;
// Used to create a custom walker. Will fill in all missing node
// type properties with the defaults.
exports.make = make;
exports.__esModule = true;
function simple(node, visitors, base, state) {
if (!base) base = exports.base;(function c(node, st, override) {
var type = override || node.type,
found = visitors[type];
base[type](node, st, c);
if (found) found(node, st);
})(node, state);
}
function ancestor(node, visitors, base, state) {
if (!base) base = exports.base;
if (!state) state = [];(function c(node, st, override) {
var type = override || node.type,
found = visitors[type];
if (node != st[st.length - 1]) {
st = st.slice();
st.push(node);
}
base[type](node, st, c);
if (found) found(node, st);
})(node, state);
}
function recursive(node, state, funcs, base) {
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {
visitor[override || node.type](node, st, c);
})(node, state);
}
function makeTest(test) {
if (typeof test == "string") {
return function (type) {
return type == test;
};
} else if (!test) {
return function () {
return true;
};
} else {
return test;
}
}
var Found = function Found(node, state) {
_classCallCheck(this, Found);
this.node = node;this.state = state;
};
function findNodeAt(node, start, end, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
try {
;(function c(node, st, override) {
var type = override || node.type;
if ((start == null || node.start <= start) && (end == null || node.end >= end)) base[type](node, st, c);
if (test(type, node) && (start == null || node.start == start) && (end == null || node.end == end)) throw new Found(node, st);
})(node, state);
} catch (e) {
if (e instanceof Found) {
return e;
}throw e;
}
}
function findNodeAround(node, pos, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
try {
;(function c(node, st, override) {
var type = override || node.type;
if (node.start > pos || node.end < pos) {
return;
}base[type](node, st, c);
if (test(type, node)) throw new Found(node, st);
})(node, state);
} catch (e) {
if (e instanceof Found) {
return e;
}throw e;
}
}
function findNodeAfter(node, pos, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
try {
;(function c(node, st, override) {
if (node.end < pos) {
return;
}var type = override || node.type;
if (node.start >= pos && test(type, node)) throw new Found(node, st);
base[type](node, st, c);
})(node, state);
} catch (e) {
if (e instanceof Found) {
return e;
}throw e;
}
}
function findNodeBefore(node, pos, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
var max = undefined;(function c(node, st, override) {
if (node.start > pos) {
return;
}var type = override || node.type;
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) max = new Found(node, st);
base[type](node, st, c);
})(node, state);
return max;
}
function make(funcs, base) {
if (!base) base = exports.base;
var visitor = {};
for (var type in base) visitor[type] = base[type];
for (var type in funcs) visitor[type] = funcs[type];
return visitor;
}
function skipThrough(node, st, c) {
c(node, st);
}
function ignore(_node, _st, _c) {}
// Node walkers.
var base = {};
exports.base = base;
base.Program = base.BlockStatement = function (node, st, c) {
for (var i = 0; i < node.body.length; ++i) {
c(node.body[i], st, "Statement");
}
};
base.Statement = skipThrough;
base.EmptyStatement = ignore;
base.ExpressionStatement = base.ParenthesizedExpression = function (node, st, c) {
return c(node.expression, st, "Expression");
};
base.IfStatement = function (node, st, c) {
c(node.test, st, "Expression");
c(node.consequent, st, "Statement");
if (node.alternate) c(node.alternate, st, "Statement");
};
base.LabeledStatement = function (node, st, c) {
return c(node.body, st, "Statement");
};
base.BreakStatement = base.ContinueStatement = ignore;
base.WithStatement = function (node, st, c) {
c(node.object, st, "Expression");
c(node.body, st, "Statement");
};
base.SwitchStatement = function (node, st, c) {
c(node.discriminant, st, "Expression");
for (var i = 0; i < node.cases.length; ++i) {
var cs = node.cases[i];
if (cs.test) c(cs.test, st, "Expression");
for (var j = 0; j < cs.consequent.length; ++j) {
c(cs.consequent[j], st, "Statement");
}
}
};
base.ReturnStatement = base.YieldExpression = function (node, st, c) {
if (node.argument) c(node.argument, st, "Expression");
};
base.ThrowStatement = base.SpreadElement = base.RestElement = function (node, st, c) {
return c(node.argument, st, "Expression");
};
base.TryStatement = function (node, st, c) {
c(node.block, st, "Statement");
if (node.handler) c(node.handler.body, st, "ScopeBody");
if (node.finalizer) c(node.finalizer, st, "Statement");
};
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
c(node.test, st, "Expression");
c(node.body, st, "Statement");
};
base.ForStatement = function (node, st, c) {
if (node.init) c(node.init, st, "ForInit");
if (node.test) c(node.test, st, "Expression");
if (node.update) c(node.update, st, "Expression");
c(node.body, st, "Statement");
};
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
c(node.left, st, "ForInit");
c(node.right, st, "Expression");
c(node.body, st, "Statement");
};
base.ForInit = function (node, st, c) {
if (node.type == "VariableDeclaration") c(node, st);else c(node, st, "Expression");
};
base.DebuggerStatement = ignore;
base.FunctionDeclaration = function (node, st, c) {
return c(node, st, "Function");
};
base.VariableDeclaration = function (node, st, c) {
for (var i = 0; i < node.declarations.length; ++i) {
var decl = node.declarations[i];
if (decl.init) c(decl.init, st, "Expression");
}
};
base.Function = function (node, st, c) {
return c(node.body, st, "ScopeBody");
};
base.ScopeBody = function (node, st, c) {
return c(node, st, "Statement");
};
base.Expression = skipThrough;
base.ThisExpression = base.Super = base.MetaProperty = ignore;
base.ArrayExpression = base.ArrayPattern = function (node, st, c) {
for (var i = 0; i < node.elements.length; ++i) {
var elt = node.elements[i];
if (elt) c(elt, st, "Expression");
}
};
base.ObjectExpression = base.ObjectPattern = function (node, st, c) {
for (var i = 0; i < node.properties.length; ++i) {
c(node.properties[i], st);
}
};
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
for (var i = 0; i < node.expressions.length; ++i) {
c(node.expressions[i], st, "Expression");
}
};
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
c(node.argument, st, "Expression");
};
base.BinaryExpression = base.AssignmentExpression = base.AssignmentPattern = base.LogicalExpression = function (node, st, c) {
c(node.left, st, "Expression");
c(node.right, st, "Expression");
};
base.ConditionalExpression = function (node, st, c) {
c(node.test, st, "Expression");
c(node.consequent, st, "Expression");
c(node.alternate, st, "Expression");
};
base.NewExpression = base.CallExpression = function (node, st, c) {
c(node.callee, st, "Expression");
if (node.arguments) for (var i = 0; i < node.arguments.length; ++i) {
c(node.arguments[i], st, "Expression");
}
};
base.MemberExpression = function (node, st, c) {
c(node.object, st, "Expression");
if (node.computed) c(node.property, st, "Expression");
};
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
return c(node.declaration, st);
};
base.ImportDeclaration = function (node, st, c) {
for (var i = 0; i < node.specifiers.length; i++) {
c(node.specifiers[i], st);
}
};
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression");
c(node.quasi, st);
};
base.ClassDeclaration = base.ClassExpression = function (node, st, c) {
if (node.superClass) c(node.superClass, st, "Expression");
for (var i = 0; i < node.body.body.length; i++) {
c(node.body.body[i], st);
}
};
base.MethodDefinition = base.Property = function (node, st, c) {
if (node.computed) c(node.key, st, "Expression");
c(node.value, st, "Expression");
};
base.ComprehensionExpression = function (node, st, c) {
for (var i = 0; i < node.blocks.length; i++) {
c(node.blocks[i].right, st, "Expression");
}c(node.body, st, "Expression");
};
},{}]},{},[1])(1)
});
``` | /content/code_sandbox/node_modules/acorn/dist/walk.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 3,207 |
```javascript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
// returns an abstract syntax tree as specified by [Mozilla parser
// API][api].
//
// [api]: path_to_url
"use strict";
exports.parse = parse;
// This function tries to parse a single expression at a given
// offset in a string. Useful for parsing mixed-language formats
// that embed JavaScript expressions.
exports.parseExpressionAt = parseExpressionAt;
// Acorn is organized as a tokenizer and a recursive-descent parser.
// The `tokenize` export provides an interface to the tokenizer.
exports.tokenizer = tokenizer;
exports.__esModule = true;
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
//
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
// various contributors and released under an MIT license.
//
// Git repositories for Acorn are available at
//
// path_to_url
// path_to_url
//
// Please use the [github bug tracker][ghbt] to report issues.
//
// [ghbt]: path_to_url
//
// This file defines the main parser interface. The library also comes
// with a [error-tolerant parser][dammit] and an
// [abstract syntax tree walker][walk], defined in other files.
//
// [dammit]: acorn_loose.js
// [walk]: util/walk.js
var _state = _dereq_("./state");
var Parser = _state.Parser;
var _options = _dereq_("./options");
var getOptions = _options.getOptions;
_dereq_("./parseutil");
_dereq_("./statement");
_dereq_("./lval");
_dereq_("./expression");
exports.Parser = _state.Parser;
exports.plugins = _state.plugins;
exports.defaultOptions = _options.defaultOptions;
var _location = _dereq_("./location");
exports.SourceLocation = _location.SourceLocation;
exports.getLineInfo = _location.getLineInfo;
exports.Node = _dereq_("./node").Node;
var _tokentype = _dereq_("./tokentype");
exports.TokenType = _tokentype.TokenType;
exports.tokTypes = _tokentype.types;
var _tokencontext = _dereq_("./tokencontext");
exports.TokContext = _tokencontext.TokContext;
exports.tokContexts = _tokencontext.types;
var _identifier = _dereq_("./identifier");
exports.isIdentifierChar = _identifier.isIdentifierChar;
exports.isIdentifierStart = _identifier.isIdentifierStart;
exports.Token = _dereq_("./tokenize").Token;
var _whitespace = _dereq_("./whitespace");
exports.isNewLine = _whitespace.isNewLine;
exports.lineBreak = _whitespace.lineBreak;
exports.lineBreakG = _whitespace.lineBreakG;
var version = "1.2.2";exports.version = version;
function parse(input, options) {
var p = parser(options, input);
var startPos = p.pos,
startLoc = p.options.locations && p.curPosition();
p.nextToken();
return p.parseTopLevel(p.options.program || p.startNodeAt(startPos, startLoc));
}
function parseExpressionAt(input, pos, options) {
var p = parser(options, input, pos);
p.nextToken();
return p.parseExpression();
}
function tokenizer(input, options) {
return parser(options, input);
}
function parser(options, input) {
return new Parser(getOptions(options), String(input));
}
},{"./expression":6,"./identifier":7,"./location":8,"./lval":9,"./node":10,"./options":11,"./parseutil":12,"./state":13,"./statement":14,"./tokencontext":15,"./tokenize":16,"./tokentype":17,"./whitespace":19}],2:[function(_dereq_,module,exports){
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
},{}],3:[function(_dereq_,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
function drainQueue() {
if (draining) {
return;
}
draining = true;
var currentQueue;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
var i = -1;
while (++i < len) {
currentQueue[i]();
}
len = queue.length;
}
draining = false;
}
process.nextTick = function (fun) {
queue.push(fun);
if (!draining) {
setTimeout(drainQueue, 0);
}
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],4:[function(_dereq_,module,exports){
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
}
},{}],5:[function(_dereq_,module,exports){
(function (process,global){
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function(fn, msg) {
// Allow for deprecating things in the process of starting up.
if (isUndefined(global.process)) {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
if (process.noDeprecation === true) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnviron;
exports.debuglog = function(set) {
if (isUndefined(debugEnviron))
debugEnviron = process.env.NODE_DEBUG || '';
set = set.toUpperCase();
if (!debugs[set]) {
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
var pid = process.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function() {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
}
// set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
// path_to_url#graphics
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// path_to_url
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '', array = false, braces = ['{', '}'];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value))
return ctx.stylize('' + value, 'number');
if (isBoolean(value))
return ctx.stylize('' + value, 'boolean');
// For some reason typeof null is "object", so special case here.
if (isNull(value))
return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push('');
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = _dereq_('./support/isBuffer');
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = _dereq_('inherits');
exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./support/isBuffer":4,"_process":3,"inherits":2}],6:[function(_dereq_,module,exports){
// A recursive descent parser operates by defining functions for all
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
// instead of `(!x)[1]` is handled by the fact that the parser
// function that parses unary prefix operators is called first, and
// in turn calls the function that parses `[]` subscripts that
// way, it'll receive the node for `x[1]` already parsed, and wraps
// *that* in the unary operator node.
//
// Acorn uses an [operator precedence parser][opp] to handle binary
// operator precedence, because it is much more compact than using
// the technique outlined above, which uses different, nesting
// functions to specify precedence, for all of the ten binary
// precedence levels that JavaScript defines.
//
// [opp]: path_to_url
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var reservedWords = _dereq_("./identifier").reservedWords;
var has = _dereq_("./util").has;
var pp = Parser.prototype;
// Check if property name clashes with already added.
// Object/class getters and setters are not allowed to clash
// either with each other or with an init property and in
// strict mode, init properties are also not allowed to be repeated.
pp.checkPropClash = function (prop, propHash) {
if (this.options.ecmaVersion >= 6) return;
var key = prop.key,
name = undefined;
switch (key.type) {
case "Identifier":
name = key.name;break;
case "Literal":
name = String(key.value);break;
default:
return;
}
var kind = prop.kind || "init",
other = undefined;
if (has(propHash, name)) {
other = propHash[name];
var isGetSet = kind !== "init";
if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) this.raise(key.start, "Redefinition of property");
} else {
other = propHash[name] = {
init: false,
get: false,
set: false
};
}
other[kind] = true;
};
// ### Expression parsing
// These nest, from the most general expression type at the top to
// 'atomic', nondivisible expression types at the bottom. Most of
// the functions will simply let the function(s) below them parse,
// and, *if* the syntactic construct they handle is present, wrap
// the AST node that the inner parser gave them in another node.
// Parse a full expression. The optional arguments are used to
// forbid the `in` operator (in for loops initalization expressions)
// and provide reference for storing '=' operator inside shorthand
// property assignment in contexts where both object expression
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
pp.parseExpression = function (noIn, refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);
if (this.type === tt.comma) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
// Parse an assignment expression. This includes applications of
// operators like `+=`.
pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) {
if (this.type == tt._yield && this.inGenerator) return this.parseYield();
var failOnShorthandAssign = undefined;
if (!refShorthandDefaultPos) {
refShorthandDefaultPos = { start: 0 };
failOnShorthandAssign = true;
} else {
failOnShorthandAssign = false;
}
var startPos = this.start,
startLoc = this.startLoc;
if (this.type == tt.parenL || this.type == tt.name) this.potentialArrowAt = this.start;
var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos);
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
if (this.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
node.left = this.type === tt.eq ? this.toAssignable(left) : left;
refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly
this.checkLVal(left);
this.next();
node.right = this.parseMaybeAssign(noIn);
return this.finishNode(node, "AssignmentExpression");
} else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start);
}
return left;
};
// Parse a ternary conditional (`?:`) operator.
pp.parseMaybeConditional = function (noIn, refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprOps(noIn, refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
if (this.eat(tt.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
this.expect(tt.colon);
node.alternate = this.parseMaybeAssign(noIn);
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
// Start the precedence parser.
pp.parseExprOps = function (noIn, refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseMaybeUnary(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
};
// Parse binary operators with the operator precedence parsing
// algorithm. `left` is the left-hand side of the operator.
// `minPrec` provides context that allows the function to stop and
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
var prec = this.type.binop;
if (Array.isArray(leftStartPos)) {
if (this.options.locations && noIn === undefined) {
// shift arguments to left by one
noIn = minPrec;
minPrec = leftStartLoc;
// flatten leftStartPos
leftStartLoc = leftStartPos[1];
leftStartPos = leftStartPos[0];
}
}
if (prec != null && (!noIn || this.type !== tt._in)) {
if (prec > minPrec) {
var node = this.startNodeAt(leftStartPos, leftStartLoc);
node.left = left;
node.operator = this.value;
var op = this.type;
this.next();
var startPos = this.start,
startLoc = this.startLoc;
node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn);
this.finishNode(node, op === tt.logicalOR || op === tt.logicalAND ? "LogicalExpression" : "BinaryExpression");
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
}
}
return left;
};
// Parse unary operators, both prefix and postfix.
pp.parseMaybeUnary = function (refShorthandDefaultPos) {
if (this.type.prefix) {
var node = this.startNode(),
update = this.type === tt.incDec;
node.operator = this.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary();
if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
if (update) this.checkLVal(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raise(node.start, "Deleting local variable in strict mode");
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
}
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprSubscripts(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
while (this.type.postfix && !this.canInsertSemicolon()) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
node.prefix = false;
node.argument = expr;
this.checkLVal(expr);
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
return expr;
};
// Parse call, dot, and `[]`-subscript expressions.
pp.parseExprSubscripts = function (refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprAtom(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
return this.parseSubscripts(expr, startPos, startLoc);
};
pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
if (Array.isArray(startPos)) {
if (this.options.locations && noCalls === undefined) {
// shift arguments to left by one
noCalls = startLoc;
// flatten startPos
startLoc = startPos[1];
startPos = startPos[0];
}
}
for (;;) {
if (this.eat(tt.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = this.parseIdent(true);
node.computed = false;
base = this.finishNode(node, "MemberExpression");
} else if (this.eat(tt.bracketL)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = this.parseExpression();
node.computed = true;
this.expect(tt.bracketR);
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.eat(tt.parenL)) {
var node = this.startNodeAt(startPos, startLoc);
node.callee = base;
node.arguments = this.parseExprList(tt.parenR, false);
base = this.finishNode(node, "CallExpression");
} else if (this.type === tt.backQuote) {
var node = this.startNodeAt(startPos, startLoc);
node.tag = base;
node.quasi = this.parseTemplate();
base = this.finishNode(node, "TaggedTemplateExpression");
} else {
return base;
}
}
};
// Parse an atomic expression either a single token that is an
// expression, an expression started by a keyword like `function` or
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
pp.parseExprAtom = function (refShorthandDefaultPos) {
var node = undefined,
canBeArrow = this.potentialArrowAt == this.start;
switch (this.type) {
case tt._this:
case tt._super:
var type = this.type === tt._this ? "ThisExpression" : "Super";
node = this.startNode();
this.next();
return this.finishNode(node, type);
case tt._yield:
if (this.inGenerator) this.unexpected();
case tt.name:
var startPos = this.start,
startLoc = this.startLoc;
var id = this.parseIdent(this.type !== tt.name);
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id]);
return id;
case tt.regexp:
var value = this.value;
node = this.parseLiteral(value.value);
node.regex = { pattern: value.pattern, flags: value.flags };
return node;
case tt.num:case tt.string:
return this.parseLiteral(this.value);
case tt._null:case tt._true:case tt._false:
node = this.startNode();
node.value = this.type === tt._null ? null : this.type === tt._true;
node.raw = this.type.keyword;
this.next();
return this.finishNode(node, "Literal");
case tt.parenL:
return this.parseParenAndDistinguishExpression(canBeArrow);
case tt.bracketL:
node = this.startNode();
this.next();
// check whether this is array comprehension or regular array
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
return this.parseComprehension(node, false);
}
node.elements = this.parseExprList(tt.bracketR, true, true, refShorthandDefaultPos);
return this.finishNode(node, "ArrayExpression");
case tt.braceL:
return this.parseObj(false, refShorthandDefaultPos);
case tt._function:
node = this.startNode();
this.next();
return this.parseFunction(node, false);
case tt._class:
return this.parseClass(this.startNode(), false);
case tt._new:
return this.parseNew();
case tt.backQuote:
return this.parseTemplate();
default:
this.unexpected();
}
};
pp.parseLiteral = function (value) {
var node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
this.next();
return this.finishNode(node, "Literal");
};
pp.parseParenExpression = function () {
this.expect(tt.parenL);
var val = this.parseExpression();
this.expect(tt.parenR);
return val;
};
pp.parseParenAndDistinguishExpression = function (canBeArrow) {
var startPos = this.start,
startLoc = this.startLoc,
val = undefined;
if (this.options.ecmaVersion >= 6) {
this.next();
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
return this.parseComprehension(this.startNodeAt(startPos, startLoc), true);
}
var innerStartPos = this.start,
innerStartLoc = this.startLoc;
var exprList = [],
first = true;
var refShorthandDefaultPos = { start: 0 },
spreadStart = undefined,
innerParenStart = undefined;
while (this.type !== tt.parenR) {
first ? first = false : this.expect(tt.comma);
if (this.type === tt.ellipsis) {
spreadStart = this.start;
exprList.push(this.parseParenItem(this.parseRest()));
break;
} else {
if (this.type === tt.parenL && !innerParenStart) {
innerParenStart = this.start;
}
exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem));
}
}
var innerEndPos = this.start,
innerEndLoc = this.startLoc;
this.expect(tt.parenR);
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
if (innerParenStart) this.unexpected(innerParenStart);
return this.parseParenArrowList(startPos, startLoc, exprList);
}
if (!exprList.length) this.unexpected(this.lastTokStart);
if (spreadStart) this.unexpected(spreadStart);
if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
} else {
val = exprList[0];
}
} else {
val = this.parseParenExpression();
}
if (this.options.preserveParens) {
var par = this.startNodeAt(startPos, startLoc);
par.expression = val;
return this.finishNode(par, "ParenthesizedExpression");
} else {
return val;
}
};
pp.parseParenItem = function (item) {
return item;
};
pp.parseParenArrowList = function (startPos, startLoc, exprList) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList);
};
// New's precedence is slightly tricky. It must allow its argument
// to be a `[]` or dot subscript expression, but not a call at
// least, not without wrapping it in parentheses. Thus, it uses the
var empty = [];
pp.parseNew = function () {
var node = this.startNode();
var meta = this.parseIdent(true);
if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
node.meta = meta;
node.property = this.parseIdent(true);
if (node.property.name !== "target") this.raise(node.property.start, "The only valid meta property for new is new.target");
return this.finishNode(node, "MetaProperty");
}
var startPos = this.start,
startLoc = this.startLoc;
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false);else node.arguments = empty;
return this.finishNode(node, "NewExpression");
};
// Parse template expression.
pp.parseTemplateElement = function () {
var elem = this.startNode();
elem.value = {
raw: this.input.slice(this.start, this.end),
cooked: this.value
};
this.next();
elem.tail = this.type === tt.backQuote;
return this.finishNode(elem, "TemplateElement");
};
pp.parseTemplate = function () {
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement();
node.quasis = [curElt];
while (!curElt.tail) {
this.expect(tt.dollarBraceL);
node.expressions.push(this.parseExpression());
this.expect(tt.braceR);
node.quasis.push(curElt = this.parseTemplateElement());
}
this.next();
return this.finishNode(node, "TemplateLiteral");
};
// Parse an object literal or binding pattern.
pp.parseObj = function (isPattern, refShorthandDefaultPos) {
var node = this.startNode(),
first = true,
propHash = {};
node.properties = [];
this.next();
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma);
if (this.afterTrailingComma(tt.braceR)) break;
} else first = false;
var prop = this.startNode(),
isGenerator = undefined,
startPos = undefined,
startLoc = undefined;
if (this.options.ecmaVersion >= 6) {
prop.method = false;
prop.shorthand = false;
if (isPattern || refShorthandDefaultPos) {
startPos = this.start;
startLoc = this.startLoc;
}
if (!isPattern) isGenerator = this.eat(tt.star);
}
this.parsePropertyName(prop);
this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos);
this.checkPropClash(prop, propHash);
node.properties.push(this.finishNode(prop, "Property"));
}
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
};
pp.parsePropertyValue = function (prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos) {
if (this.eat(tt.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
prop.kind = "init";
} else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {
if (isPattern) this.unexpected();
prop.kind = "init";
prop.method = true;
prop.value = this.parseMethod(isGenerator);
} else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type != tt.comma && this.type != tt.braceR)) {
if (isGenerator || isPattern) this.unexpected();
prop.kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
prop.kind = "init";
if (isPattern) {
if (this.isKeyword(prop.key.name) || this.strict && (reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name)) || !this.options.allowReserved && this.isReservedWord(prop.key.name)) this.raise(prop.key.start, "Binding " + prop.key.name);
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
} else if (this.type === tt.eq && refShorthandDefaultPos) {
if (!refShorthandDefaultPos.start) refShorthandDefaultPos.start = this.start;
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
} else {
prop.value = prop.key;
}
prop.shorthand = true;
} else this.unexpected();
};
pp.parsePropertyName = function (prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(tt.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
this.expect(tt.bracketR);
return prop.key;
} else {
prop.computed = false;
}
}
return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true);
};
// Initialize empty function node.
pp.initFunction = function (node) {
node.id = null;
if (this.options.ecmaVersion >= 6) {
node.generator = false;
node.expression = false;
}
};
// Parse object or class method.
pp.parseMethod = function (isGenerator) {
var node = this.startNode();
this.initFunction(node);
this.expect(tt.parenL);
node.params = this.parseBindingList(tt.parenR, false, false);
var allowExpressionBody = undefined;
if (this.options.ecmaVersion >= 6) {
node.generator = isGenerator;
allowExpressionBody = true;
} else {
allowExpressionBody = false;
}
this.parseFunctionBody(node, allowExpressionBody);
return this.finishNode(node, "FunctionExpression");
};
// Parse arrow function expression with given parameters.
pp.parseArrowExpression = function (node, params) {
this.initFunction(node);
node.params = this.toAssignableList(params, true);
this.parseFunctionBody(node, true);
return this.finishNode(node, "ArrowFunctionExpression");
};
// Parse function body and check parameters.
pp.parseFunctionBody = function (node, allowExpression) {
var isExpression = allowExpression && this.type !== tt.braceL;
if (isExpression) {
node.body = this.parseMaybeAssign();
node.expression = true;
} else {
// Start a new scope with regard to labels and the `inFunction`
// flag (restore them to their old value afterwards).
var oldInFunc = this.inFunction,
oldInGen = this.inGenerator,
oldLabels = this.labels;
this.inFunction = true;this.inGenerator = node.generator;this.labels = [];
node.body = this.parseBlock(true);
node.expression = false;
this.inFunction = oldInFunc;this.inGenerator = oldInGen;this.labels = oldLabels;
}
// If this is a strict mode function, verify that argument names
// are not repeated, and it does not try to bind the words `eval`
// or `arguments`.
if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) {
var nameHash = {},
oldStrict = this.strict;
this.strict = true;
if (node.id) this.checkLVal(node.id, true);
for (var i = 0; i < node.params.length; i++) {
this.checkLVal(node.params[i], true, nameHash);
}this.strict = oldStrict;
}
};
// Parses a comma-separated list of expressions, and returns them as
// an array. `close` is the token type that ends the list, and
// `allowEmpty` can be turned on to allow subsequent commas with
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (!first) {
this.expect(tt.comma);
if (allowTrailingComma && this.afterTrailingComma(close)) break;
} else first = false;
if (allowEmpty && this.type === tt.comma) {
elts.push(null);
} else {
if (this.type === tt.ellipsis) elts.push(this.parseSpread(refShorthandDefaultPos));else elts.push(this.parseMaybeAssign(false, refShorthandDefaultPos));
}
}
return elts;
};
// Parse the next token as an identifier. If `liberal` is true (used
// when parsing properties), it will also convert keywords into
// identifiers.
pp.parseIdent = function (liberal) {
var node = this.startNode();
if (liberal && this.options.allowReserved == "never") liberal = false;
if (this.type === tt.name) {
if (!liberal && (!this.options.allowReserved && this.isReservedWord(this.value) || this.strict && reservedWords.strict(this.value) && (this.options.ecmaVersion >= 6 || this.input.slice(this.start, this.end).indexOf("\\") == -1))) this.raise(this.start, "The keyword '" + this.value + "' is reserved");
node.name = this.value;
} else if (liberal && this.type.keyword) {
node.name = this.type.keyword;
} else {
this.unexpected();
}
this.next();
return this.finishNode(node, "Identifier");
};
// Parses yield expression inside generator.
pp.parseYield = function () {
var node = this.startNode();
this.next();
if (this.type == tt.semi || this.canInsertSemicolon() || this.type != tt.star && !this.type.startsExpr) {
node.delegate = false;
node.argument = null;
} else {
node.delegate = this.eat(tt.star);
node.argument = this.parseMaybeAssign();
}
return this.finishNode(node, "YieldExpression");
};
// Parses array and generator comprehensions.
pp.parseComprehension = function (node, isGenerator) {
node.blocks = [];
while (this.type === tt._for) {
var block = this.startNode();
this.next();
this.expect(tt.parenL);
block.left = this.parseBindingAtom();
this.checkLVal(block.left, true);
this.expectContextual("of");
block.right = this.parseExpression();
this.expect(tt.parenR);
node.blocks.push(this.finishNode(block, "ComprehensionBlock"));
}
node.filter = this.eat(tt._if) ? this.parseParenExpression() : null;
node.body = this.parseExpression();
this.expect(isGenerator ? tt.parenR : tt.bracketR);
node.generator = isGenerator;
return this.finishNode(node, "ComprehensionExpression");
};
},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],7:[function(_dereq_,module,exports){
// Test whether a given character code starts an identifier.
"use strict";
exports.isIdentifierStart = isIdentifierStart;
// Test whether a given character is part of an identifier.
exports.isIdentifierChar = isIdentifierChar;
exports.__esModule = true;
// This is a trick taken from Esprima. It turns out that, on
// non-Chrome browsers, to check whether a string is in a set, a
// predicate containing a big ugly `switch` statement is faster than
// a regular expression, and on Chrome the two are about on par.
// This function uses `eval` (non-lexical) to produce such a
// predicate from a space-separated string of words.
//
// It starts by sorting the words by length.
// Removed to create an eval-free library
// Reserved word lists for various dialects of the language
var reservedWords = {
3: function anonymous(str) {
switch(str.length){case 6:switch(str){case "double":case "export":case "import":case "native":case "public":case "static":case "throws":return true}return false;case 4:switch(str){case "byte":case "char":case "enum":case "goto":case "long":return true}return false;case 5:switch(str){case "class":case "final":case "float":case "short":case "super":return true}return false;case 7:switch(str){case "boolean":case "extends":case "package":case "private":return true}return false;case 9:switch(str){case "interface":case "protected":case "transient":return true}return false;case 8:switch(str){case "abstract":case "volatile":return true}return false;case 10:return str === "implements";case 3:return str === "int";case 12:return str === "synchronized";}
},
5: function anonymous(str) {
switch(str.length){case 5:switch(str){case "class":case "super":case "const":return true}return false;case 6:switch(str){case "export":case "import":return true}return false;case 4:return str === "enum";case 7:return str === "extends";}
},
6: function anonymous(str) {
switch(str){case "enum":case "await":return true}return false;
},
strict: function anonymous(str) {
switch(str.length){case 9:switch(str){case "interface":case "protected":return true}return false;case 7:switch(str){case "package":case "private":return true}return false;case 6:switch(str){case "public":case "static":return true}return false;case 10:return str === "implements";case 3:return str === "let";case 5:return str === "yield";}
},
strictBind: function anonymous(str) {
switch(str){case "eval":case "arguments":return true}return false;
}
};
exports.reservedWords = reservedWords;
// And the keywords
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
var keywords = {
5: function anonymous(str) {
switch(str.length){case 4:switch(str){case "case":case "else":case "with":case "null":case "true":case "void":case "this":return true}return false;case 5:switch(str){case "break":case "catch":case "throw":case "while":case "false":return true}return false;case 3:switch(str){case "for":case "try":case "var":case "new":return true}return false;case 6:switch(str){case "return":case "switch":case "typeof":case "delete":return true}return false;case 8:switch(str){case "continue":case "debugger":case "function":return true}return false;case 2:switch(str){case "do":case "if":case "in":return true}return false;case 7:switch(str){case "default":case "finally":return true}return false;case 10:return str === "instanceof";}
},
6: function anonymous(str) {
switch(str.length){case 5:switch(str){case "break":case "catch":case "throw":case "while":case "false":case "const":case "class":case "yield":case "super":return true}return false;case 4:switch(str){case "case":case "else":case "with":case "null":case "true":case "void":case "this":return true}return false;case 6:switch(str){case "return":case "switch":case "typeof":case "delete":case "export":case "import":return true}return false;case 3:switch(str){case "for":case "try":case "var":case "new":case "let":return true}return false;case 8:switch(str){case "continue":case "debugger":case "function":return true}return false;case 7:switch(str){case "default":case "finally":case "extends":return true}return false;case 2:switch(str){case "do":case "if":case "in":return true}return false;case 10:return str === "instanceof";}
}
};
exports.keywords = keywords;
// ## Character categories
// Big ugly regular expressions that match characters in the
// whitespace, identifier, and identifier-start categories. These
// are only applied when a character is found to actually have a
// code point above 128.
// Generated by `tools/generate-identifier-regex.js`.
var nonASCIIidentifierStartChars = "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
var nonASCIIidentifierChars = "-------------------------------------------------------------------------------------------------------------------------------------------------";
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
// offset starts at 0x10000, and each pair of numbers represents an
// offset to the next range, and then a size of the range. They were
// generated by tools/generate-identifier-regex.js
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 99, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 98, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 16481, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 1340, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 16355, 541];
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 9, 20855, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 4305, 6, 792618, 239];
// This has a complexity linear to the value of the code. The
// assumption is that looking up astral identifier characters is
// rare.
function isInAstralSet(code, set) {
var pos = 65536;
for (var i = 0; i < set.length; i += 2) {
pos += set[i];
if (pos > code) {
return false;
}pos += set[i + 1];
if (pos >= code) {
return true;
}
}
}
function isIdentifierStart(code, astral) {
if (code < 65) {
return code === 36;
}if (code < 91) {
return true;
}if (code < 97) {
return code === 95;
}if (code < 123) {
return true;
}if (code <= 65535) {
return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
}if (astral === false) {
return false;
}return isInAstralSet(code, astralIdentifierStartCodes);
}
function isIdentifierChar(code, astral) {
if (code < 48) {
return code === 36;
}if (code < 58) {
return true;
}if (code < 65) {
return false;
}if (code < 91) {
return true;
}if (code < 97) {
return code === 95;
}if (code < 123) {
return true;
}if (code <= 65535) {
return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
}if (astral === false) {
return false;
}return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
},{}],8:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
// The `getLineInfo` function is mostly useful when the
// `locations` option is off (for performance reasons) and you
// want to find the line/column position for a given character
// offset. `input` should be the code string that the offset refers
// into.
exports.getLineInfo = getLineInfo;
exports.__esModule = true;
var Parser = _dereq_("./state").Parser;
var lineBreakG = _dereq_("./whitespace").lineBreakG;
var deprecate = _dereq_("util").deprecate;
// These are used when `options.locations` is on, for the
// `startLoc` and `endLoc` properties.
var Position = exports.Position = (function () {
function Position(line, col) {
_classCallCheck(this, Position);
this.line = line;
this.column = col;
}
Position.prototype.offset = function offset(n) {
return new Position(this.line, this.column + n);
};
return Position;
})();
var SourceLocation = exports.SourceLocation = function SourceLocation(p, start, end) {
_classCallCheck(this, SourceLocation);
this.start = start;
this.end = end;
if (p.sourceFile !== null) this.source = p.sourceFile;
};
function getLineInfo(input, offset) {
for (var line = 1, cur = 0;;) {
lineBreakG.lastIndex = cur;
var match = lineBreakG.exec(input);
if (match && match.index < offset) {
++line;
cur = match.index + match[0].length;
} else {
return new Position(line, offset - cur);
}
}
}
var pp = Parser.prototype;
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
// the location of the error, attaches the position to the end
// of the error message, and then raises a `SyntaxError` with that
// message.
pp.raise = function (pos, message) {
var loc = getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
err.pos = pos;err.loc = loc;err.raisedAt = this.pos;
throw err;
};
pp.curPosition = function () {
return new Position(this.curLine, this.pos - this.lineStart);
};
pp.markPosition = function () {
return this.options.locations ? [this.start, this.startLoc] : this.start;
};
},{"./state":13,"./whitespace":19,"util":5}],9:[function(_dereq_,module,exports){
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var reservedWords = _dereq_("./identifier").reservedWords;
var has = _dereq_("./util").has;
var pp = Parser.prototype;
// Convert existing expression atom to assignable pattern
// if possible.
pp.toAssignable = function (node, isBinding) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
break;
case "ObjectExpression":
node.type = "ObjectPattern";
for (var i = 0; i < node.properties.length; i++) {
var prop = node.properties[i];
if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter");
this.toAssignable(prop.value, isBinding);
}
break;
case "ArrayExpression":
node.type = "ArrayPattern";
this.toAssignableList(node.elements, isBinding);
break;
case "AssignmentExpression":
if (node.operator === "=") {
node.type = "AssignmentPattern";
} else {
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
}
break;
case "ParenthesizedExpression":
node.expression = this.toAssignable(node.expression, isBinding);
break;
case "MemberExpression":
if (!isBinding) break;
default:
this.raise(node.start, "Assigning to rvalue");
}
}
return node;
};
// Convert list of expression atoms to binding list.
pp.toAssignableList = function (exprList, isBinding) {
var end = exprList.length;
if (end) {
var last = exprList[end - 1];
if (last && last.type == "RestElement") {
--end;
} else if (last && last.type == "SpreadElement") {
last.type = "RestElement";
var arg = last.argument;
this.toAssignable(arg, isBinding);
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") this.unexpected(arg.start);
--end;
}
}
for (var i = 0; i < end; i++) {
var elt = exprList[i];
if (elt) this.toAssignable(elt, isBinding);
}
return exprList;
};
// Parses spread element.
pp.parseSpread = function (refShorthandDefaultPos) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(refShorthandDefaultPos);
return this.finishNode(node, "SpreadElement");
};
pp.parseRest = function () {
var node = this.startNode();
this.next();
node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected();
return this.finishNode(node, "RestElement");
};
// Parses lvalue (assignable) atom.
pp.parseBindingAtom = function () {
if (this.options.ecmaVersion < 6) return this.parseIdent();
switch (this.type) {
case tt.name:
return this.parseIdent();
case tt.bracketL:
var node = this.startNode();
this.next();
node.elements = this.parseBindingList(tt.bracketR, true, true);
return this.finishNode(node, "ArrayPattern");
case tt.braceL:
return this.parseObj(true);
default:
this.unexpected();
}
};
pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (first) first = false;else this.expect(tt.comma);
if (allowEmpty && this.type === tt.comma) {
elts.push(null);
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
} else if (this.type === tt.ellipsis) {
var rest = this.parseRest();
this.parseBindingListItem(rest);
elts.push(rest);
this.expect(close);
break;
} else {
var elem = this.parseMaybeDefault(this.start, this.startLoc);
this.parseBindingListItem(elem);
elts.push(elem);
}
}
return elts;
};
pp.parseBindingListItem = function (param) {
return param;
};
// Parses assignment pattern around given atom if possible.
pp.parseMaybeDefault = function (startPos, startLoc, left) {
if (Array.isArray(startPos)) {
if (this.options.locations && noCalls === undefined) {
// shift arguments to left by one
left = startLoc;
// flatten startPos
startLoc = startPos[1];
startPos = startPos[0];
}
}
left = left || this.parseBindingAtom();
if (!this.eat(tt.eq)) return left;
var node = this.startNodeAt(startPos, startLoc);
node.operator = "=";
node.left = left;
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentPattern");
};
// Verify that a node is an lval something that can be assigned
// to.
pp.checkLVal = function (expr, isBinding, checkClashes) {
switch (expr.type) {
case "Identifier":
if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
if (checkClashes) {
if (has(checkClashes, expr.name)) this.raise(expr.start, "Argument name clash in strict mode");
checkClashes[expr.name] = true;
}
break;
case "MemberExpression":
if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression");
break;
case "ObjectPattern":
for (var i = 0; i < expr.properties.length; i++) {
this.checkLVal(expr.properties[i].value, isBinding, checkClashes);
}break;
case "ArrayPattern":
for (var i = 0; i < expr.elements.length; i++) {
var elem = expr.elements[i];
if (elem) this.checkLVal(elem, isBinding, checkClashes);
}
break;
case "AssignmentPattern":
this.checkLVal(expr.left, isBinding, checkClashes);
break;
case "RestElement":
this.checkLVal(expr.argument, isBinding, checkClashes);
break;
case "ParenthesizedExpression":
this.checkLVal(expr.expression, isBinding, checkClashes);
break;
default:
this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue");
}
};
},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],10:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
var Parser = _dereq_("./state").Parser;
var SourceLocation = _dereq_("./location").SourceLocation;
// Start an AST node, attaching a start offset.
var pp = Parser.prototype;
var Node = exports.Node = function Node() {
_classCallCheck(this, Node);
};
pp.startNode = function () {
var node = new Node();
node.start = this.start;
if (this.options.locations) node.loc = new SourceLocation(this, this.startLoc);
if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
if (this.options.ranges) node.range = [this.start, 0];
return node;
};
pp.startNodeAt = function (pos, loc) {
var node = new Node();
if (Array.isArray(pos)) {
if (this.options.locations && loc === undefined) {
// flatten pos
loc = pos[1];
pos = pos[0];
}
}
node.start = pos;
if (this.options.locations) node.loc = new SourceLocation(this, loc);
if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
if (this.options.ranges) node.range = [pos, 0];
return node;
};
// Finish an AST node, adding `type` and `end` properties.
pp.finishNode = function (node, type) {
node.type = type;
node.end = this.lastTokEnd;
if (this.options.locations) node.loc.end = this.lastTokEndLoc;
if (this.options.ranges) node.range[1] = this.lastTokEnd;
return node;
};
// Finish node at given position
pp.finishNodeAt = function (node, type, pos, loc) {
node.type = type;
if (Array.isArray(pos)) {
if (this.options.locations && loc === undefined) {
// flatten pos
loc = pos[1];
pos = pos[0];
}
}
node.end = pos;
if (this.options.locations) node.loc.end = loc;
if (this.options.ranges) node.range[1] = pos;
return node;
};
},{"./location":8,"./state":13}],11:[function(_dereq_,module,exports){
// Interpret and default an options object
"use strict";
exports.getOptions = getOptions;
exports.__esModule = true;
var _util = _dereq_("./util");
var has = _util.has;
var isArray = _util.isArray;
var SourceLocation = _dereq_("./location").SourceLocation;
// A second optional argument can be given to further configure
// the parser process. These options are recognized:
var defaultOptions = {
// `ecmaVersion` indicates the ECMAScript version to parse. Must
// be either 3, or 5, or 6. This influences support for strict
// mode, the set of reserved words, support for getters and
// setters and other features.
ecmaVersion: 5,
// Source type ("script" or "module") for different semantics
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called
// when a semicolon is automatically inserted. It will be passed
// th position of the comma as an offset, and if `locations` is
// enabled, it is given the location as a `{line, column}` object
// as second argument.
onInsertedSemicolon: null,
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
// trailing commas.
onTrailingComma: null,
// By default, reserved words are not enforced. Disable
// `allowReserved` to enforce them. When this option has the
// value "never", reserved words and keywords can also not be
// used as property names.
allowReserved: true,
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// appearing at the top of the program.
allowImportExportEverywhere: false,
// When enabled, hashbang directive in the beginning of file
// is allowed and treated as a line comment.
allowHashBang: false,
// When `locations` is on, `loc` properties holding objects with
// `start` and `end` properties in `{line, column}` form (with
// line being 1-based and column 0-based) will be attached to the
// nodes.
locations: false,
// A function can be passed as `onToken` option, which will
// cause Acorn to call that function with object in the same
// format as tokenize() returns. Note that you are not
// allowed to call the parser from the callbackthat will
// corrupt its internal state.
onToken: null,
// A function can be passed as `onComment` option, which will
// cause Acorn to call that function with `(block, text, start,
// end)` parameters whenever a comment is skipped. `block` is a
// boolean indicating whether this is a block (`/* */`) comment,
// `text` is the content of the comment, and `start` and `end` are
// character offsets that denote the start and end of the comment.
// When the `locations` option is on, two more parameters are
// passed, the full `{line, column}` locations of the start and
// end of the comments. Note that you are not allowed to call the
// parser from the callbackthat will corrupt its internal state.
onComment: null,
// Nodes have their start and end characters offsets recorded in
// `start` and `end` properties (directly on the node, rather than
// the `loc` object, which holds line/column data. To also add a
// [semi-standardized][range] `range` property holding a `[start,
// end]` array with the same numbers, set the `ranges` option to
// `true`.
//
// [range]: path_to_url
ranges: false,
// It is possible to parse multiple files into a single AST by
// passing the tree produced by parsing the first file as
// `program` option in subsequent parses. This will add the
// toplevel forms of the parsed file to the `Program` (top) node
// of an existing parse tree.
program: null,
// When `locations` is on, you can pass this to record the source
// file in every node's `loc` object.
sourceFile: null,
// This value, if given, is stored in every node, whether
// `locations` is on or off.
directSourceFile: null,
// When enabled, parenthesized expressions are represented by
// (non-standard) ParenthesizedExpression nodes
preserveParens: false,
plugins: {}
};exports.defaultOptions = defaultOptions;
function getOptions(opts) {
var options = {};
for (var opt in defaultOptions) {
options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt];
}if (isArray(options.onToken)) {
(function () {
var tokens = options.onToken;
options.onToken = function (token) {
return tokens.push(token);
};
})();
}
if (isArray(options.onComment)) options.onComment = pushComment(options, options.onComment);
return options;
}
function pushComment(options, array) {
return function (block, text, start, end, startLoc, endLoc) {
var comment = {
type: block ? "Block" : "Line",
value: text,
start: start,
end: end
};
if (options.locations) comment.loc = new SourceLocation(this, startLoc, endLoc);
if (options.ranges) comment.range = [start, end];
array.push(comment);
};
}
},{"./location":8,"./util":18}],12:[function(_dereq_,module,exports){
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var lineBreak = _dereq_("./whitespace").lineBreak;
var pp = Parser.prototype;
// ## Parser utilities
// Test whether a statement node is the string literal `"use strict"`.
pp.isUseStrict = function (stmt) {
return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.value === "use strict";
};
// Predicate that tests whether the next token is of the given
// type, and if yes, consumes it as a side effect.
pp.eat = function (type) {
if (this.type === type) {
this.next();
return true;
} else {
return false;
}
};
// Tests whether parsed token is a contextual keyword.
pp.isContextual = function (name) {
return this.type === tt.name && this.value === name;
};
// Consumes contextual keyword if possible.
pp.eatContextual = function (name) {
return this.value === name && this.eat(tt.name);
};
// Asserts that following token is given contextual keyword.
pp.expectContextual = function (name) {
if (!this.eatContextual(name)) this.unexpected();
};
// Test whether a semicolon can be inserted at the current position.
pp.canInsertSemicolon = function () {
return this.type === tt.eof || this.type === tt.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
};
pp.insertSemicolon = function () {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon) this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
return true;
}
};
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
pp.semicolon = function () {
if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected();
};
pp.afterTrailingComma = function (tokType) {
if (this.type == tokType) {
if (this.options.onTrailingComma) this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
this.next();
return true;
}
};
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
pp.expect = function (type) {
this.eat(type) || this.unexpected();
};
// Raise an unexpected token error.
pp.unexpected = function (pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token");
};
},{"./state":13,"./tokentype":17,"./whitespace":19}],13:[function(_dereq_,module,exports){
"use strict";
exports.Parser = Parser;
exports.__esModule = true;
var _identifier = _dereq_("./identifier");
var reservedWords = _identifier.reservedWords;
var keywords = _identifier.keywords;
var tt = _dereq_("./tokentype").types;
var lineBreak = _dereq_("./whitespace").lineBreak;
function Parser(options, input, startPos) {
this.options = options;
this.sourceFile = this.options.sourceFile || null;
this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5];
this.isReservedWord = reservedWords[this.options.ecmaVersion];
this.input = input;
// Load plugins
this.loadPlugins(this.options.plugins);
// Set up token state
// The current position of the tokenizer in the input.
if (startPos) {
this.pos = startPos;
this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos));
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
} else {
this.pos = this.lineStart = 0;
this.curLine = 1;
}
// Properties of the current token:
// Its type
this.type = tt.eof;
// For tokens that include more information than their type, the value
this.value = null;
// Its start and end offset
this.start = this.end = this.pos;
// And, if locations are used, the {line, column} object
// corresponding to those offsets
this.startLoc = this.endLoc = null;
// Position information for the previous token
this.lastTokEndLoc = this.lastTokStartLoc = null;
this.lastTokStart = this.lastTokEnd = this.pos;
// The context stack is used to superficially track syntactic
// context to predict whether a regular expression is allowed in a
// given position.
this.context = this.initialContext();
this.exprAllowed = true;
// Figure out if it's a module code.
this.strict = this.inModule = this.options.sourceType === "module";
// Used to signify the start of a potential arrow function
this.potentialArrowAt = -1;
// Flags to track whether we are in a function, a generator.
this.inFunction = this.inGenerator = false;
// Labels in scope.
this.labels = [];
// If enabled, skip leading hashbang line.
if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === "#!") this.skipLineComment(2);
}
Parser.prototype.extend = function (name, f) {
this[name] = f(this[name]);
};
// Registered plugins
var plugins = {};
exports.plugins = plugins;
Parser.prototype.loadPlugins = function (plugins) {
for (var _name in plugins) {
var plugin = exports.plugins[_name];
if (!plugin) throw new Error("Plugin '" + _name + "' not found");
plugin(this, plugins[_name]);
}
};
},{"./identifier":7,"./tokentype":17,"./whitespace":19}],14:[function(_dereq_,module,exports){
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var lineBreak = _dereq_("./whitespace").lineBreak;
var pp = Parser.prototype;
// ### Statement parsing
// Parse a program. Initializes the parser, reads any number of
// statements, and wraps them in a Program node. Optionally takes a
// `program` argument. If present, the statements will be appended
// to its body instead of creating a new node.
pp.parseTopLevel = function (node) {
var first = true;
if (!node.body) node.body = [];
while (this.type !== tt.eof) {
var stmt = this.parseStatement(true, true);
node.body.push(stmt);
if (first && this.isUseStrict(stmt)) this.setStrict(true);
first = false;
}
this.next();
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType;
}
return this.finishNode(node, "Program");
};
var loopLabel = { kind: "loop" },
switchLabel = { kind: "switch" };
// Parse a single statement.
//
// If expecting a statement and finding a slash operator, parse a
// regular expression literal. This is to handle cases like
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
pp.parseStatement = function (declaration, topLevel) {
var starttype = this.type,
node = this.startNode();
// Most types of statements are recognized by the keyword they
// start with. Many are trivial to parse, some require a bit of
// complexity.
switch (starttype) {
case tt._break:case tt._continue:
return this.parseBreakContinueStatement(node, starttype.keyword);
case tt._debugger:
return this.parseDebuggerStatement(node);
case tt._do:
return this.parseDoStatement(node);
case tt._for:
return this.parseForStatement(node);
case tt._function:
if (!declaration && this.options.ecmaVersion >= 6) this.unexpected();
return this.parseFunctionStatement(node);
case tt._class:
if (!declaration) this.unexpected();
return this.parseClass(node, true);
case tt._if:
return this.parseIfStatement(node);
case tt._return:
return this.parseReturnStatement(node);
case tt._switch:
return this.parseSwitchStatement(node);
case tt._throw:
return this.parseThrowStatement(node);
case tt._try:
return this.parseTryStatement(node);
case tt._let:case tt._const:
if (!declaration) this.unexpected(); // NOTE: falls through to _var
case tt._var:
return this.parseVarStatement(node, starttype);
case tt._while:
return this.parseWhileStatement(node);
case tt._with:
return this.parseWithStatement(node);
case tt.braceL:
return this.parseBlock();
case tt.semi:
return this.parseEmptyStatement(node);
case tt._export:
case tt._import:
if (!this.options.allowImportExportEverywhere) {
if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");
if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
}
return starttype === tt._import ? this.parseImport(node) : this.parseExport(node);
// If the statement does not start with a statement keyword or a
// brace, it's an ExpressionStatement or LabeledStatement. We
// simply start parsing an expression, and afterwards, if the
// next token is a colon and the expression was a simple
// Identifier node, we switch to interpreting it as a label.
default:
var maybeName = this.value,
expr = this.parseExpression();
if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) return this.parseLabeledStatement(node, maybeName, expr);else return this.parseExpressionStatement(node, expr);
}
};
pp.parseBreakContinueStatement = function (node, keyword) {
var isBreak = keyword == "break";
this.next();
if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null;else if (this.type !== tt.name) this.unexpected();else {
node.label = this.parseIdent();
this.semicolon();
}
// Verify that there is an actual destination to break or
// continue to.
for (var i = 0; i < this.labels.length; ++i) {
var lab = this.labels[i];
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
if (node.label && isBreak) break;
}
}
if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
};
pp.parseDebuggerStatement = function (node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
};
pp.parseDoStatement = function (node) {
this.next();
this.labels.push(loopLabel);
node.body = this.parseStatement(false);
this.labels.pop();
this.expect(tt._while);
node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6) this.eat(tt.semi);else this.semicolon();
return this.finishNode(node, "DoWhileStatement");
};
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
// the second parameter to `parseExpression`), and then check
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
pp.parseForStatement = function (node) {
this.next();
this.labels.push(loopLabel);
this.expect(tt.parenL);
if (this.type === tt.semi) return this.parseFor(node, null);
if (this.type === tt._var || this.type === tt._let || this.type === tt._const) {
var _init = this.startNode(),
varKind = this.type;
this.next();
this.parseVar(_init, true, varKind);
this.finishNode(_init, "VariableDeclaration");
if ((this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && _init.declarations.length === 1 && !(varKind !== tt._var && _init.declarations[0].init)) return this.parseForIn(node, _init);
return this.parseFor(node, _init);
}
var refShorthandDefaultPos = { start: 0 };
var init = this.parseExpression(true, refShorthandDefaultPos);
if (this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) {
this.toAssignable(init);
this.checkLVal(init);
return this.parseForIn(node, init);
} else if (refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start);
}
return this.parseFor(node, init);
};
pp.parseFunctionStatement = function (node) {
this.next();
return this.parseFunction(node, true);
};
pp.parseIfStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
node.consequent = this.parseStatement(false);
node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null;
return this.finishNode(node, "IfStatement");
};
pp.parseReturnStatement = function (node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction) this.raise(this.start, "'return' outside of function");
this.next();
// In `return` (and `break`/`continue`), the keywords with
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null;else {
node.argument = this.parseExpression();this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
};
pp.parseSwitchStatement = function (node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
this.expect(tt.braceL);
this.labels.push(switchLabel);
// Statements under must be grouped (by label) in SwitchCase
// nodes. `cur` is used to keep the node that we are currently
// adding statements to.
for (var cur, sawDefault; this.type != tt.braceR;) {
if (this.type === tt._case || this.type === tt._default) {
var isCase = this.type === tt._case;
if (cur) this.finishNode(cur, "SwitchCase");
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
cur.test = this.parseExpression();
} else {
if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses");
sawDefault = true;
cur.test = null;
}
this.expect(tt.colon);
} else {
if (!cur) this.unexpected();
cur.consequent.push(this.parseStatement(true));
}
}
if (cur) this.finishNode(cur, "SwitchCase");
this.next(); // Closing brace
this.labels.pop();
return this.finishNode(node, "SwitchStatement");
};
pp.parseThrowStatement = function (node) {
this.next();
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) this.raise(this.lastTokEnd, "Illegal newline after throw");
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
};
// Reused empty array added for node fields that are always empty.
var empty = [];
pp.parseTryStatement = function (node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.type === tt._catch) {
var clause = this.startNode();
this.next();
this.expect(tt.parenL);
clause.param = this.parseBindingAtom();
this.checkLVal(clause.param, true);
this.expect(tt.parenR);
clause.guard = null;
clause.body = this.parseBlock();
node.handler = this.finishNode(clause, "CatchClause");
}
node.guardedHandlers = empty;
node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) this.raise(node.start, "Missing catch or finally clause");
return this.finishNode(node, "TryStatement");
};
pp.parseVarStatement = function (node, kind) {
this.next();
this.parseVar(node, false, kind);
this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
pp.parseWhileStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
this.labels.push(loopLabel);
node.body = this.parseStatement(false);
this.labels.pop();
return this.finishNode(node, "WhileStatement");
};
pp.parseWithStatement = function (node) {
if (this.strict) this.raise(this.start, "'with' in strict mode");
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement(false);
return this.finishNode(node, "WithStatement");
};
pp.parseEmptyStatement = function (node) {
this.next();
return this.finishNode(node, "EmptyStatement");
};
pp.parseLabeledStatement = function (node, maybeName, expr) {
for (var i = 0; i < this.labels.length; ++i) {
if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
}var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null;
this.labels.push({ name: maybeName, kind: kind });
node.body = this.parseStatement(true);
this.labels.pop();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
};
pp.parseExpressionStatement = function (node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
};
// Parse a semicolon-enclosed block of statements, handling `"use
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
pp.parseBlock = function (allowStrict) {
var node = this.startNode(),
first = true,
oldStrict = undefined;
node.body = [];
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
var stmt = this.parseStatement(true);
node.body.push(stmt);
if (first && allowStrict && this.isUseStrict(stmt)) {
oldStrict = this.strict;
this.setStrict(this.strict = true);
}
first = false;
}
if (oldStrict === false) this.setStrict(false);
return this.finishNode(node, "BlockStatement");
};
// Parse a regular `for` loop. The disambiguation code in
// `parseStatement` will already have parsed the init statement or
// expression.
pp.parseFor = function (node, init) {
node.init = init;
this.expect(tt.semi);
node.test = this.type === tt.semi ? null : this.parseExpression();
this.expect(tt.semi);
node.update = this.type === tt.parenR ? null : this.parseExpression();
this.expect(tt.parenR);
node.body = this.parseStatement(false);
this.labels.pop();
return this.finishNode(node, "ForStatement");
};
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
pp.parseForIn = function (node, init) {
var type = this.type === tt._in ? "ForInStatement" : "ForOfStatement";
this.next();
node.left = init;
node.right = this.parseExpression();
this.expect(tt.parenR);
node.body = this.parseStatement(false);
this.labels.pop();
return this.finishNode(node, type);
};
// Parse a list of variable declarations.
pp.parseVar = function (node, isFor, kind) {
node.declarations = [];
node.kind = kind.keyword;
for (;;) {
var decl = this.startNode();
this.parseVarId(decl);
if (this.eat(tt.eq)) {
decl.init = this.parseMaybeAssign(isFor);
} else if (kind === tt._const && !(this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
this.unexpected();
} else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) {
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
} else {
decl.init = null;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(tt.comma)) break;
}
return node;
};
pp.parseVarId = function (decl) {
decl.id = this.parseBindingAtom();
this.checkLVal(decl.id, true);
};
// Parse a function declaration or literal (depending on the
// `isStatement` parameter).
pp.parseFunction = function (node, isStatement, allowExpressionBody) {
this.initFunction(node);
if (this.options.ecmaVersion >= 6) node.generator = this.eat(tt.star);
if (isStatement || this.type === tt.name) node.id = this.parseIdent();
this.parseFunctionParams(node);
this.parseFunctionBody(node, allowExpressionBody);
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
};
pp.parseFunctionParams = function (node) {
this.expect(tt.parenL);
node.params = this.parseBindingList(tt.parenR, false, false);
};
// Parse a class declaration or literal (depending on the
// `isStatement` parameter).
pp.parseClass = function (node, isStatement) {
this.next();
this.parseClassId(node, isStatement);
this.parseClassSuper(node);
var classBody = this.startNode();
var hadConstructor = false;
classBody.body = [];
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
if (this.eat(tt.semi)) continue;
var method = this.startNode();
var isGenerator = this.eat(tt.star);
var isMaybeStatic = this.type === tt.name && this.value === "static";
this.parsePropertyName(method);
method["static"] = isMaybeStatic && this.type !== tt.parenL;
if (method["static"]) {
if (isGenerator) this.unexpected();
isGenerator = this.eat(tt.star);
this.parsePropertyName(method);
}
method.kind = "method";
if (!method.computed) {
var key = method.key;
var isGetSet = false;
if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) {
isGetSet = true;
method.kind = key.name;
key = this.parsePropertyName(method);
}
if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) {
if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");
if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");
if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
method.kind = "constructor";
hadConstructor = true;
}
}
this.parseClassMethod(classBody, method, isGenerator);
}
node.body = this.finishNode(classBody, "ClassBody");
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
pp.parseClassMethod = function (classBody, method, isGenerator) {
method.value = this.parseMethod(isGenerator);
classBody.body.push(this.finishNode(method, "MethodDefinition"));
};
pp.parseClassId = function (node, isStatement) {
node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null;
};
pp.parseClassSuper = function (node) {
node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null;
};
// Parses module export declaration.
pp.parseExport = function (node) {
this.next();
// export * from '...'
if (this.eat(tt.star)) {
this.expectContextual("from");
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration");
}
if (this.eat(tt._default)) {
// export default ...
var expr = this.parseMaybeAssign();
var needsSemi = true;
if (expr.type == "FunctionExpression" || expr.type == "ClassExpression") {
needsSemi = false;
if (expr.id) {
expr.type = expr.type == "FunctionExpression" ? "FunctionDeclaration" : "ClassDeclaration";
}
}
node.declaration = expr;
if (needsSemi) this.semicolon();
return this.finishNode(node, "ExportDefaultDeclaration");
}
// export var|const|let|function|class ...
if (this.shouldParseExportStatement()) {
node.declaration = this.parseStatement(true);
node.specifiers = [];
node.source = null;
} else {
// export { x, y as z } [from '...']
node.declaration = null;
node.specifiers = this.parseExportSpecifiers();
if (this.eatContextual("from")) {
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
} else {
node.source = null;
}
this.semicolon();
}
return this.finishNode(node, "ExportNamedDeclaration");
};
pp.shouldParseExportStatement = function () {
return this.type.keyword;
};
// Parses a comma-separated list of module exports.
pp.parseExportSpecifiers = function () {
var nodes = [],
first = true;
// export { x, y as z } [from '...']
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma);
if (this.afterTrailingComma(tt.braceR)) break;
} else first = false;
var node = this.startNode();
node.local = this.parseIdent(this.type === tt._default);
node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
nodes.push(this.finishNode(node, "ExportSpecifier"));
}
return nodes;
};
// Parses import declaration.
pp.parseImport = function (node) {
this.next();
// import '...'
if (this.type === tt.string) {
node.specifiers = empty;
node.source = this.parseExprAtom();
node.kind = "";
} else {
node.specifiers = this.parseImportSpecifiers();
this.expectContextual("from");
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
// Parses a comma-separated list of module imports.
pp.parseImportSpecifiers = function () {
var nodes = [],
first = true;
if (this.type === tt.name) {
// import defaultObj, { x, y as z } from '...'
var node = this.startNode();
node.local = this.parseIdent();
this.checkLVal(node.local, true);
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
if (!this.eat(tt.comma)) return nodes;
}
if (this.type === tt.star) {
var node = this.startNode();
this.next();
this.expectContextual("as");
node.local = this.parseIdent();
this.checkLVal(node.local, true);
nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"));
return nodes;
}
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma);
if (this.afterTrailingComma(tt.braceR)) break;
} else first = false;
var node = this.startNode();
node.imported = this.parseIdent(true);
node.local = this.eatContextual("as") ? this.parseIdent() : node.imported;
this.checkLVal(node.local, true);
nodes.push(this.finishNode(node, "ImportSpecifier"));
}
return nodes;
};
},{"./state":13,"./tokentype":17,"./whitespace":19}],15:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
// The algorithm used to determine whether a regexp can appear at a
// given point in the program is loosely based on sweet.js' approach.
// See path_to_url
var Parser = _dereq_("./state").Parser;
var tt = _dereq_("./tokentype").types;
var lineBreak = _dereq_("./whitespace").lineBreak;
var TokContext = exports.TokContext = function TokContext(token, isExpr, preserveSpace, override) {
_classCallCheck(this, TokContext);
this.token = token;
this.isExpr = isExpr;
this.preserveSpace = preserveSpace;
this.override = override;
};
var types = {
b_stat: new TokContext("{", false),
b_expr: new TokContext("{", true),
b_tmpl: new TokContext("${", true),
p_stat: new TokContext("(", false),
p_expr: new TokContext("(", true),
q_tmpl: new TokContext("`", true, true, function (p) {
return p.readTmplToken();
}),
f_expr: new TokContext("function", true)
};
exports.types = types;
var pp = Parser.prototype;
pp.initialContext = function () {
return [types.b_stat];
};
pp.braceIsBlock = function (prevType) {
var parent = undefined;
if (prevType === tt.colon && (parent = this.curContext()).token == "{") return !parent.isExpr;
if (prevType === tt._return) return lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof) return true;
if (prevType == tt.braceL) return this.curContext() === types.b_stat;
return !this.exprAllowed;
};
pp.updateContext = function (prevType) {
var update = undefined,
type = this.type;
if (type.keyword && prevType == tt.dot) this.exprAllowed = false;else if (update = type.updateContext) update.call(this, prevType);else this.exprAllowed = type.beforeExpr;
};
// Token-specific context update code
tt.parenR.updateContext = tt.braceR.updateContext = function () {
if (this.context.length == 1) {
this.exprAllowed = true;
return;
}
var out = this.context.pop();
if (out === types.b_stat && this.curContext() === types.f_expr) {
this.context.pop();
this.exprAllowed = false;
} else if (out === types.b_tmpl) {
this.exprAllowed = true;
} else {
this.exprAllowed = !out.isExpr;
}
};
tt.braceL.updateContext = function (prevType) {
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
this.exprAllowed = true;
};
tt.dollarBraceL.updateContext = function () {
this.context.push(types.b_tmpl);
this.exprAllowed = true;
};
tt.parenL.updateContext = function (prevType) {
var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while;
this.context.push(statementParens ? types.p_stat : types.p_expr);
this.exprAllowed = true;
};
tt.incDec.updateContext = function () {};
tt._function.updateContext = function () {
if (this.curContext() !== types.b_stat) this.context.push(types.f_expr);
this.exprAllowed = false;
};
tt.backQuote.updateContext = function () {
if (this.curContext() === types.q_tmpl) this.context.pop();else this.context.push(types.q_tmpl);
this.exprAllowed = false;
};
// tokExprAllowed stays unchanged
},{"./state":13,"./tokentype":17,"./whitespace":19}],16:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
var _identifier = _dereq_("./identifier");
var isIdentifierStart = _identifier.isIdentifierStart;
var isIdentifierChar = _identifier.isIdentifierChar;
var _tokentype = _dereq_("./tokentype");
var tt = _tokentype.types;
var keywordTypes = _tokentype.keywords;
var Parser = _dereq_("./state").Parser;
var SourceLocation = _dereq_("./location").SourceLocation;
var _whitespace = _dereq_("./whitespace");
var lineBreak = _whitespace.lineBreak;
var lineBreakG = _whitespace.lineBreakG;
var isNewLine = _whitespace.isNewLine;
var nonASCIIwhitespace = _whitespace.nonASCIIwhitespace;
// Object type used to represent tokens. Note that normally, tokens
// simply exist as properties on the parser object. This is only
// used for the onToken callback and the external tokenizer.
var Token = exports.Token = function Token(p) {
_classCallCheck(this, Token);
this.type = p.type;
this.value = p.value;
this.start = p.start;
this.end = p.end;
if (p.options.locations) this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
if (p.options.ranges) this.range = [p.start, p.end];
};
// ## Tokenizer
var pp = Parser.prototype;
// Are we running under Rhino?
var isRhino = typeof Packages !== "undefined";
// Move to the next token
pp.next = function () {
if (this.options.onToken) this.options.onToken(new Token(this));
this.lastTokEnd = this.end;
this.lastTokStart = this.start;
this.lastTokEndLoc = this.endLoc;
this.lastTokStartLoc = this.startLoc;
this.nextToken();
};
pp.getToken = function () {
this.next();
return new Token(this);
};
// If we're in an ES6 environment, make parsers iterable
if (typeof Symbol !== "undefined") pp[Symbol.iterator] = function () {
var self = this;
return { next: function next() {
var token = self.getToken();
return {
done: token.type === tt.eof,
value: token
};
} };
};
// Toggle strict mode. Re-reads the next number or string to please
// pedantic tests (`"use strict"; 010;` should fail).
pp.setStrict = function (strict) {
this.strict = strict;
if (this.type !== tt.num && this.type !== tt.string) return;
this.pos = this.start;
if (this.options.locations) {
while (this.pos < this.lineStart) {
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;
--this.curLine;
}
}
this.nextToken();
};
pp.curContext = function () {
return this.context[this.context.length - 1];
};
// Read a single token, updating the parser object's token-related
// properties.
pp.nextToken = function () {
var curContext = this.curContext();
if (!curContext || !curContext.preserveSpace) this.skipSpace();
this.start = this.pos;
if (this.options.locations) this.startLoc = this.curPosition();
if (this.pos >= this.input.length) return this.finishToken(tt.eof);
if (curContext.override) return curContext.override(this);else this.readToken(this.fullCharCodeAtPos());
};
pp.readToken = function (code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that.
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) return this.readWord();
return this.getTokenFromCode(code);
};
pp.fullCharCodeAtPos = function () {
var code = this.input.charCodeAt(this.pos);
if (code <= 55295 || code >= 57344) return code;
var next = this.input.charCodeAt(this.pos + 1);
return (code << 10) + next - 56613888;
};
pp.skipBlockComment = function () {
var startLoc = this.options.onComment && this.options.locations && this.curPosition();
var start = this.pos,
end = this.input.indexOf("*/", this.pos += 2);
if (end === -1) this.raise(this.pos - 2, "Unterminated comment");
this.pos = end + 2;
if (this.options.locations) {
lineBreakG.lastIndex = start;
var match = undefined;
while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
++this.curLine;
this.lineStart = match.index + match[0].length;
}
}
if (this.options.onComment) this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, startLoc, this.options.locations && this.curPosition());
};
pp.skipLineComment = function (startSkip) {
var start = this.pos;
var startLoc = this.options.onComment && this.options.locations && this.curPosition();
var ch = this.input.charCodeAt(this.pos += startSkip);
while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
++this.pos;
ch = this.input.charCodeAt(this.pos);
}
if (this.options.onComment) this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, startLoc, this.options.locations && this.curPosition());
};
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
pp.skipSpace = function () {
while (this.pos < this.input.length) {
var ch = this.input.charCodeAt(this.pos);
if (ch === 32) {
// ' '
++this.pos;
} else if (ch === 13) {
++this.pos;
var next = this.input.charCodeAt(this.pos);
if (next === 10) {
++this.pos;
}
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
} else if (ch === 10 || ch === 8232 || ch === 8233) {
++this.pos;
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
} else if (ch > 8 && ch < 14) {
++this.pos;
} else if (ch === 47) {
// '/'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 42) {
// '*'
this.skipBlockComment();
} else if (next === 47) {
// '/'
this.skipLineComment(2);
} else break;
} else if (ch === 160) {
// '\xa0'
++this.pos;
} else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
++this.pos;
} else {
break;
}
}
};
// Called at the end of every token. Sets `end`, `val`, and
// maintains `context` and `exprAllowed`, and skips the space after
// the token, so that the next one's `start` will point at the
// right position.
pp.finishToken = function (type, val) {
this.end = this.pos;
if (this.options.locations) this.endLoc = this.curPosition();
var prevType = this.type;
this.type = type;
this.value = val;
this.updateContext(prevType);
};
// ### Token reading
// This is the function that is called to fetch the next token. It
// is somewhat obscure, because it works in character codes rather
// than characters, and because operator parsing has been inlined
// into it.
//
// All in the name of speed.
//
pp.readToken_dot = function () {
var next = this.input.charCodeAt(this.pos + 1);
if (next >= 48 && next <= 57) return this.readNumber(true);
var next2 = this.input.charCodeAt(this.pos + 2);
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {
// 46 = dot '.'
this.pos += 3;
return this.finishToken(tt.ellipsis);
} else {
++this.pos;
return this.finishToken(tt.dot);
}
};
pp.readToken_slash = function () {
// '/'
var next = this.input.charCodeAt(this.pos + 1);
if (this.exprAllowed) {
++this.pos;return this.readRegexp();
}
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(tt.slash, 1);
};
pp.readToken_mult_modulo = function (code) {
// '%*'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(code === 42 ? tt.star : tt.modulo, 1);
};
pp.readToken_pipe_amp = function (code) {
// '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2);
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1);
};
pp.readToken_caret = function () {
// '^'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(tt.bitwiseXOR, 1);
};
pp.readToken_plus_min = function (code) {
// '+-'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {
// A `-->` line comment
this.skipLineComment(3);
this.skipSpace();
return this.nextToken();
}
return this.finishOp(tt.incDec, 2);
}
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(tt.plusMin, 1);
};
pp.readToken_lt_gt = function (code) {
// '<>'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1);
return this.finishOp(tt.bitShift, size);
}
if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) {
if (this.inModule) this.unexpected();
// `<!--`, an XML-style comment that should be interpreted as a line comment
this.skipLineComment(4);
this.skipSpace();
return this.nextToken();
}
if (next === 61) size = this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2;
return this.finishOp(tt.relational, size);
};
pp.readToken_eq_excl = function (code) {
// '=!'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) {
// '=>'
this.pos += 2;
return this.finishToken(tt.arrow);
}
return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1);
};
pp.getTokenFromCode = function (code) {
switch (code) {
// The interpretation of a dot depends on whether it is followed
// by a digit or another two dots.
case 46:
// '.'
return this.readToken_dot();
// Punctuation tokens.
case 40:
++this.pos;return this.finishToken(tt.parenL);
case 41:
++this.pos;return this.finishToken(tt.parenR);
case 59:
++this.pos;return this.finishToken(tt.semi);
case 44:
++this.pos;return this.finishToken(tt.comma);
case 91:
++this.pos;return this.finishToken(tt.bracketL);
case 93:
++this.pos;return this.finishToken(tt.bracketR);
case 123:
++this.pos;return this.finishToken(tt.braceL);
case 125:
++this.pos;return this.finishToken(tt.braceR);
case 58:
++this.pos;return this.finishToken(tt.colon);
case 63:
++this.pos;return this.finishToken(tt.question);
case 96:
// '`'
if (this.options.ecmaVersion < 6) break;
++this.pos;
return this.finishToken(tt.backQuote);
case 48:
// '0'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
if (this.options.ecmaVersion >= 6) {
if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
}
// Anything else beginning with a digit is an integer, octal
// number, or float.
case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
// 1-9
return this.readNumber(false);
// Quotes produce strings.
case 34:case 39:
// '"', "'"
return this.readString(code);
// Operators are parsed inline in tiny state machines. '=' (61) is
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
case 47:
// '/'
return this.readToken_slash();
case 37:case 42:
// '%*'
return this.readToken_mult_modulo(code);
case 124:case 38:
// '|&'
return this.readToken_pipe_amp(code);
case 94:
// '^'
return this.readToken_caret();
case 43:case 45:
// '+-'
return this.readToken_plus_min(code);
case 60:case 62:
// '<>'
return this.readToken_lt_gt(code);
case 61:case 33:
// '=!'
return this.readToken_eq_excl(code);
case 126:
// '~'
return this.finishOp(tt.prefix, 1);
}
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
pp.finishOp = function (type, size) {
var str = this.input.slice(this.pos, this.pos + size);
this.pos += size;
return this.finishToken(type, str);
};
var regexpUnicodeSupport = false;
try {
new RegExp("", "u");regexpUnicodeSupport = true;
} catch (e) {}
// Parse a regular expression. Some context-awareness is necessary,
// since a '/' inside a '[]' set does not end the expression.
pp.readRegexp = function () {
var escaped = undefined,
inClass = undefined,
start = this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(start, "Unterminated regular expression");
var ch = this.input.charAt(this.pos);
if (lineBreak.test(ch)) this.raise(start, "Unterminated regular expression");
if (!escaped) {
if (ch === "[") inClass = true;else if (ch === "]" && inClass) inClass = false;else if (ch === "/" && !inClass) break;
escaped = ch === "\\";
} else escaped = false;
++this.pos;
}
var content = this.input.slice(start, this.pos);
++this.pos;
// Need to use `readWord1` because '\uXXXX' sequences are allowed
// here (don't ask).
var mods = this.readWord1();
var tmp = content;
if (mods) {
var validFlags = /^[gmsiy]*$/;
if (this.options.ecmaVersion >= 6) validFlags = /^[gmsiyu]*$/;
if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag");
if (mods.indexOf("u") >= 0 && !regexpUnicodeSupport) {
// Replace each astral symbol and every Unicode escape sequence that
// possibly represents an astral symbol or a paired surrogate with a
// single ASCII symbol to avoid throwing on regular expressions that
// are only valid in combination with the `/u` flag.
// Note: replacing with the ASCII symbol `x` might cause false
// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
// perfectly valid pattern that is equivalent to `[a-b]`, but it would
// be replaced by `[x-b]` which throws an error.
tmp = tmp.replace(/\\u([a-fA-F0-9]{4})|\\u\{([0-9a-fA-F]+)\}|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x");
}
}
// Detect invalid regular expressions.
var value = null;
// Rhino's regular expression parser is flaky and throws uncatchable exceptions,
// so don't do detection if we are running under Rhino
if (!isRhino) {
try {
new RegExp(tmp);
} catch (e) {
if (e instanceof SyntaxError) this.raise(start, "Error parsing regular expression: " + e.message);
this.raise(e);
}
// Get a regular expression object for this pattern-flag pair, or `null` in
// case the current environment doesn't support the flags it uses.
try {
value = new RegExp(content, mods);
} catch (err) {}
}
return this.finishToken(tt.regexp, { pattern: content, flags: mods, value: value });
};
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
pp.readInt = function (radix, len) {
var start = this.pos,
total = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
var code = this.input.charCodeAt(this.pos),
val = undefined;
if (code >= 97) val = code - 97 + 10; // a
else if (code >= 65) val = code - 65 + 10; // A
else if (code >= 48 && code <= 57) val = code - 48; // 0-9
else val = Infinity;
if (val >= radix) break;
++this.pos;
total = total * radix + val;
}
if (this.pos === start || len != null && this.pos - start !== len) return null;
return total;
};
pp.readRadixNumber = function (radix) {
this.pos += 2; // 0x
var val = this.readInt(radix);
if (val == null) this.raise(this.start + 2, "Expected number in radix " + radix);
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");
return this.finishToken(tt.num, val);
};
// Read an integer, octal integer, or floating-point number.
pp.readNumber = function (startsWithDot) {
var start = this.pos,
isFloat = false,
octal = this.input.charCodeAt(this.pos) === 48;
if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");
if (this.input.charCodeAt(this.pos) === 46) {
++this.pos;
this.readInt(10);
isFloat = true;
}
var next = this.input.charCodeAt(this.pos);
if (next === 69 || next === 101) {
// 'eE'
next = this.input.charCodeAt(++this.pos);
if (next === 43 || next === 45) ++this.pos; // '+-'
if (this.readInt(10) === null) this.raise(start, "Invalid number");
isFloat = true;
}
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");
var str = this.input.slice(start, this.pos),
val = undefined;
if (isFloat) val = parseFloat(str);else if (!octal || str.length === 1) val = parseInt(str, 10);else if (/[89]/.test(str) || this.strict) this.raise(start, "Invalid number");else val = parseInt(str, 8);
return this.finishToken(tt.num, val);
};
// Read a string value, interpreting backslash-escapes.
pp.readCodePoint = function () {
var ch = this.input.charCodeAt(this.pos),
code = undefined;
if (ch === 123) {
if (this.options.ecmaVersion < 6) this.unexpected();
++this.pos;
code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
++this.pos;
if (code > 1114111) this.unexpected();
} else {
code = this.readHexChar(4);
}
return code;
};
function codePointToString(code) {
// UTF-16 Decoding
if (code <= 65535) {
return String.fromCharCode(code);
}return String.fromCharCode((code - 65536 >> 10) + 55296, (code - 65536 & 1023) + 56320);
}
pp.readString = function (quote) {
var out = "",
chunkStart = ++this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated string constant");
var ch = this.input.charCodeAt(this.pos);
if (ch === quote) break;
if (ch === 92) {
// '\'
out += this.input.slice(chunkStart, this.pos);
out += this.readEscapedChar();
chunkStart = this.pos;
} else {
if (isNewLine(ch)) this.raise(this.start, "Unterminated string constant");
++this.pos;
}
}
out += this.input.slice(chunkStart, this.pos++);
return this.finishToken(tt.string, out);
};
// Reads template string tokens.
pp.readTmplToken = function () {
var out = "",
chunkStart = this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template");
var ch = this.input.charCodeAt(this.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
// '`', '${'
if (this.pos === this.start && this.type === tt.template) {
if (ch === 36) {
this.pos += 2;
return this.finishToken(tt.dollarBraceL);
} else {
++this.pos;
return this.finishToken(tt.backQuote);
}
}
out += this.input.slice(chunkStart, this.pos);
return this.finishToken(tt.template, out);
}
if (ch === 92) {
// '\'
out += this.input.slice(chunkStart, this.pos);
out += this.readEscapedChar();
chunkStart = this.pos;
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.pos);
++this.pos;
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
++this.pos;
out += "\n";
} else {
out += String.fromCharCode(ch);
}
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
chunkStart = this.pos;
} else {
++this.pos;
}
}
};
// Used to read escaped characters
pp.readEscapedChar = function () {
var ch = this.input.charCodeAt(++this.pos);
var octal = /^[0-7]+/.exec(this.input.slice(this.pos, this.pos + 3));
if (octal) octal = octal[0];
while (octal && parseInt(octal, 8) > 255) octal = octal.slice(0, -1);
if (octal === "0") octal = null;
++this.pos;
if (octal) {
if (this.strict) this.raise(this.pos - 2, "Octal literal in strict mode");
this.pos += octal.length - 1;
return String.fromCharCode(parseInt(octal, 8));
} else {
switch (ch) {
case 110:
return "\n"; // 'n' -> '\n'
case 114:
return "\r"; // 'r' -> '\r'
case 120:
return String.fromCharCode(this.readHexChar(2)); // 'x'
case 117:
return codePointToString(this.readCodePoint()); // 'u'
case 116:
return "\t"; // 't' -> '\t'
case 98:
return "\b"; // 'b' -> '\b'
case 118:
return "\u000b"; // 'v' -> '\u000b'
case 102:
return "\f"; // 'f' -> '\f'
case 48:
return "\u0000"; // 0 -> '\0'
case 13:
if (this.input.charCodeAt(this.pos) === 10) ++this.pos; // '\r\n'
case 10:
// ' \n'
if (this.options.locations) {
this.lineStart = this.pos;++this.curLine;
}
return "";
default:
return String.fromCharCode(ch);
}
}
};
// Used to read character escape sequences ('\x', '\u', '\U').
pp.readHexChar = function (len) {
var n = this.readInt(16, len);
if (n === null) this.raise(this.start, "Bad character escape sequence");
return n;
};
// Used to signal to callers of `readWord1` whether the word
// contained any escape sequences. This is needed because words with
// escape sequences must not be interpreted as keywords.
var containsEsc;
// Read an identifier, and return it as a string. Sets `containsEsc`
// to whether the word contained a '\u' escape.
//
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
pp.readWord1 = function () {
containsEsc = false;
var word = "",
first = true,
chunkStart = this.pos;
var astral = this.options.ecmaVersion >= 6;
while (this.pos < this.input.length) {
var ch = this.fullCharCodeAtPos();
if (isIdentifierChar(ch, astral)) {
this.pos += ch <= 65535 ? 1 : 2;
} else if (ch === 92) {
// "\"
containsEsc = true;
word += this.input.slice(chunkStart, this.pos);
var escStart = this.pos;
if (this.input.charCodeAt(++this.pos) != 117) // "u"
this.raise(this.pos, "Expecting Unicode escape sequence \\uXXXX");
++this.pos;
var esc = this.readCodePoint();
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) this.raise(escStart, "Invalid Unicode escape");
word += codePointToString(esc);
chunkStart = this.pos;
} else {
break;
}
first = false;
}
return word + this.input.slice(chunkStart, this.pos);
};
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
pp.readWord = function () {
var word = this.readWord1();
var type = tt.name;
if ((this.options.ecmaVersion >= 6 || !containsEsc) && this.isKeyword(word)) type = keywordTypes[word];
return this.finishToken(type, word);
};
},{"./identifier":7,"./location":8,"./state":13,"./tokentype":17,"./whitespace":19}],17:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
// ## Token types
// The assignment of fine-grained, information-carrying type objects
// allows the tokenizer to store the information it has about a
// token in a way that is very cheap for the parser to look up.
// All token type variables start with an underscore, to make them
// easy to recognize.
// The `beforeExpr` property is used to disambiguate between regular
// expressions and divisions. It is set on all token types that can
// be followed by an expression (thus, a slash after them would be a
// regular expression).
//
// `isLoop` marks a keyword as starting a loop, which is important
// to know when parsing a label, in order to allow or disallow
// continue jumps to that label.
var TokenType = exports.TokenType = function TokenType(label) {
var conf = arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, TokenType);
this.label = label;
this.keyword = conf.keyword;
this.beforeExpr = !!conf.beforeExpr;
this.startsExpr = !!conf.startsExpr;
this.isLoop = !!conf.isLoop;
this.isAssign = !!conf.isAssign;
this.prefix = !!conf.prefix;
this.postfix = !!conf.postfix;
this.binop = conf.binop || null;
this.updateContext = null;
};
function binop(name, prec) {
return new TokenType(name, { beforeExpr: true, binop: prec });
}
var beforeExpr = { beforeExpr: true },
startsExpr = { startsExpr: true };
var types = {
num: new TokenType("num", startsExpr),
regexp: new TokenType("regexp", startsExpr),
string: new TokenType("string", startsExpr),
name: new TokenType("name", startsExpr),
eof: new TokenType("eof"),
// Punctuation token types.
bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
bracketR: new TokenType("]"),
braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
braceR: new TokenType("}"),
parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
// Operators. These carry several kinds of properties to help the
// parser use them properly (the presence of these properties is
// what categorizes them as operators).
//
// `binop`, when present, specifies that this operator is a binary
// operator, and will refer to its precedence.
//
// `prefix` and `postfix` mark the operator as a prefix or postfix
// unary operator.
//
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
// binary operators with a very low precedence, that should result
// in AssignmentExpression nodes.
eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
prefix: new TokenType("prefix", { beforeExpr: true, prefix: true, startsExpr: true }),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=", 6),
relational: binop("</>", 7),
bitShift: binop("<</>>", 8),
plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10)
};
exports.types = types;
// Map keyword names to token types.
var keywords = {};
exports.keywords = keywords;
// Succinct definitions of keyword token types
function kw(name) {
var options = arguments[1] === undefined ? {} : arguments[1];
options.keyword = name;
keywords[name] = types["_" + name] = new TokenType(name, options);
}
kw("break");
kw("case", beforeExpr);
kw("catch");
kw("continue");
kw("debugger");
kw("default");
kw("do", { isLoop: true });
kw("else", beforeExpr);
kw("finally");
kw("for", { isLoop: true });
kw("function", startsExpr);
kw("if");
kw("return", beforeExpr);
kw("switch");
kw("throw", beforeExpr);
kw("try");
kw("var");
kw("let");
kw("const");
kw("while", { isLoop: true });
kw("with");
kw("new", { beforeExpr: true, startsExpr: true });
kw("this", startsExpr);
kw("super", startsExpr);
kw("class");
kw("extends", beforeExpr);
kw("export");
kw("import");
kw("yield", { beforeExpr: true, startsExpr: true });
kw("null", startsExpr);
kw("true", startsExpr);
kw("false", startsExpr);
kw("in", { beforeExpr: true, binop: 7 });
kw("instanceof", { beforeExpr: true, binop: 7 });
kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true });
kw("void", { beforeExpr: true, prefix: true, startsExpr: true });
kw("delete", { beforeExpr: true, prefix: true, startsExpr: true });
},{}],18:[function(_dereq_,module,exports){
"use strict";
exports.isArray = isArray;
// Checks if an object has a property.
exports.has = has;
exports.__esModule = true;
function isArray(obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
}
function has(obj, propName) {
return Object.prototype.hasOwnProperty.call(obj, propName);
}
},{}],19:[function(_dereq_,module,exports){
"use strict";
exports.isNewLine = isNewLine;
exports.__esModule = true;
// Matches a whole line break (where CRLF is considered a single
// line break). Used to count lines.
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
exports.lineBreak = lineBreak;
var lineBreakG = new RegExp(lineBreak.source, "g");
exports.lineBreakG = lineBreakG;
function isNewLine(code) {
return code === 10 || code === 13 || code === 8232 || code == 8233;
}
var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
exports.nonASCIIwhitespace = nonASCIIwhitespace;
},{}]},{},[1])(1)
});
``` | /content/code_sandbox/node_modules/acorn/dist/acorn_csp.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 34,723 |
```javascript
/** vim: et:ts=4:sw=4:sts=4
* Available via the MIT or new BSD license.
* see: path_to_url for details
*/
/*jslint node: true */
/*global module, process */
'use strict';
/**
* Creates a define for node.
* @param {Object} module the "module" object that is defined by Node for the
* current module.
* @param {Function} [requireFn]. Node's require function for the current module.
* It only needs to be passed in Node versions before 0.5, when module.require
* did not exist.
* @returns {Function} a define function that is usable for the current node
* module.
*/
function amdefine(module, requireFn) {
'use strict';
var defineCache = {},
loaderCache = {},
alreadyCalled = false,
path = require('path'),
makeRequire, stringRequire;
/**
* Trims the . and .. from an array of path segments.
* It will keep a leading path segment if a .. will become
* the first path segment, to help with module name lookups,
* which act like paths, but can be remapped. But the end result,
* all paths that use this function should look normalized.
* NOTE: this method MODIFIES the input array.
* @param {Array} ary the array of path segments.
*/
function trimDots(ary) {
var i, part;
for (i = 0; ary[i]; i+= 1) {
part = ary[i];
if (part === '.') {
ary.splice(i, 1);
i -= 1;
} else if (part === '..') {
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
ary.splice(i - 1, 2);
i -= 2;
}
}
}
}
function normalize(name, baseName) {
var baseParts;
//Adjust any relative paths.
if (name && name.charAt(0) === '.') {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
baseParts = baseName.split('/');
baseParts = baseParts.slice(0, baseParts.length - 1);
baseParts = baseParts.concat(name.split('/'));
trimDots(baseParts);
name = baseParts.join('/');
}
}
return name;
}
/**
* Create the normalize() function passed to a loader plugin's
* normalize method.
*/
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
};
}
function makeLoad(id) {
function load(value) {
loaderCache[id] = value;
}
load.fromText = function (id, text) {
//This one is difficult because the text can/probably uses
//define, and any relative paths and requires should be relative
//to that id was it would be found on disk. But this would require
//bootstrapping a module/require fairly deeply from node core.
//Not sure how best to go about that yet.
throw new Error('amdefine does not implement load.fromText');
};
return load;
}
makeRequire = function (systemRequire, exports, module, relId) {
function amdRequire(deps, callback) {
if (typeof deps === 'string') {
//Synchronous, single module require('')
return stringRequire(systemRequire, exports, module, deps, relId);
} else {
//Array of dependencies with a callback.
//Convert the dependencies to modules.
deps = deps.map(function (depName) {
return stringRequire(systemRequire, exports, module, depName, relId);
});
//Wait for next tick to call back the require call.
if (callback) {
process.nextTick(function () {
callback.apply(null, deps);
});
}
}
}
amdRequire.toUrl = function (filePath) {
if (filePath.indexOf('.') === 0) {
return normalize(filePath, path.dirname(module.filename));
} else {
return filePath;
}
};
return amdRequire;
};
//Favor explicit value, passed in if the module wants to support Node 0.4.
requireFn = requireFn || function req() {
return module.require.apply(module, arguments);
};
function runFactory(id, deps, factory) {
var r, e, m, result;
if (id) {
e = loaderCache[id] = {};
m = {
id: id,
uri: __filename,
exports: e
};
r = makeRequire(requireFn, e, m, id);
} else {
//Only support one define call per file
if (alreadyCalled) {
throw new Error('amdefine with no module ID cannot be called more than once per file.');
}
alreadyCalled = true;
//Use the real variables from node
//Use module.exports for exports, since
//the exports in here is amdefine exports.
e = module.exports;
m = module;
r = makeRequire(requireFn, e, m, module.id);
}
//If there are dependencies, they are strings, so need
//to convert them to dependency values.
if (deps) {
deps = deps.map(function (depName) {
return r(depName);
});
}
//Call the factory with the right dependencies.
if (typeof factory === 'function') {
result = factory.apply(m.exports, deps);
} else {
result = factory;
}
if (result !== undefined) {
m.exports = result;
if (id) {
loaderCache[id] = m.exports;
}
}
}
stringRequire = function (systemRequire, exports, module, id, relId) {
//Split the ID by a ! so that
var index = id.indexOf('!'),
originalId = id,
prefix, plugin;
if (index === -1) {
id = normalize(id, relId);
//Straight module lookup. If it is one of the special dependencies,
//deal with it, otherwise, delegate to node.
if (id === 'require') {
return makeRequire(systemRequire, exports, module, relId);
} else if (id === 'exports') {
return exports;
} else if (id === 'module') {
return module;
} else if (loaderCache.hasOwnProperty(id)) {
return loaderCache[id];
} else if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
} else {
if(systemRequire) {
return systemRequire(originalId);
} else {
throw new Error('No module with ID: ' + id);
}
}
} else {
//There is a plugin in play.
prefix = id.substring(0, index);
id = id.substring(index + 1, id.length);
plugin = stringRequire(systemRequire, exports, module, prefix, relId);
if (plugin.normalize) {
id = plugin.normalize(id, makeNormalize(relId));
} else {
//Normalize the ID normally.
id = normalize(id, relId);
}
if (loaderCache[id]) {
return loaderCache[id];
} else {
plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
return loaderCache[id];
}
}
};
//Create a define function specific to the module asking for amdefine.
function define(id, deps, factory) {
if (Array.isArray(id)) {
factory = deps;
deps = id;
id = undefined;
} else if (typeof id !== 'string') {
factory = id;
id = deps = undefined;
}
if (deps && !Array.isArray(deps)) {
factory = deps;
deps = undefined;
}
if (!deps) {
deps = ['require', 'exports', 'module'];
}
//Set up properties for this module. If an ID, then use
//internal cache. If no ID, then use the external variables
//for this node module.
if (id) {
//Put the module in deep freeze until there is a
//require call for it.
defineCache[id] = [id, deps, factory];
} else {
runFactory(id, deps, factory);
}
}
//define.require, which has access to all the values in the
//cache. Useful for AMD modules that all have IDs in the file,
//but need to finally export a value to node based on one of those
//IDs.
define.require = function (id) {
if (loaderCache[id]) {
return loaderCache[id];
}
if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
}
};
define.amd = {};
return define;
}
module.exports = amdefine;
``` | /content/code_sandbox/node_modules/amdefine/amdefine.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,088 |
```javascript
/*jshint node: true */
var inserted,
Module = require('module'),
fs = require('fs'),
existingExtFn = Module._extensions['.js'],
amdefineRegExp = /amdefine\.js/;
inserted = "if (typeof define !== 'function') {var define = require('amdefine')(module)}";
//From the node/lib/module.js source:
function stripBOM(content) {
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
// because the buffer-to-string conversion in `fs.readFileSync()`
// translates it to FEFF, the UTF-16 BOM.
if (content.charCodeAt(0) === 0xFEFF) {
content = content.slice(1);
}
return content;
}
//Also adapted from the node/lib/module.js source:
function intercept(module, filename) {
var content = stripBOM(fs.readFileSync(filename, 'utf8'));
if (!amdefineRegExp.test(module.id)) {
content = inserted + content;
}
module._compile(content, filename);
}
intercept._id = 'amdefine/intercept';
if (!existingExtFn._id || existingExtFn._id !== intercept._id) {
Module._extensions['.js'] = intercept;
}
``` | /content/code_sandbox/node_modules/amdefine/intercept.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 274 |
```javascript
var tape = require('tape')
, EE = require('events').EventEmitter
, util = require('util')
, isStream = require('./')
, isReadable = require('./').isReadable
, isWritable = require('./').isWritable
, isDuplex = require('./').isDuplex
, CoreStreams = require('stream')
, ReadableStream10 = require('./readable-stream-1.0/')
, ReadableStream11 = require('./readable-stream-1.1/')
function test (pass, type, stream) {
tape('isStream(' + type + ')', function (t) {
t.plan(1)
t.ok(pass === isStream(stream), type)
})
}
function testReadable (pass, type, stream) {
tape('isReadable(' + type + ')', function (t) {
t.plan(1)
t.ok(pass === isReadable(stream), type)
})
}
function testWritable (pass, type, stream) {
tape('isWritable(' + type + ')', function (t) {
t.plan(1)
t.ok(pass === isWritable(stream), type)
})
}
function testDuplex (pass, type, stream) {
tape('isDuplex(' + type + ')', function (t) {
t.plan(1)
t.ok(pass === isDuplex(stream), type)
})
}
[ undefined, null, '', true, false, 0, 1, 1.0, 'string', {}, function foo () {} ].forEach(function (o) {
test(false, 'non-stream / primitive: ' + (JSON.stringify(o) || (o && o.toString()) || o), o)
})
test(false, 'fake stream obj', { pipe: function () {} })
;(function () {
// looks like a stream!
function Stream () {
EE.call(this)
}
util.inherits(Stream, EE)
Stream.prototype.pipe = function () {}
Stream.Stream = Stream
test(false, 'fake stream "new Stream()"', new Stream())
}())
test(true, 'CoreStreams.Stream', new (CoreStreams.Stream)())
test(true, 'CoreStreams.Readable', new (CoreStreams.Readable)())
test(true, 'CoreStreams.Writable', new (CoreStreams.Writable)())
test(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
test(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
test(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
test(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
test(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
test(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
test(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
test(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
test(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
test(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
test(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
test(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
test(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
testReadable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)())
testReadable(true, 'CoreStreams.Readable', new (CoreStreams.Readable)())
testReadable(false, 'CoreStreams.Writable', new (CoreStreams.Writable)())
testReadable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
testReadable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
testReadable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
testReadable(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
testReadable(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
testReadable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
testReadable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
testReadable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
testReadable(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
testReadable(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
testReadable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
testReadable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
testReadable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
testWritable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)())
testWritable(false, 'CoreStreams.Readable', new (CoreStreams.Readable)())
testWritable(true, 'CoreStreams.Writable', new (CoreStreams.Writable)())
testWritable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
testWritable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
testWritable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
testWritable(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
testWritable(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
testWritable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
testWritable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
testWritable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
testWritable(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
testWritable(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
testWritable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
testWritable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
testWritable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
testDuplex(false, 'CoreStreams.Stream', new (CoreStreams.Stream)())
testDuplex(false, 'CoreStreams.Readable', new (CoreStreams.Readable)())
testDuplex(false, 'CoreStreams.Writable', new (CoreStreams.Writable)())
testDuplex(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
testDuplex(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
testDuplex(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
testDuplex(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
testDuplex(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
testDuplex(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
testDuplex(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
testDuplex(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
testDuplex(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
testDuplex(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
testDuplex(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
testDuplex(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
testDuplex(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
;[ CoreStreams, ReadableStream10, ReadableStream11 ].forEach(function (p) {
[ 'Stream', 'Readable', 'Writable', 'Duplex', 'Transform', 'PassThrough' ].forEach(function (k) {
if (!p[k])
return
function SubStream () {
p[k].call(this)
}
util.inherits(SubStream, p[k])
test(true, 'Stream subclass: ' + p.name + '.' + k, new SubStream())
})
})
``` | /content/code_sandbox/node_modules/isstream/test.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,792 |
```javascript
var stream = require('stream')
function isStream (obj) {
return obj instanceof stream.Stream
}
function isReadable (obj) {
return isStream(obj) && typeof obj._read == 'function' && typeof obj._readableState == 'object'
}
function isWritable (obj) {
return isStream(obj) && typeof obj._write == 'function' && typeof obj._writableState == 'object'
}
function isDuplex (obj) {
return isReadable(obj) && isWritable(obj)
}
module.exports = isStream
module.exports.isReadable = isReadable
module.exports.isWritable = isWritable
module.exports.isDuplex = isDuplex
``` | /content/code_sandbox/node_modules/isstream/isstream.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 145 |
```javascript
/* It is important to test our Javascript output as well as our coffeescript,
* since code that is transpiled may be slightly different in effect from the
* original.
*
* Run these tests (against lib/netmask.js, not lib/netmask.coffee directly)
* using mocha, after re-generating lib/netmask.js including your changes:
*
* mocha tests/netmask.js
*/
const assert = require('assert');
const Netmask = require('../').Netmask;
describe('Netmask', () => {
describe('can build a block', () => {
let block = new Netmask('10.1.2.0/24');
it('should contain a sub-block', () => {
let block1 = new Netmask('10.1.2.10/29');
assert(block.contains(block1));
});
it('should contain another sub-block', () => {
let block2 = new Netmask('10.1.2.10/31');
assert(block.contains(block2));
});
it('should contain a third sub-block', () => {
let block3 = new Netmask('10.1.2.20/32');
assert(block.contains(block3));
});
});
describe('when presented with an octet which is not a number', () => {
let block = new Netmask('192.168.0.0/29')
it('should throw', () => {
assert.throws(() => block.contains('192.168.~.4'), Error);
});
});
describe('can handle hexadecimal, octal, & decimal octets in input IP', () => {
let block1 = new Netmask('31.0.0.0/19');
let block2 = new Netmask('127.0.0.0/8');
let block3 = new Netmask('255.0.0.1/12');
let block4 = new Netmask('10.0.0.1/8');
let block5 = new Netmask('1.0.0.1/4');
describe('octal', () => {
it('block 31.0.0.0/19 does not contain 031.0.5.5', () => {
assert(!block1.contains('031.0.5.5'));
});
it('block 127.0.0.0/8 contains 0177.0.0.2 (127.0.0.2)', () => {
assert(block2.contains('0177.0.0.2'));
});
it('block 255.0.0.1/12 does not contain 0255.0.0.2 (173.0.0.2)', () => {
assert(!block3.contains('0255.0.0.2'));
});
it('block 10.0.0.1/8 contains 012.0.0.255 (10.0.0.255)', () => {
assert(block4.contains('012.0.0.255'));
});
it('block 1.0.0.1/4 contains 01.02.03.04', () => {
assert(block5.contains('01.02.03.04'));
});
});
describe('hexadecimal', () => {
it('block 31.0.0.0/19 does not contain 0x31.0.5.5', () => {
assert(!block1.contains('0x31.0.5.5'));
});
it('block 127.0.0.0/8 contains 0x7f.0.0.0x2 (127.0.0.2)', () => {
assert(block2.contains('0x7f.0.0.0x2'));
});
it('block 255.0.0.1/12 contains 0xff.0.0.2', () => {
assert(block3.contains('0xff.0.0.2'));
});
it('block 10.0.0.1/8 does not contain 0x10.0.0.255', () => {
assert(!block4.contains('0x10.0.0.255'));
});
it('block 1.0.0.1/4 contains 0x1.0x2.0x3.0x4', () => {
assert(block5.contains('0x1.0x2.0x3.0x4'));
});
});
describe('decimal', () => {
it('block 31.0.0.0/19 contains 31.0.5.5', () => {
assert(block1.contains('31.0.5.5'));
});
it('block 127.0.0.0/8 does not contain 128.0.0.2', () =>{
assert(!block2.contains('128.0.0.2'));
});
it('block 255.0.0.1/12 contains 255.0.0.2', () => {
assert(block3.contains('255.0.0.2'));
});
it('block 10.0.0.1/8 contains 10.0.0.255', () => {
assert(block4.contains('10.0.0.255'));
});
it('block 1.0.0.1/4 contains 1.2.3.4', () => {
assert(block5.contains('1.2.3.4'));
});
});
});
});
``` | /content/code_sandbox/node_modules/netmask/tests/netmask.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,215 |
```coffeescript
Netmask = require('netmask').Netmask
ip = process.argv[2]
netmask = new Netmask(ip)
out = console.log
out "Address: #{ip.split('/', 1)[0]}"
out "Netmask: #{netmask.mask} = #{netmask.bitmask}"
out "Wildcard: #{netmask.hostmask}"
out "=>"
out "Network: #{netmask.base}/#{netmask.bitmask}"
out "HostMin: #{netmask.first}"
out "HostMax: #{netmask.last}"
out "Broadcast: #{netmask.broadcast}"
out "Hosts/Net: #{netmask.size}"
out netmask.next()
``` | /content/code_sandbox/node_modules/netmask/example/ipcalc.coffee | coffeescript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 136 |
```coffeescript
long2ip = (long) ->
a = (long & (0xff << 24)) >>> 24;
b = (long & (0xff << 16)) >>> 16;
c = (long & (0xff << 8)) >>> 8;
d = long & 0xff;
return [a, b, c, d].join('.')
ip2long = (ip) ->
b = []
for i in [0..3]
if ip.length == 0
break
if i > 0
if ip[0] != '.'
throw new Error('Invalid IP')
ip = ip.substring(1)
[n, c] = atob(ip)
ip = ip.substring(c)
b.push(n)
if ip.length != 0
throw new Error('Invalid IP')
switch b.length
when 1
# Long input notation
if b[0] > 0xFFFFFFFF
throw new Error('Invalid IP')
return b[0] >>> 0
when 2
# Class A notation
if b[0] > 0xFF or b[1] > 0xFFFFFF
throw new Error('Invalid IP')
return (b[0] << 24 | b[1]) >>> 0
when 3
# Class B notation
if b[0] > 0xFF or b[1] > 0xFF or b[2] > 0xFFFF
throw new Error('Invalid IP')
return (b[0] << 24 | b[1] << 16 | b[2]) >>> 0
when 4
# Dotted quad notation
if b[0] > 0xFF or b[1] > 0xFF or b[2] > 0xFF or b[3] > 0xFF
throw new Error('Invalid IP')
return (b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3]) >>> 0
else
throw new Error('Invalid IP')
chr = (b) ->
return b.charCodeAt(0)
chr0 = chr('0')
chra = chr('a')
chrA = chr('A')
atob = (s) ->
n = 0
base = 10
dmax = '9'
i = 0
if s.length > 1 and s[i] == '0'
if s[i+1] == 'x' or s[i+1] == 'X'
i += 2
base = 16
else if '0' <= s[i+1] and s[i+1] <= '9'
i++
base = 8
dmax = '7'
start = i
while i < s.length
if '0' <= s[i] and s[i] <= dmax
n = (n*base + (chr(s[i])-chr0)) >>> 0
else if base == 16
if 'a' <= s[i] and s[i] <= 'f'
n = (n*base + (10+chr(s[i])-chra)) >>> 0
else if 'A' <= s[i] and s[i] <= 'F'
n = (n*base + (10+chr(s[i])-chrA)) >>> 0
else
break
else
break
if n > 0xFFFFFFFF
throw new Error('too large')
i++
if i == start
throw new Error('empty octet')
return [n, i]
class Netmask
constructor: (net, mask) ->
throw new Error("Missing `net' parameter") unless typeof net is 'string'
unless mask
# try to find the mask in the net (i.e.: 1.2.3.4/24 or 1.2.3.4/255.255.255.0)
[net, mask] = net.split('/', 2)
unless mask
mask = 32
if typeof mask is 'string' and mask.indexOf('.') > -1
# Compute bitmask, the netmask as a number of bits in the network portion of the address for this block (eg.: 24)
try
@maskLong = ip2long(mask)
catch error
throw new Error("Invalid mask: #{mask}")
for i in [32..0]
if @maskLong == (0xffffffff << (32 - i)) >>> 0
@bitmask = i
break
else if mask or mask == 0
# The mask was passed as bitmask, compute the mask as long from it
@bitmask = parseInt(mask, 10)
@maskLong = 0
if @bitmask > 0
@maskLong = (0xffffffff << (32 - @bitmask)) >>> 0
else
throw new Error("Invalid mask: empty")
try
@netLong = (ip2long(net) & @maskLong) >>> 0
catch error
throw new Error("Invalid net address: #{net}")
throw new Error("Invalid mask for ip4: #{mask}") unless @bitmask <= 32
# The number of IP address in the block (eg.: 254)
@size = Math.pow(2, 32 - @bitmask)
# The address of the network block as a string (eg.: 216.240.32.0)
@base = long2ip(@netLong)
# The netmask as a string (eg.: 255.255.255.0)
@mask = long2ip(@maskLong)
# The host mask, the opposite of the netmask (eg.: 0.0.0.255)
@hostmask = long2ip(~@maskLong)
# The first usable address of the block
@first = if @bitmask <= 30 then long2ip(@netLong + 1) else @base
# The last usable address of the block
@last = if @bitmask <= 30 then long2ip(@netLong + @size - 2) else long2ip(@netLong + @size - 1)
# The block's broadcast address: the last address of the block (eg.: 192.168.1.255)
@broadcast = if @bitmask <= 30 then long2ip(@netLong + @size - 1)
# Returns true if the given ip or netmask is contained in the block
contains: (ip) ->
if typeof ip is 'string' and (ip.indexOf('/') > 0 or ip.split('.').length isnt 4)
ip = new Netmask(ip)
if ip instanceof Netmask
return @contains(ip.base) and @contains((ip.broadcast || ip.last))
else
return (ip2long(ip) & @maskLong) >>> 0 == ((@netLong & @maskLong)) >>> 0
# Returns the Netmask object for the block which follow this one
next: (count=1) ->
return new Netmask(long2ip(@netLong + (@size * count)), @mask)
forEach: (fn) ->
# this implementation is not idiomatic but avoids large memory allocations (2 arrays, one for range and one for the results) in cases when then netmask is large
long = ip2long(@first)
lastLong = ip2long(@last)
index = 0
while long <= lastLong
fn long2ip(long), long, index
index++
long++
return
# Returns the complete netmask formatted as `base/bitmask`
toString: ->
return @base + "/" + @bitmask
exports.ip2long = ip2long
exports.long2ip = long2ip
exports.Netmask = Netmask
``` | /content/code_sandbox/node_modules/netmask/lib/netmask.coffee | coffeescript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,747 |
```javascript
// Generated by CoffeeScript 1.12.7
(function() {
var Netmask, atob, chr, chr0, chrA, chra, ip2long, long2ip;
long2ip = function(long) {
var a, b, c, d;
a = (long & (0xff << 24)) >>> 24;
b = (long & (0xff << 16)) >>> 16;
c = (long & (0xff << 8)) >>> 8;
d = long & 0xff;
return [a, b, c, d].join('.');
};
ip2long = function(ip) {
var b, c, i, j, n, ref;
b = [];
for (i = j = 0; j <= 3; i = ++j) {
if (ip.length === 0) {
break;
}
if (i > 0) {
if (ip[0] !== '.') {
throw new Error('Invalid IP');
}
ip = ip.substring(1);
}
ref = atob(ip), n = ref[0], c = ref[1];
ip = ip.substring(c);
b.push(n);
}
if (ip.length !== 0) {
throw new Error('Invalid IP');
}
switch (b.length) {
case 1:
if (b[0] > 0xFFFFFFFF) {
throw new Error('Invalid IP');
}
return b[0] >>> 0;
case 2:
if (b[0] > 0xFF || b[1] > 0xFFFFFF) {
throw new Error('Invalid IP');
}
return (b[0] << 24 | b[1]) >>> 0;
case 3:
if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFFFF) {
throw new Error('Invalid IP');
}
return (b[0] << 24 | b[1] << 16 | b[2]) >>> 0;
case 4:
if (b[0] > 0xFF || b[1] > 0xFF || b[2] > 0xFF || b[3] > 0xFF) {
throw new Error('Invalid IP');
}
return (b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3]) >>> 0;
default:
throw new Error('Invalid IP');
}
};
chr = function(b) {
return b.charCodeAt(0);
};
chr0 = chr('0');
chra = chr('a');
chrA = chr('A');
atob = function(s) {
var base, dmax, i, n, start;
n = 0;
base = 10;
dmax = '9';
i = 0;
if (s.length > 1 && s[i] === '0') {
if (s[i + 1] === 'x' || s[i + 1] === 'X') {
i += 2;
base = 16;
} else if ('0' <= s[i + 1] && s[i + 1] <= '9') {
i++;
base = 8;
dmax = '7';
}
}
start = i;
while (i < s.length) {
if ('0' <= s[i] && s[i] <= dmax) {
n = (n * base + (chr(s[i]) - chr0)) >>> 0;
} else if (base === 16) {
if ('a' <= s[i] && s[i] <= 'f') {
n = (n * base + (10 + chr(s[i]) - chra)) >>> 0;
} else if ('A' <= s[i] && s[i] <= 'F') {
n = (n * base + (10 + chr(s[i]) - chrA)) >>> 0;
} else {
break;
}
} else {
break;
}
if (n > 0xFFFFFFFF) {
throw new Error('too large');
}
i++;
}
if (i === start) {
throw new Error('empty octet');
}
return [n, i];
};
Netmask = (function() {
function Netmask(net, mask) {
var error, i, j, ref;
if (typeof net !== 'string') {
throw new Error("Missing `net' parameter");
}
if (!mask) {
ref = net.split('/', 2), net = ref[0], mask = ref[1];
}
if (!mask) {
mask = 32;
}
if (typeof mask === 'string' && mask.indexOf('.') > -1) {
try {
this.maskLong = ip2long(mask);
} catch (error1) {
error = error1;
throw new Error("Invalid mask: " + mask);
}
for (i = j = 32; j >= 0; i = --j) {
if (this.maskLong === (0xffffffff << (32 - i)) >>> 0) {
this.bitmask = i;
break;
}
}
} else if (mask || mask === 0) {
this.bitmask = parseInt(mask, 10);
this.maskLong = 0;
if (this.bitmask > 0) {
this.maskLong = (0xffffffff << (32 - this.bitmask)) >>> 0;
}
} else {
throw new Error("Invalid mask: empty");
}
try {
this.netLong = (ip2long(net) & this.maskLong) >>> 0;
} catch (error1) {
error = error1;
throw new Error("Invalid net address: " + net);
}
if (!(this.bitmask <= 32)) {
throw new Error("Invalid mask for ip4: " + mask);
}
this.size = Math.pow(2, 32 - this.bitmask);
this.base = long2ip(this.netLong);
this.mask = long2ip(this.maskLong);
this.hostmask = long2ip(~this.maskLong);
this.first = this.bitmask <= 30 ? long2ip(this.netLong + 1) : this.base;
this.last = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 2) : long2ip(this.netLong + this.size - 1);
this.broadcast = this.bitmask <= 30 ? long2ip(this.netLong + this.size - 1) : void 0;
}
Netmask.prototype.contains = function(ip) {
if (typeof ip === 'string' && (ip.indexOf('/') > 0 || ip.split('.').length !== 4)) {
ip = new Netmask(ip);
}
if (ip instanceof Netmask) {
return this.contains(ip.base) && this.contains(ip.broadcast || ip.last);
} else {
return (ip2long(ip) & this.maskLong) >>> 0 === (this.netLong & this.maskLong) >>> 0;
}
};
Netmask.prototype.next = function(count) {
if (count == null) {
count = 1;
}
return new Netmask(long2ip(this.netLong + (this.size * count)), this.mask);
};
Netmask.prototype.forEach = function(fn) {
var index, lastLong, long;
long = ip2long(this.first);
lastLong = ip2long(this.last);
index = 0;
while (long <= lastLong) {
fn(long2ip(long), long, index);
index++;
long++;
}
};
Netmask.prototype.toString = function() {
return this.base + "/" + this.bitmask;
};
return Netmask;
})();
exports.ip2long = ip2long;
exports.long2ip = long2ip;
exports.Netmask = Netmask;
}).call(this);
``` | /content/code_sandbox/node_modules/netmask/lib/netmask.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,786 |
```coffeescript
vows = require 'vows'
assert = require 'assert'
Netmask = require('../lib/netmask').Netmask
shouldFailWithError = (msg) ->
context =
topic: ->
try
return new Netmask(@context.name)
catch e
return e
'should fail': (e) ->
assert.ok isError(e), "is an Error object #{e}"
"with error `#{msg}'": (e) ->
assert.ok e.message?.toLowerCase().indexOf(msg.toLowerCase()) > -1, "'#{e.message}' =~ #{msg}"
return context
isError = (e) ->
return typeof e == 'object' and Object.prototype.toString.call(e) == '[object Error]'
vows.describe('IPs with bytes greater than 255')
.addBatch
'209.256.68.22/255.255.224.0': shouldFailWithError 'Invalid net'
'209.180.68.22/256.255.224.0': shouldFailWithError 'Invalid mask'
'209.500.70.33/19': shouldFailWithError 'Invalid net'
'140.999.82': shouldFailWithError 'Invalid net'
'899.174': shouldFailWithError 'Invalid net'
'209.157.65536/19': shouldFailWithError 'Invalid net'
'209.300.64.0.10': shouldFailWithError 'Invalid net'
'garbage': shouldFailWithError 'Invalid net'
.export(module)
vows.describe('Invalid IP format')
.addBatch
' 1.2.3.4': shouldFailWithError 'Invalid net'
' 1.2.3.4': shouldFailWithError 'Invalid net'
'1. 2.3.4': shouldFailWithError 'Invalid net'
'1.2. 3.4': shouldFailWithError 'Invalid net'
'1.2.3. 4': shouldFailWithError 'Invalid net'
'1.2.3.4 ': shouldFailWithError 'Invalid net'
'1 .2.3.4': shouldFailWithError 'Invalid net'
'018.0.0.0': shouldFailWithError 'Invalid net'
'08.0.0.0': shouldFailWithError 'Invalid net'
'0xfg.0.0.0': shouldFailWithError 'Invalid net'
.export(module)
vows.describe('Ranges that are a power-of-two big, but are not legal blocks')
.addBatch
'218.0.0.0/221.255.255.255': shouldFailWithError 'Invalid mask'
'218.0.0.4/218.0.0.11': shouldFailWithError 'Invalid mask'
.export(module)
``` | /content/code_sandbox/node_modules/netmask/test/badnets.coffee | coffeescript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 600 |
```javascript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
// returns an abstract syntax tree as specified by [Mozilla parser
// API][api].
//
// [api]: path_to_url
"use strict";
exports.parse = parse;
// This function tries to parse a single expression at a given
// offset in a string. Useful for parsing mixed-language formats
// that embed JavaScript expressions.
exports.parseExpressionAt = parseExpressionAt;
// Acorn is organized as a tokenizer and a recursive-descent parser.
// The `tokenize` export provides an interface to the tokenizer.
exports.tokenizer = tokenizer;
exports.__esModule = true;
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
//
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
// various contributors and released under an MIT license.
//
// Git repositories for Acorn are available at
//
// path_to_url
// path_to_url
//
// Please use the [github bug tracker][ghbt] to report issues.
//
// [ghbt]: path_to_url
//
// This file defines the main parser interface. The library also comes
// with a [error-tolerant parser][dammit] and an
// [abstract syntax tree walker][walk], defined in other files.
//
// [dammit]: acorn_loose.js
// [walk]: util/walk.js
var _state = _dereq_("./state");
var Parser = _state.Parser;
var _options = _dereq_("./options");
var getOptions = _options.getOptions;
_dereq_("./parseutil");
_dereq_("./statement");
_dereq_("./lval");
_dereq_("./expression");
exports.Parser = _state.Parser;
exports.plugins = _state.plugins;
exports.defaultOptions = _options.defaultOptions;
var _location = _dereq_("./location");
exports.SourceLocation = _location.SourceLocation;
exports.getLineInfo = _location.getLineInfo;
exports.Node = _dereq_("./node").Node;
var _tokentype = _dereq_("./tokentype");
exports.TokenType = _tokentype.TokenType;
exports.tokTypes = _tokentype.types;
var _tokencontext = _dereq_("./tokencontext");
exports.TokContext = _tokencontext.TokContext;
exports.tokContexts = _tokencontext.types;
var _identifier = _dereq_("./identifier");
exports.isIdentifierChar = _identifier.isIdentifierChar;
exports.isIdentifierStart = _identifier.isIdentifierStart;
exports.Token = _dereq_("./tokenize").Token;
var _whitespace = _dereq_("./whitespace");
exports.isNewLine = _whitespace.isNewLine;
exports.lineBreak = _whitespace.lineBreak;
exports.lineBreakG = _whitespace.lineBreakG;
var version = "1.2.2";exports.version = version;
function parse(input, options) {
var p = parser(options, input);
var startPos = p.pos,
startLoc = p.options.locations && p.curPosition();
p.nextToken();
return p.parseTopLevel(p.options.program || p.startNodeAt(startPos, startLoc));
}
function parseExpressionAt(input, pos, options) {
var p = parser(options, input, pos);
p.nextToken();
return p.parseExpression();
}
function tokenizer(input, options) {
return parser(options, input);
}
function parser(options, input) {
return new Parser(getOptions(options), String(input));
}
},{"./expression":6,"./identifier":7,"./location":8,"./lval":9,"./node":10,"./options":11,"./parseutil":12,"./state":13,"./statement":14,"./tokencontext":15,"./tokenize":16,"./tokentype":17,"./whitespace":19}],2:[function(_dereq_,module,exports){
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
},{}],3:[function(_dereq_,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
function drainQueue() {
if (draining) {
return;
}
draining = true;
var currentQueue;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
var i = -1;
while (++i < len) {
currentQueue[i]();
}
len = queue.length;
}
draining = false;
}
process.nextTick = function (fun) {
queue.push(fun);
if (!draining) {
setTimeout(drainQueue, 0);
}
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],4:[function(_dereq_,module,exports){
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
}
},{}],5:[function(_dereq_,module,exports){
(function (process,global){
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function(fn, msg) {
// Allow for deprecating things in the process of starting up.
if (isUndefined(global.process)) {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
if (process.noDeprecation === true) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnviron;
exports.debuglog = function(set) {
if (isUndefined(debugEnviron))
debugEnviron = process.env.NODE_DEBUG || '';
set = set.toUpperCase();
if (!debugs[set]) {
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
var pid = process.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function() {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
}
// set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
// path_to_url#graphics
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// path_to_url
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '', array = false, braces = ['{', '}'];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value))
return ctx.stylize('' + value, 'number');
if (isBoolean(value))
return ctx.stylize('' + value, 'boolean');
// For some reason typeof null is "object", so special case here.
if (isNull(value))
return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push('');
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = _dereq_('./support/isBuffer');
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = _dereq_('inherits');
exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./support/isBuffer":4,"_process":3,"inherits":2}],6:[function(_dereq_,module,exports){
// A recursive descent parser operates by defining functions for all
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
// instead of `(!x)[1]` is handled by the fact that the parser
// function that parses unary prefix operators is called first, and
// in turn calls the function that parses `[]` subscripts that
// way, it'll receive the node for `x[1]` already parsed, and wraps
// *that* in the unary operator node.
//
// Acorn uses an [operator precedence parser][opp] to handle binary
// operator precedence, because it is much more compact than using
// the technique outlined above, which uses different, nesting
// functions to specify precedence, for all of the ten binary
// precedence levels that JavaScript defines.
//
// [opp]: path_to_url
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var reservedWords = _dereq_("./identifier").reservedWords;
var has = _dereq_("./util").has;
var pp = Parser.prototype;
// Check if property name clashes with already added.
// Object/class getters and setters are not allowed to clash
// either with each other or with an init property and in
// strict mode, init properties are also not allowed to be repeated.
pp.checkPropClash = function (prop, propHash) {
if (this.options.ecmaVersion >= 6) return;
var key = prop.key,
name = undefined;
switch (key.type) {
case "Identifier":
name = key.name;break;
case "Literal":
name = String(key.value);break;
default:
return;
}
var kind = prop.kind || "init",
other = undefined;
if (has(propHash, name)) {
other = propHash[name];
var isGetSet = kind !== "init";
if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) this.raise(key.start, "Redefinition of property");
} else {
other = propHash[name] = {
init: false,
get: false,
set: false
};
}
other[kind] = true;
};
// ### Expression parsing
// These nest, from the most general expression type at the top to
// 'atomic', nondivisible expression types at the bottom. Most of
// the functions will simply let the function(s) below them parse,
// and, *if* the syntactic construct they handle is present, wrap
// the AST node that the inner parser gave them in another node.
// Parse a full expression. The optional arguments are used to
// forbid the `in` operator (in for loops initalization expressions)
// and provide reference for storing '=' operator inside shorthand
// property assignment in contexts where both object expression
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
pp.parseExpression = function (noIn, refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);
if (this.type === tt.comma) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
// Parse an assignment expression. This includes applications of
// operators like `+=`.
pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) {
if (this.type == tt._yield && this.inGenerator) return this.parseYield();
var failOnShorthandAssign = undefined;
if (!refShorthandDefaultPos) {
refShorthandDefaultPos = { start: 0 };
failOnShorthandAssign = true;
} else {
failOnShorthandAssign = false;
}
var startPos = this.start,
startLoc = this.startLoc;
if (this.type == tt.parenL || this.type == tt.name) this.potentialArrowAt = this.start;
var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos);
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
if (this.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
node.left = this.type === tt.eq ? this.toAssignable(left) : left;
refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly
this.checkLVal(left);
this.next();
node.right = this.parseMaybeAssign(noIn);
return this.finishNode(node, "AssignmentExpression");
} else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start);
}
return left;
};
// Parse a ternary conditional (`?:`) operator.
pp.parseMaybeConditional = function (noIn, refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprOps(noIn, refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
if (this.eat(tt.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
this.expect(tt.colon);
node.alternate = this.parseMaybeAssign(noIn);
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
// Start the precedence parser.
pp.parseExprOps = function (noIn, refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseMaybeUnary(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
};
// Parse binary operators with the operator precedence parsing
// algorithm. `left` is the left-hand side of the operator.
// `minPrec` provides context that allows the function to stop and
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
var prec = this.type.binop;
if (Array.isArray(leftStartPos)) {
if (this.options.locations && noIn === undefined) {
// shift arguments to left by one
noIn = minPrec;
minPrec = leftStartLoc;
// flatten leftStartPos
leftStartLoc = leftStartPos[1];
leftStartPos = leftStartPos[0];
}
}
if (prec != null && (!noIn || this.type !== tt._in)) {
if (prec > minPrec) {
var node = this.startNodeAt(leftStartPos, leftStartLoc);
node.left = left;
node.operator = this.value;
var op = this.type;
this.next();
var startPos = this.start,
startLoc = this.startLoc;
node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn);
this.finishNode(node, op === tt.logicalOR || op === tt.logicalAND ? "LogicalExpression" : "BinaryExpression");
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
}
}
return left;
};
// Parse unary operators, both prefix and postfix.
pp.parseMaybeUnary = function (refShorthandDefaultPos) {
if (this.type.prefix) {
var node = this.startNode(),
update = this.type === tt.incDec;
node.operator = this.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary();
if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
if (update) this.checkLVal(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raise(node.start, "Deleting local variable in strict mode");
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
}
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprSubscripts(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
while (this.type.postfix && !this.canInsertSemicolon()) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
node.prefix = false;
node.argument = expr;
this.checkLVal(expr);
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
return expr;
};
// Parse call, dot, and `[]`-subscript expressions.
pp.parseExprSubscripts = function (refShorthandDefaultPos) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprAtom(refShorthandDefaultPos);
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
return this.parseSubscripts(expr, startPos, startLoc);
};
pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
if (Array.isArray(startPos)) {
if (this.options.locations && noCalls === undefined) {
// shift arguments to left by one
noCalls = startLoc;
// flatten startPos
startLoc = startPos[1];
startPos = startPos[0];
}
}
for (;;) {
if (this.eat(tt.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = this.parseIdent(true);
node.computed = false;
base = this.finishNode(node, "MemberExpression");
} else if (this.eat(tt.bracketL)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = this.parseExpression();
node.computed = true;
this.expect(tt.bracketR);
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.eat(tt.parenL)) {
var node = this.startNodeAt(startPos, startLoc);
node.callee = base;
node.arguments = this.parseExprList(tt.parenR, false);
base = this.finishNode(node, "CallExpression");
} else if (this.type === tt.backQuote) {
var node = this.startNodeAt(startPos, startLoc);
node.tag = base;
node.quasi = this.parseTemplate();
base = this.finishNode(node, "TaggedTemplateExpression");
} else {
return base;
}
}
};
// Parse an atomic expression either a single token that is an
// expression, an expression started by a keyword like `function` or
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
pp.parseExprAtom = function (refShorthandDefaultPos) {
var node = undefined,
canBeArrow = this.potentialArrowAt == this.start;
switch (this.type) {
case tt._this:
case tt._super:
var type = this.type === tt._this ? "ThisExpression" : "Super";
node = this.startNode();
this.next();
return this.finishNode(node, type);
case tt._yield:
if (this.inGenerator) this.unexpected();
case tt.name:
var startPos = this.start,
startLoc = this.startLoc;
var id = this.parseIdent(this.type !== tt.name);
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id]);
return id;
case tt.regexp:
var value = this.value;
node = this.parseLiteral(value.value);
node.regex = { pattern: value.pattern, flags: value.flags };
return node;
case tt.num:case tt.string:
return this.parseLiteral(this.value);
case tt._null:case tt._true:case tt._false:
node = this.startNode();
node.value = this.type === tt._null ? null : this.type === tt._true;
node.raw = this.type.keyword;
this.next();
return this.finishNode(node, "Literal");
case tt.parenL:
return this.parseParenAndDistinguishExpression(canBeArrow);
case tt.bracketL:
node = this.startNode();
this.next();
// check whether this is array comprehension or regular array
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
return this.parseComprehension(node, false);
}
node.elements = this.parseExprList(tt.bracketR, true, true, refShorthandDefaultPos);
return this.finishNode(node, "ArrayExpression");
case tt.braceL:
return this.parseObj(false, refShorthandDefaultPos);
case tt._function:
node = this.startNode();
this.next();
return this.parseFunction(node, false);
case tt._class:
return this.parseClass(this.startNode(), false);
case tt._new:
return this.parseNew();
case tt.backQuote:
return this.parseTemplate();
default:
this.unexpected();
}
};
pp.parseLiteral = function (value) {
var node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
this.next();
return this.finishNode(node, "Literal");
};
pp.parseParenExpression = function () {
this.expect(tt.parenL);
var val = this.parseExpression();
this.expect(tt.parenR);
return val;
};
pp.parseParenAndDistinguishExpression = function (canBeArrow) {
var startPos = this.start,
startLoc = this.startLoc,
val = undefined;
if (this.options.ecmaVersion >= 6) {
this.next();
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
return this.parseComprehension(this.startNodeAt(startPos, startLoc), true);
}
var innerStartPos = this.start,
innerStartLoc = this.startLoc;
var exprList = [],
first = true;
var refShorthandDefaultPos = { start: 0 },
spreadStart = undefined,
innerParenStart = undefined;
while (this.type !== tt.parenR) {
first ? first = false : this.expect(tt.comma);
if (this.type === tt.ellipsis) {
spreadStart = this.start;
exprList.push(this.parseParenItem(this.parseRest()));
break;
} else {
if (this.type === tt.parenL && !innerParenStart) {
innerParenStart = this.start;
}
exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem));
}
}
var innerEndPos = this.start,
innerEndLoc = this.startLoc;
this.expect(tt.parenR);
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
if (innerParenStart) this.unexpected(innerParenStart);
return this.parseParenArrowList(startPos, startLoc, exprList);
}
if (!exprList.length) this.unexpected(this.lastTokStart);
if (spreadStart) this.unexpected(spreadStart);
if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
} else {
val = exprList[0];
}
} else {
val = this.parseParenExpression();
}
if (this.options.preserveParens) {
var par = this.startNodeAt(startPos, startLoc);
par.expression = val;
return this.finishNode(par, "ParenthesizedExpression");
} else {
return val;
}
};
pp.parseParenItem = function (item) {
return item;
};
pp.parseParenArrowList = function (startPos, startLoc, exprList) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList);
};
// New's precedence is slightly tricky. It must allow its argument
// to be a `[]` or dot subscript expression, but not a call at
// least, not without wrapping it in parentheses. Thus, it uses the
var empty = [];
pp.parseNew = function () {
var node = this.startNode();
var meta = this.parseIdent(true);
if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
node.meta = meta;
node.property = this.parseIdent(true);
if (node.property.name !== "target") this.raise(node.property.start, "The only valid meta property for new is new.target");
return this.finishNode(node, "MetaProperty");
}
var startPos = this.start,
startLoc = this.startLoc;
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false);else node.arguments = empty;
return this.finishNode(node, "NewExpression");
};
// Parse template expression.
pp.parseTemplateElement = function () {
var elem = this.startNode();
elem.value = {
raw: this.input.slice(this.start, this.end),
cooked: this.value
};
this.next();
elem.tail = this.type === tt.backQuote;
return this.finishNode(elem, "TemplateElement");
};
pp.parseTemplate = function () {
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement();
node.quasis = [curElt];
while (!curElt.tail) {
this.expect(tt.dollarBraceL);
node.expressions.push(this.parseExpression());
this.expect(tt.braceR);
node.quasis.push(curElt = this.parseTemplateElement());
}
this.next();
return this.finishNode(node, "TemplateLiteral");
};
// Parse an object literal or binding pattern.
pp.parseObj = function (isPattern, refShorthandDefaultPos) {
var node = this.startNode(),
first = true,
propHash = {};
node.properties = [];
this.next();
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma);
if (this.afterTrailingComma(tt.braceR)) break;
} else first = false;
var prop = this.startNode(),
isGenerator = undefined,
startPos = undefined,
startLoc = undefined;
if (this.options.ecmaVersion >= 6) {
prop.method = false;
prop.shorthand = false;
if (isPattern || refShorthandDefaultPos) {
startPos = this.start;
startLoc = this.startLoc;
}
if (!isPattern) isGenerator = this.eat(tt.star);
}
this.parsePropertyName(prop);
this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos);
this.checkPropClash(prop, propHash);
node.properties.push(this.finishNode(prop, "Property"));
}
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
};
pp.parsePropertyValue = function (prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos) {
if (this.eat(tt.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
prop.kind = "init";
} else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {
if (isPattern) this.unexpected();
prop.kind = "init";
prop.method = true;
prop.value = this.parseMethod(isGenerator);
} else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type != tt.comma && this.type != tt.braceR)) {
if (isGenerator || isPattern) this.unexpected();
prop.kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
prop.kind = "init";
if (isPattern) {
if (this.isKeyword(prop.key.name) || this.strict && (reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name)) || !this.options.allowReserved && this.isReservedWord(prop.key.name)) this.raise(prop.key.start, "Binding " + prop.key.name);
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
} else if (this.type === tt.eq && refShorthandDefaultPos) {
if (!refShorthandDefaultPos.start) refShorthandDefaultPos.start = this.start;
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);
} else {
prop.value = prop.key;
}
prop.shorthand = true;
} else this.unexpected();
};
pp.parsePropertyName = function (prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(tt.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
this.expect(tt.bracketR);
return prop.key;
} else {
prop.computed = false;
}
}
return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true);
};
// Initialize empty function node.
pp.initFunction = function (node) {
node.id = null;
if (this.options.ecmaVersion >= 6) {
node.generator = false;
node.expression = false;
}
};
// Parse object or class method.
pp.parseMethod = function (isGenerator) {
var node = this.startNode();
this.initFunction(node);
this.expect(tt.parenL);
node.params = this.parseBindingList(tt.parenR, false, false);
var allowExpressionBody = undefined;
if (this.options.ecmaVersion >= 6) {
node.generator = isGenerator;
allowExpressionBody = true;
} else {
allowExpressionBody = false;
}
this.parseFunctionBody(node, allowExpressionBody);
return this.finishNode(node, "FunctionExpression");
};
// Parse arrow function expression with given parameters.
pp.parseArrowExpression = function (node, params) {
this.initFunction(node);
node.params = this.toAssignableList(params, true);
this.parseFunctionBody(node, true);
return this.finishNode(node, "ArrowFunctionExpression");
};
// Parse function body and check parameters.
pp.parseFunctionBody = function (node, allowExpression) {
var isExpression = allowExpression && this.type !== tt.braceL;
if (isExpression) {
node.body = this.parseMaybeAssign();
node.expression = true;
} else {
// Start a new scope with regard to labels and the `inFunction`
// flag (restore them to their old value afterwards).
var oldInFunc = this.inFunction,
oldInGen = this.inGenerator,
oldLabels = this.labels;
this.inFunction = true;this.inGenerator = node.generator;this.labels = [];
node.body = this.parseBlock(true);
node.expression = false;
this.inFunction = oldInFunc;this.inGenerator = oldInGen;this.labels = oldLabels;
}
// If this is a strict mode function, verify that argument names
// are not repeated, and it does not try to bind the words `eval`
// or `arguments`.
if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) {
var nameHash = {},
oldStrict = this.strict;
this.strict = true;
if (node.id) this.checkLVal(node.id, true);
for (var i = 0; i < node.params.length; i++) {
this.checkLVal(node.params[i], true, nameHash);
}this.strict = oldStrict;
}
};
// Parses a comma-separated list of expressions, and returns them as
// an array. `close` is the token type that ends the list, and
// `allowEmpty` can be turned on to allow subsequent commas with
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (!first) {
this.expect(tt.comma);
if (allowTrailingComma && this.afterTrailingComma(close)) break;
} else first = false;
if (allowEmpty && this.type === tt.comma) {
elts.push(null);
} else {
if (this.type === tt.ellipsis) elts.push(this.parseSpread(refShorthandDefaultPos));else elts.push(this.parseMaybeAssign(false, refShorthandDefaultPos));
}
}
return elts;
};
// Parse the next token as an identifier. If `liberal` is true (used
// when parsing properties), it will also convert keywords into
// identifiers.
pp.parseIdent = function (liberal) {
var node = this.startNode();
if (liberal && this.options.allowReserved == "never") liberal = false;
if (this.type === tt.name) {
if (!liberal && (!this.options.allowReserved && this.isReservedWord(this.value) || this.strict && reservedWords.strict(this.value) && (this.options.ecmaVersion >= 6 || this.input.slice(this.start, this.end).indexOf("\\") == -1))) this.raise(this.start, "The keyword '" + this.value + "' is reserved");
node.name = this.value;
} else if (liberal && this.type.keyword) {
node.name = this.type.keyword;
} else {
this.unexpected();
}
this.next();
return this.finishNode(node, "Identifier");
};
// Parses yield expression inside generator.
pp.parseYield = function () {
var node = this.startNode();
this.next();
if (this.type == tt.semi || this.canInsertSemicolon() || this.type != tt.star && !this.type.startsExpr) {
node.delegate = false;
node.argument = null;
} else {
node.delegate = this.eat(tt.star);
node.argument = this.parseMaybeAssign();
}
return this.finishNode(node, "YieldExpression");
};
// Parses array and generator comprehensions.
pp.parseComprehension = function (node, isGenerator) {
node.blocks = [];
while (this.type === tt._for) {
var block = this.startNode();
this.next();
this.expect(tt.parenL);
block.left = this.parseBindingAtom();
this.checkLVal(block.left, true);
this.expectContextual("of");
block.right = this.parseExpression();
this.expect(tt.parenR);
node.blocks.push(this.finishNode(block, "ComprehensionBlock"));
}
node.filter = this.eat(tt._if) ? this.parseParenExpression() : null;
node.body = this.parseExpression();
this.expect(isGenerator ? tt.parenR : tt.bracketR);
node.generator = isGenerator;
return this.finishNode(node, "ComprehensionExpression");
};
},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],7:[function(_dereq_,module,exports){
// Test whether a given character code starts an identifier.
"use strict";
exports.isIdentifierStart = isIdentifierStart;
// Test whether a given character is part of an identifier.
exports.isIdentifierChar = isIdentifierChar;
exports.__esModule = true;
// This is a trick taken from Esprima. It turns out that, on
// non-Chrome browsers, to check whether a string is in a set, a
// predicate containing a big ugly `switch` statement is faster than
// a regular expression, and on Chrome the two are about on par.
// This function uses `eval` (non-lexical) to produce such a
// predicate from a space-separated string of words.
//
// It starts by sorting the words by length.
function makePredicate(words) {
words = words.split(" ");
var f = "",
cats = [];
out: for (var i = 0; i < words.length; ++i) {
for (var j = 0; j < cats.length; ++j) {
if (cats[j][0].length == words[i].length) {
cats[j].push(words[i]);
continue out;
}
}cats.push([words[i]]);
}
function compareTo(arr) {
if (arr.length == 1) {
return f += "return str === " + JSON.stringify(arr[0]) + ";";
}f += "switch(str){";
for (var i = 0; i < arr.length; ++i) {
f += "case " + JSON.stringify(arr[i]) + ":";
}f += "return true}return false;";
}
// When there are more than three length categories, an outer
// switch first dispatches on the lengths, to save on comparisons.
if (cats.length > 3) {
cats.sort(function (a, b) {
return b.length - a.length;
});
f += "switch(str.length){";
for (var i = 0; i < cats.length; ++i) {
var cat = cats[i];
f += "case " + cat[0].length + ":";
compareTo(cat);
}
f += "}"
// Otherwise, simply generate a flat `switch` statement.
;
} else {
compareTo(words);
}
return new Function("str", f);
}
// Reserved word lists for various dialects of the language
var reservedWords = {
3: makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),
5: makePredicate("class enum extends super const export import"),
6: makePredicate("enum await"),
strict: makePredicate("implements interface let package private protected public static yield"),
strictBind: makePredicate("eval arguments")
};
exports.reservedWords = reservedWords;
// And the keywords
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
var keywords = {
5: makePredicate(ecma5AndLessKeywords),
6: makePredicate(ecma5AndLessKeywords + " let const class extends export import yield super")
};
exports.keywords = keywords;
// ## Character categories
// Big ugly regular expressions that match characters in the
// whitespace, identifier, and identifier-start categories. These
// are only applied when a character is found to actually have a
// code point above 128.
// Generated by `tools/generate-identifier-regex.js`.
var nonASCIIidentifierStartChars = "-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
var nonASCIIidentifierChars = "-------------------------------------------------------------------------------------------------------------------------------------------------";
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
// offset starts at 0x10000, and each pair of numbers represents an
// offset to the next range, and then a size of the range. They were
// generated by tools/generate-identifier-regex.js
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 99, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 98, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 16481, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 1340, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 16355, 541];
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 9, 20855, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 4305, 6, 792618, 239];
// This has a complexity linear to the value of the code. The
// assumption is that looking up astral identifier characters is
// rare.
function isInAstralSet(code, set) {
var pos = 65536;
for (var i = 0; i < set.length; i += 2) {
pos += set[i];
if (pos > code) {
return false;
}pos += set[i + 1];
if (pos >= code) {
return true;
}
}
}
function isIdentifierStart(code, astral) {
if (code < 65) {
return code === 36;
}if (code < 91) {
return true;
}if (code < 97) {
return code === 95;
}if (code < 123) {
return true;
}if (code <= 65535) {
return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
}if (astral === false) {
return false;
}return isInAstralSet(code, astralIdentifierStartCodes);
}
function isIdentifierChar(code, astral) {
if (code < 48) {
return code === 36;
}if (code < 58) {
return true;
}if (code < 65) {
return false;
}if (code < 91) {
return true;
}if (code < 97) {
return code === 95;
}if (code < 123) {
return true;
}if (code <= 65535) {
return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
}if (astral === false) {
return false;
}return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
},{}],8:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
// The `getLineInfo` function is mostly useful when the
// `locations` option is off (for performance reasons) and you
// want to find the line/column position for a given character
// offset. `input` should be the code string that the offset refers
// into.
exports.getLineInfo = getLineInfo;
exports.__esModule = true;
var Parser = _dereq_("./state").Parser;
var lineBreakG = _dereq_("./whitespace").lineBreakG;
var deprecate = _dereq_("util").deprecate;
// These are used when `options.locations` is on, for the
// `startLoc` and `endLoc` properties.
var Position = exports.Position = (function () {
function Position(line, col) {
_classCallCheck(this, Position);
this.line = line;
this.column = col;
}
Position.prototype.offset = function offset(n) {
return new Position(this.line, this.column + n);
};
return Position;
})();
var SourceLocation = exports.SourceLocation = function SourceLocation(p, start, end) {
_classCallCheck(this, SourceLocation);
this.start = start;
this.end = end;
if (p.sourceFile !== null) this.source = p.sourceFile;
};
function getLineInfo(input, offset) {
for (var line = 1, cur = 0;;) {
lineBreakG.lastIndex = cur;
var match = lineBreakG.exec(input);
if (match && match.index < offset) {
++line;
cur = match.index + match[0].length;
} else {
return new Position(line, offset - cur);
}
}
}
var pp = Parser.prototype;
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
// the location of the error, attaches the position to the end
// of the error message, and then raises a `SyntaxError` with that
// message.
pp.raise = function (pos, message) {
var loc = getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
err.pos = pos;err.loc = loc;err.raisedAt = this.pos;
throw err;
};
pp.curPosition = function () {
return new Position(this.curLine, this.pos - this.lineStart);
};
pp.markPosition = function () {
return this.options.locations ? [this.start, this.startLoc] : this.start;
};
},{"./state":13,"./whitespace":19,"util":5}],9:[function(_dereq_,module,exports){
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var reservedWords = _dereq_("./identifier").reservedWords;
var has = _dereq_("./util").has;
var pp = Parser.prototype;
// Convert existing expression atom to assignable pattern
// if possible.
pp.toAssignable = function (node, isBinding) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
break;
case "ObjectExpression":
node.type = "ObjectPattern";
for (var i = 0; i < node.properties.length; i++) {
var prop = node.properties[i];
if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter");
this.toAssignable(prop.value, isBinding);
}
break;
case "ArrayExpression":
node.type = "ArrayPattern";
this.toAssignableList(node.elements, isBinding);
break;
case "AssignmentExpression":
if (node.operator === "=") {
node.type = "AssignmentPattern";
} else {
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
}
break;
case "ParenthesizedExpression":
node.expression = this.toAssignable(node.expression, isBinding);
break;
case "MemberExpression":
if (!isBinding) break;
default:
this.raise(node.start, "Assigning to rvalue");
}
}
return node;
};
// Convert list of expression atoms to binding list.
pp.toAssignableList = function (exprList, isBinding) {
var end = exprList.length;
if (end) {
var last = exprList[end - 1];
if (last && last.type == "RestElement") {
--end;
} else if (last && last.type == "SpreadElement") {
last.type = "RestElement";
var arg = last.argument;
this.toAssignable(arg, isBinding);
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") this.unexpected(arg.start);
--end;
}
}
for (var i = 0; i < end; i++) {
var elt = exprList[i];
if (elt) this.toAssignable(elt, isBinding);
}
return exprList;
};
// Parses spread element.
pp.parseSpread = function (refShorthandDefaultPos) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(refShorthandDefaultPos);
return this.finishNode(node, "SpreadElement");
};
pp.parseRest = function () {
var node = this.startNode();
this.next();
node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected();
return this.finishNode(node, "RestElement");
};
// Parses lvalue (assignable) atom.
pp.parseBindingAtom = function () {
if (this.options.ecmaVersion < 6) return this.parseIdent();
switch (this.type) {
case tt.name:
return this.parseIdent();
case tt.bracketL:
var node = this.startNode();
this.next();
node.elements = this.parseBindingList(tt.bracketR, true, true);
return this.finishNode(node, "ArrayPattern");
case tt.braceL:
return this.parseObj(true);
default:
this.unexpected();
}
};
pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (first) first = false;else this.expect(tt.comma);
if (allowEmpty && this.type === tt.comma) {
elts.push(null);
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
} else if (this.type === tt.ellipsis) {
var rest = this.parseRest();
this.parseBindingListItem(rest);
elts.push(rest);
this.expect(close);
break;
} else {
var elem = this.parseMaybeDefault(this.start, this.startLoc);
this.parseBindingListItem(elem);
elts.push(elem);
}
}
return elts;
};
pp.parseBindingListItem = function (param) {
return param;
};
// Parses assignment pattern around given atom if possible.
pp.parseMaybeDefault = function (startPos, startLoc, left) {
if (Array.isArray(startPos)) {
if (this.options.locations && noCalls === undefined) {
// shift arguments to left by one
left = startLoc;
// flatten startPos
startLoc = startPos[1];
startPos = startPos[0];
}
}
left = left || this.parseBindingAtom();
if (!this.eat(tt.eq)) return left;
var node = this.startNodeAt(startPos, startLoc);
node.operator = "=";
node.left = left;
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentPattern");
};
// Verify that a node is an lval something that can be assigned
// to.
pp.checkLVal = function (expr, isBinding, checkClashes) {
switch (expr.type) {
case "Identifier":
if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
if (checkClashes) {
if (has(checkClashes, expr.name)) this.raise(expr.start, "Argument name clash in strict mode");
checkClashes[expr.name] = true;
}
break;
case "MemberExpression":
if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression");
break;
case "ObjectPattern":
for (var i = 0; i < expr.properties.length; i++) {
this.checkLVal(expr.properties[i].value, isBinding, checkClashes);
}break;
case "ArrayPattern":
for (var i = 0; i < expr.elements.length; i++) {
var elem = expr.elements[i];
if (elem) this.checkLVal(elem, isBinding, checkClashes);
}
break;
case "AssignmentPattern":
this.checkLVal(expr.left, isBinding, checkClashes);
break;
case "RestElement":
this.checkLVal(expr.argument, isBinding, checkClashes);
break;
case "ParenthesizedExpression":
this.checkLVal(expr.expression, isBinding, checkClashes);
break;
default:
this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue");
}
};
},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],10:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
var Parser = _dereq_("./state").Parser;
var SourceLocation = _dereq_("./location").SourceLocation;
// Start an AST node, attaching a start offset.
var pp = Parser.prototype;
var Node = exports.Node = function Node() {
_classCallCheck(this, Node);
};
pp.startNode = function () {
var node = new Node();
node.start = this.start;
if (this.options.locations) node.loc = new SourceLocation(this, this.startLoc);
if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
if (this.options.ranges) node.range = [this.start, 0];
return node;
};
pp.startNodeAt = function (pos, loc) {
var node = new Node();
if (Array.isArray(pos)) {
if (this.options.locations && loc === undefined) {
// flatten pos
loc = pos[1];
pos = pos[0];
}
}
node.start = pos;
if (this.options.locations) node.loc = new SourceLocation(this, loc);
if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile;
if (this.options.ranges) node.range = [pos, 0];
return node;
};
// Finish an AST node, adding `type` and `end` properties.
pp.finishNode = function (node, type) {
node.type = type;
node.end = this.lastTokEnd;
if (this.options.locations) node.loc.end = this.lastTokEndLoc;
if (this.options.ranges) node.range[1] = this.lastTokEnd;
return node;
};
// Finish node at given position
pp.finishNodeAt = function (node, type, pos, loc) {
node.type = type;
if (Array.isArray(pos)) {
if (this.options.locations && loc === undefined) {
// flatten pos
loc = pos[1];
pos = pos[0];
}
}
node.end = pos;
if (this.options.locations) node.loc.end = loc;
if (this.options.ranges) node.range[1] = pos;
return node;
};
},{"./location":8,"./state":13}],11:[function(_dereq_,module,exports){
// Interpret and default an options object
"use strict";
exports.getOptions = getOptions;
exports.__esModule = true;
var _util = _dereq_("./util");
var has = _util.has;
var isArray = _util.isArray;
var SourceLocation = _dereq_("./location").SourceLocation;
// A second optional argument can be given to further configure
// the parser process. These options are recognized:
var defaultOptions = {
// `ecmaVersion` indicates the ECMAScript version to parse. Must
// be either 3, or 5, or 6. This influences support for strict
// mode, the set of reserved words, support for getters and
// setters and other features.
ecmaVersion: 5,
// Source type ("script" or "module") for different semantics
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called
// when a semicolon is automatically inserted. It will be passed
// th position of the comma as an offset, and if `locations` is
// enabled, it is given the location as a `{line, column}` object
// as second argument.
onInsertedSemicolon: null,
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
// trailing commas.
onTrailingComma: null,
// By default, reserved words are not enforced. Disable
// `allowReserved` to enforce them. When this option has the
// value "never", reserved words and keywords can also not be
// used as property names.
allowReserved: true,
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// appearing at the top of the program.
allowImportExportEverywhere: false,
// When enabled, hashbang directive in the beginning of file
// is allowed and treated as a line comment.
allowHashBang: false,
// When `locations` is on, `loc` properties holding objects with
// `start` and `end` properties in `{line, column}` form (with
// line being 1-based and column 0-based) will be attached to the
// nodes.
locations: false,
// A function can be passed as `onToken` option, which will
// cause Acorn to call that function with object in the same
// format as tokenize() returns. Note that you are not
// allowed to call the parser from the callbackthat will
// corrupt its internal state.
onToken: null,
// A function can be passed as `onComment` option, which will
// cause Acorn to call that function with `(block, text, start,
// end)` parameters whenever a comment is skipped. `block` is a
// boolean indicating whether this is a block (`/* */`) comment,
// `text` is the content of the comment, and `start` and `end` are
// character offsets that denote the start and end of the comment.
// When the `locations` option is on, two more parameters are
// passed, the full `{line, column}` locations of the start and
// end of the comments. Note that you are not allowed to call the
// parser from the callbackthat will corrupt its internal state.
onComment: null,
// Nodes have their start and end characters offsets recorded in
// `start` and `end` properties (directly on the node, rather than
// the `loc` object, which holds line/column data. To also add a
// [semi-standardized][range] `range` property holding a `[start,
// end]` array with the same numbers, set the `ranges` option to
// `true`.
//
// [range]: path_to_url
ranges: false,
// It is possible to parse multiple files into a single AST by
// passing the tree produced by parsing the first file as
// `program` option in subsequent parses. This will add the
// toplevel forms of the parsed file to the `Program` (top) node
// of an existing parse tree.
program: null,
// When `locations` is on, you can pass this to record the source
// file in every node's `loc` object.
sourceFile: null,
// This value, if given, is stored in every node, whether
// `locations` is on or off.
directSourceFile: null,
// When enabled, parenthesized expressions are represented by
// (non-standard) ParenthesizedExpression nodes
preserveParens: false,
plugins: {}
};exports.defaultOptions = defaultOptions;
function getOptions(opts) {
var options = {};
for (var opt in defaultOptions) {
options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt];
}if (isArray(options.onToken)) {
(function () {
var tokens = options.onToken;
options.onToken = function (token) {
return tokens.push(token);
};
})();
}
if (isArray(options.onComment)) options.onComment = pushComment(options, options.onComment);
return options;
}
function pushComment(options, array) {
return function (block, text, start, end, startLoc, endLoc) {
var comment = {
type: block ? "Block" : "Line",
value: text,
start: start,
end: end
};
if (options.locations) comment.loc = new SourceLocation(this, startLoc, endLoc);
if (options.ranges) comment.range = [start, end];
array.push(comment);
};
}
},{"./location":8,"./util":18}],12:[function(_dereq_,module,exports){
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var lineBreak = _dereq_("./whitespace").lineBreak;
var pp = Parser.prototype;
// ## Parser utilities
// Test whether a statement node is the string literal `"use strict"`.
pp.isUseStrict = function (stmt) {
return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.value === "use strict";
};
// Predicate that tests whether the next token is of the given
// type, and if yes, consumes it as a side effect.
pp.eat = function (type) {
if (this.type === type) {
this.next();
return true;
} else {
return false;
}
};
// Tests whether parsed token is a contextual keyword.
pp.isContextual = function (name) {
return this.type === tt.name && this.value === name;
};
// Consumes contextual keyword if possible.
pp.eatContextual = function (name) {
return this.value === name && this.eat(tt.name);
};
// Asserts that following token is given contextual keyword.
pp.expectContextual = function (name) {
if (!this.eatContextual(name)) this.unexpected();
};
// Test whether a semicolon can be inserted at the current position.
pp.canInsertSemicolon = function () {
return this.type === tt.eof || this.type === tt.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
};
pp.insertSemicolon = function () {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon) this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
return true;
}
};
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
pp.semicolon = function () {
if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected();
};
pp.afterTrailingComma = function (tokType) {
if (this.type == tokType) {
if (this.options.onTrailingComma) this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
this.next();
return true;
}
};
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
pp.expect = function (type) {
this.eat(type) || this.unexpected();
};
// Raise an unexpected token error.
pp.unexpected = function (pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token");
};
},{"./state":13,"./tokentype":17,"./whitespace":19}],13:[function(_dereq_,module,exports){
"use strict";
exports.Parser = Parser;
exports.__esModule = true;
var _identifier = _dereq_("./identifier");
var reservedWords = _identifier.reservedWords;
var keywords = _identifier.keywords;
var tt = _dereq_("./tokentype").types;
var lineBreak = _dereq_("./whitespace").lineBreak;
function Parser(options, input, startPos) {
this.options = options;
this.sourceFile = this.options.sourceFile || null;
this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5];
this.isReservedWord = reservedWords[this.options.ecmaVersion];
this.input = input;
// Load plugins
this.loadPlugins(this.options.plugins);
// Set up token state
// The current position of the tokenizer in the input.
if (startPos) {
this.pos = startPos;
this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos));
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
} else {
this.pos = this.lineStart = 0;
this.curLine = 1;
}
// Properties of the current token:
// Its type
this.type = tt.eof;
// For tokens that include more information than their type, the value
this.value = null;
// Its start and end offset
this.start = this.end = this.pos;
// And, if locations are used, the {line, column} object
// corresponding to those offsets
this.startLoc = this.endLoc = null;
// Position information for the previous token
this.lastTokEndLoc = this.lastTokStartLoc = null;
this.lastTokStart = this.lastTokEnd = this.pos;
// The context stack is used to superficially track syntactic
// context to predict whether a regular expression is allowed in a
// given position.
this.context = this.initialContext();
this.exprAllowed = true;
// Figure out if it's a module code.
this.strict = this.inModule = this.options.sourceType === "module";
// Used to signify the start of a potential arrow function
this.potentialArrowAt = -1;
// Flags to track whether we are in a function, a generator.
this.inFunction = this.inGenerator = false;
// Labels in scope.
this.labels = [];
// If enabled, skip leading hashbang line.
if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === "#!") this.skipLineComment(2);
}
Parser.prototype.extend = function (name, f) {
this[name] = f(this[name]);
};
// Registered plugins
var plugins = {};
exports.plugins = plugins;
Parser.prototype.loadPlugins = function (plugins) {
for (var _name in plugins) {
var plugin = exports.plugins[_name];
if (!plugin) throw new Error("Plugin '" + _name + "' not found");
plugin(this, plugins[_name]);
}
};
},{"./identifier":7,"./tokentype":17,"./whitespace":19}],14:[function(_dereq_,module,exports){
"use strict";
var tt = _dereq_("./tokentype").types;
var Parser = _dereq_("./state").Parser;
var lineBreak = _dereq_("./whitespace").lineBreak;
var pp = Parser.prototype;
// ### Statement parsing
// Parse a program. Initializes the parser, reads any number of
// statements, and wraps them in a Program node. Optionally takes a
// `program` argument. If present, the statements will be appended
// to its body instead of creating a new node.
pp.parseTopLevel = function (node) {
var first = true;
if (!node.body) node.body = [];
while (this.type !== tt.eof) {
var stmt = this.parseStatement(true, true);
node.body.push(stmt);
if (first && this.isUseStrict(stmt)) this.setStrict(true);
first = false;
}
this.next();
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType;
}
return this.finishNode(node, "Program");
};
var loopLabel = { kind: "loop" },
switchLabel = { kind: "switch" };
// Parse a single statement.
//
// If expecting a statement and finding a slash operator, parse a
// regular expression literal. This is to handle cases like
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
pp.parseStatement = function (declaration, topLevel) {
var starttype = this.type,
node = this.startNode();
// Most types of statements are recognized by the keyword they
// start with. Many are trivial to parse, some require a bit of
// complexity.
switch (starttype) {
case tt._break:case tt._continue:
return this.parseBreakContinueStatement(node, starttype.keyword);
case tt._debugger:
return this.parseDebuggerStatement(node);
case tt._do:
return this.parseDoStatement(node);
case tt._for:
return this.parseForStatement(node);
case tt._function:
if (!declaration && this.options.ecmaVersion >= 6) this.unexpected();
return this.parseFunctionStatement(node);
case tt._class:
if (!declaration) this.unexpected();
return this.parseClass(node, true);
case tt._if:
return this.parseIfStatement(node);
case tt._return:
return this.parseReturnStatement(node);
case tt._switch:
return this.parseSwitchStatement(node);
case tt._throw:
return this.parseThrowStatement(node);
case tt._try:
return this.parseTryStatement(node);
case tt._let:case tt._const:
if (!declaration) this.unexpected(); // NOTE: falls through to _var
case tt._var:
return this.parseVarStatement(node, starttype);
case tt._while:
return this.parseWhileStatement(node);
case tt._with:
return this.parseWithStatement(node);
case tt.braceL:
return this.parseBlock();
case tt.semi:
return this.parseEmptyStatement(node);
case tt._export:
case tt._import:
if (!this.options.allowImportExportEverywhere) {
if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");
if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
}
return starttype === tt._import ? this.parseImport(node) : this.parseExport(node);
// If the statement does not start with a statement keyword or a
// brace, it's an ExpressionStatement or LabeledStatement. We
// simply start parsing an expression, and afterwards, if the
// next token is a colon and the expression was a simple
// Identifier node, we switch to interpreting it as a label.
default:
var maybeName = this.value,
expr = this.parseExpression();
if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) return this.parseLabeledStatement(node, maybeName, expr);else return this.parseExpressionStatement(node, expr);
}
};
pp.parseBreakContinueStatement = function (node, keyword) {
var isBreak = keyword == "break";
this.next();
if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null;else if (this.type !== tt.name) this.unexpected();else {
node.label = this.parseIdent();
this.semicolon();
}
// Verify that there is an actual destination to break or
// continue to.
for (var i = 0; i < this.labels.length; ++i) {
var lab = this.labels[i];
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
if (node.label && isBreak) break;
}
}
if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
};
pp.parseDebuggerStatement = function (node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
};
pp.parseDoStatement = function (node) {
this.next();
this.labels.push(loopLabel);
node.body = this.parseStatement(false);
this.labels.pop();
this.expect(tt._while);
node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6) this.eat(tt.semi);else this.semicolon();
return this.finishNode(node, "DoWhileStatement");
};
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
// the second parameter to `parseExpression`), and then check
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
pp.parseForStatement = function (node) {
this.next();
this.labels.push(loopLabel);
this.expect(tt.parenL);
if (this.type === tt.semi) return this.parseFor(node, null);
if (this.type === tt._var || this.type === tt._let || this.type === tt._const) {
var _init = this.startNode(),
varKind = this.type;
this.next();
this.parseVar(_init, true, varKind);
this.finishNode(_init, "VariableDeclaration");
if ((this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && _init.declarations.length === 1 && !(varKind !== tt._var && _init.declarations[0].init)) return this.parseForIn(node, _init);
return this.parseFor(node, _init);
}
var refShorthandDefaultPos = { start: 0 };
var init = this.parseExpression(true, refShorthandDefaultPos);
if (this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) {
this.toAssignable(init);
this.checkLVal(init);
return this.parseForIn(node, init);
} else if (refShorthandDefaultPos.start) {
this.unexpected(refShorthandDefaultPos.start);
}
return this.parseFor(node, init);
};
pp.parseFunctionStatement = function (node) {
this.next();
return this.parseFunction(node, true);
};
pp.parseIfStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
node.consequent = this.parseStatement(false);
node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null;
return this.finishNode(node, "IfStatement");
};
pp.parseReturnStatement = function (node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction) this.raise(this.start, "'return' outside of function");
this.next();
// In `return` (and `break`/`continue`), the keywords with
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null;else {
node.argument = this.parseExpression();this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
};
pp.parseSwitchStatement = function (node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
this.expect(tt.braceL);
this.labels.push(switchLabel);
// Statements under must be grouped (by label) in SwitchCase
// nodes. `cur` is used to keep the node that we are currently
// adding statements to.
for (var cur, sawDefault; this.type != tt.braceR;) {
if (this.type === tt._case || this.type === tt._default) {
var isCase = this.type === tt._case;
if (cur) this.finishNode(cur, "SwitchCase");
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
cur.test = this.parseExpression();
} else {
if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses");
sawDefault = true;
cur.test = null;
}
this.expect(tt.colon);
} else {
if (!cur) this.unexpected();
cur.consequent.push(this.parseStatement(true));
}
}
if (cur) this.finishNode(cur, "SwitchCase");
this.next(); // Closing brace
this.labels.pop();
return this.finishNode(node, "SwitchStatement");
};
pp.parseThrowStatement = function (node) {
this.next();
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) this.raise(this.lastTokEnd, "Illegal newline after throw");
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
};
// Reused empty array added for node fields that are always empty.
var empty = [];
pp.parseTryStatement = function (node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.type === tt._catch) {
var clause = this.startNode();
this.next();
this.expect(tt.parenL);
clause.param = this.parseBindingAtom();
this.checkLVal(clause.param, true);
this.expect(tt.parenR);
clause.guard = null;
clause.body = this.parseBlock();
node.handler = this.finishNode(clause, "CatchClause");
}
node.guardedHandlers = empty;
node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) this.raise(node.start, "Missing catch or finally clause");
return this.finishNode(node, "TryStatement");
};
pp.parseVarStatement = function (node, kind) {
this.next();
this.parseVar(node, false, kind);
this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
pp.parseWhileStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
this.labels.push(loopLabel);
node.body = this.parseStatement(false);
this.labels.pop();
return this.finishNode(node, "WhileStatement");
};
pp.parseWithStatement = function (node) {
if (this.strict) this.raise(this.start, "'with' in strict mode");
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement(false);
return this.finishNode(node, "WithStatement");
};
pp.parseEmptyStatement = function (node) {
this.next();
return this.finishNode(node, "EmptyStatement");
};
pp.parseLabeledStatement = function (node, maybeName, expr) {
for (var i = 0; i < this.labels.length; ++i) {
if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
}var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null;
this.labels.push({ name: maybeName, kind: kind });
node.body = this.parseStatement(true);
this.labels.pop();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
};
pp.parseExpressionStatement = function (node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
};
// Parse a semicolon-enclosed block of statements, handling `"use
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
pp.parseBlock = function (allowStrict) {
var node = this.startNode(),
first = true,
oldStrict = undefined;
node.body = [];
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
var stmt = this.parseStatement(true);
node.body.push(stmt);
if (first && allowStrict && this.isUseStrict(stmt)) {
oldStrict = this.strict;
this.setStrict(this.strict = true);
}
first = false;
}
if (oldStrict === false) this.setStrict(false);
return this.finishNode(node, "BlockStatement");
};
// Parse a regular `for` loop. The disambiguation code in
// `parseStatement` will already have parsed the init statement or
// expression.
pp.parseFor = function (node, init) {
node.init = init;
this.expect(tt.semi);
node.test = this.type === tt.semi ? null : this.parseExpression();
this.expect(tt.semi);
node.update = this.type === tt.parenR ? null : this.parseExpression();
this.expect(tt.parenR);
node.body = this.parseStatement(false);
this.labels.pop();
return this.finishNode(node, "ForStatement");
};
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
pp.parseForIn = function (node, init) {
var type = this.type === tt._in ? "ForInStatement" : "ForOfStatement";
this.next();
node.left = init;
node.right = this.parseExpression();
this.expect(tt.parenR);
node.body = this.parseStatement(false);
this.labels.pop();
return this.finishNode(node, type);
};
// Parse a list of variable declarations.
pp.parseVar = function (node, isFor, kind) {
node.declarations = [];
node.kind = kind.keyword;
for (;;) {
var decl = this.startNode();
this.parseVarId(decl);
if (this.eat(tt.eq)) {
decl.init = this.parseMaybeAssign(isFor);
} else if (kind === tt._const && !(this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
this.unexpected();
} else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) {
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
} else {
decl.init = null;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(tt.comma)) break;
}
return node;
};
pp.parseVarId = function (decl) {
decl.id = this.parseBindingAtom();
this.checkLVal(decl.id, true);
};
// Parse a function declaration or literal (depending on the
// `isStatement` parameter).
pp.parseFunction = function (node, isStatement, allowExpressionBody) {
this.initFunction(node);
if (this.options.ecmaVersion >= 6) node.generator = this.eat(tt.star);
if (isStatement || this.type === tt.name) node.id = this.parseIdent();
this.parseFunctionParams(node);
this.parseFunctionBody(node, allowExpressionBody);
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
};
pp.parseFunctionParams = function (node) {
this.expect(tt.parenL);
node.params = this.parseBindingList(tt.parenR, false, false);
};
// Parse a class declaration or literal (depending on the
// `isStatement` parameter).
pp.parseClass = function (node, isStatement) {
this.next();
this.parseClassId(node, isStatement);
this.parseClassSuper(node);
var classBody = this.startNode();
var hadConstructor = false;
classBody.body = [];
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
if (this.eat(tt.semi)) continue;
var method = this.startNode();
var isGenerator = this.eat(tt.star);
var isMaybeStatic = this.type === tt.name && this.value === "static";
this.parsePropertyName(method);
method["static"] = isMaybeStatic && this.type !== tt.parenL;
if (method["static"]) {
if (isGenerator) this.unexpected();
isGenerator = this.eat(tt.star);
this.parsePropertyName(method);
}
method.kind = "method";
if (!method.computed) {
var key = method.key;
var isGetSet = false;
if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) {
isGetSet = true;
method.kind = key.name;
key = this.parsePropertyName(method);
}
if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) {
if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");
if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");
if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
method.kind = "constructor";
hadConstructor = true;
}
}
this.parseClassMethod(classBody, method, isGenerator);
}
node.body = this.finishNode(classBody, "ClassBody");
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
pp.parseClassMethod = function (classBody, method, isGenerator) {
method.value = this.parseMethod(isGenerator);
classBody.body.push(this.finishNode(method, "MethodDefinition"));
};
pp.parseClassId = function (node, isStatement) {
node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null;
};
pp.parseClassSuper = function (node) {
node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null;
};
// Parses module export declaration.
pp.parseExport = function (node) {
this.next();
// export * from '...'
if (this.eat(tt.star)) {
this.expectContextual("from");
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration");
}
if (this.eat(tt._default)) {
// export default ...
var expr = this.parseMaybeAssign();
var needsSemi = true;
if (expr.type == "FunctionExpression" || expr.type == "ClassExpression") {
needsSemi = false;
if (expr.id) {
expr.type = expr.type == "FunctionExpression" ? "FunctionDeclaration" : "ClassDeclaration";
}
}
node.declaration = expr;
if (needsSemi) this.semicolon();
return this.finishNode(node, "ExportDefaultDeclaration");
}
// export var|const|let|function|class ...
if (this.shouldParseExportStatement()) {
node.declaration = this.parseStatement(true);
node.specifiers = [];
node.source = null;
} else {
// export { x, y as z } [from '...']
node.declaration = null;
node.specifiers = this.parseExportSpecifiers();
if (this.eatContextual("from")) {
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
} else {
node.source = null;
}
this.semicolon();
}
return this.finishNode(node, "ExportNamedDeclaration");
};
pp.shouldParseExportStatement = function () {
return this.type.keyword;
};
// Parses a comma-separated list of module exports.
pp.parseExportSpecifiers = function () {
var nodes = [],
first = true;
// export { x, y as z } [from '...']
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma);
if (this.afterTrailingComma(tt.braceR)) break;
} else first = false;
var node = this.startNode();
node.local = this.parseIdent(this.type === tt._default);
node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local;
nodes.push(this.finishNode(node, "ExportSpecifier"));
}
return nodes;
};
// Parses import declaration.
pp.parseImport = function (node) {
this.next();
// import '...'
if (this.type === tt.string) {
node.specifiers = empty;
node.source = this.parseExprAtom();
node.kind = "";
} else {
node.specifiers = this.parseImportSpecifiers();
this.expectContextual("from");
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
// Parses a comma-separated list of module imports.
pp.parseImportSpecifiers = function () {
var nodes = [],
first = true;
if (this.type === tt.name) {
// import defaultObj, { x, y as z } from '...'
var node = this.startNode();
node.local = this.parseIdent();
this.checkLVal(node.local, true);
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
if (!this.eat(tt.comma)) return nodes;
}
if (this.type === tt.star) {
var node = this.startNode();
this.next();
this.expectContextual("as");
node.local = this.parseIdent();
this.checkLVal(node.local, true);
nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"));
return nodes;
}
this.expect(tt.braceL);
while (!this.eat(tt.braceR)) {
if (!first) {
this.expect(tt.comma);
if (this.afterTrailingComma(tt.braceR)) break;
} else first = false;
var node = this.startNode();
node.imported = this.parseIdent(true);
node.local = this.eatContextual("as") ? this.parseIdent() : node.imported;
this.checkLVal(node.local, true);
nodes.push(this.finishNode(node, "ImportSpecifier"));
}
return nodes;
};
},{"./state":13,"./tokentype":17,"./whitespace":19}],15:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
// The algorithm used to determine whether a regexp can appear at a
// given point in the program is loosely based on sweet.js' approach.
// See path_to_url
var Parser = _dereq_("./state").Parser;
var tt = _dereq_("./tokentype").types;
var lineBreak = _dereq_("./whitespace").lineBreak;
var TokContext = exports.TokContext = function TokContext(token, isExpr, preserveSpace, override) {
_classCallCheck(this, TokContext);
this.token = token;
this.isExpr = isExpr;
this.preserveSpace = preserveSpace;
this.override = override;
};
var types = {
b_stat: new TokContext("{", false),
b_expr: new TokContext("{", true),
b_tmpl: new TokContext("${", true),
p_stat: new TokContext("(", false),
p_expr: new TokContext("(", true),
q_tmpl: new TokContext("`", true, true, function (p) {
return p.readTmplToken();
}),
f_expr: new TokContext("function", true)
};
exports.types = types;
var pp = Parser.prototype;
pp.initialContext = function () {
return [types.b_stat];
};
pp.braceIsBlock = function (prevType) {
var parent = undefined;
if (prevType === tt.colon && (parent = this.curContext()).token == "{") return !parent.isExpr;
if (prevType === tt._return) return lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof) return true;
if (prevType == tt.braceL) return this.curContext() === types.b_stat;
return !this.exprAllowed;
};
pp.updateContext = function (prevType) {
var update = undefined,
type = this.type;
if (type.keyword && prevType == tt.dot) this.exprAllowed = false;else if (update = type.updateContext) update.call(this, prevType);else this.exprAllowed = type.beforeExpr;
};
// Token-specific context update code
tt.parenR.updateContext = tt.braceR.updateContext = function () {
if (this.context.length == 1) {
this.exprAllowed = true;
return;
}
var out = this.context.pop();
if (out === types.b_stat && this.curContext() === types.f_expr) {
this.context.pop();
this.exprAllowed = false;
} else if (out === types.b_tmpl) {
this.exprAllowed = true;
} else {
this.exprAllowed = !out.isExpr;
}
};
tt.braceL.updateContext = function (prevType) {
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
this.exprAllowed = true;
};
tt.dollarBraceL.updateContext = function () {
this.context.push(types.b_tmpl);
this.exprAllowed = true;
};
tt.parenL.updateContext = function (prevType) {
var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while;
this.context.push(statementParens ? types.p_stat : types.p_expr);
this.exprAllowed = true;
};
tt.incDec.updateContext = function () {};
tt._function.updateContext = function () {
if (this.curContext() !== types.b_stat) this.context.push(types.f_expr);
this.exprAllowed = false;
};
tt.backQuote.updateContext = function () {
if (this.curContext() === types.q_tmpl) this.context.pop();else this.context.push(types.q_tmpl);
this.exprAllowed = false;
};
// tokExprAllowed stays unchanged
},{"./state":13,"./tokentype":17,"./whitespace":19}],16:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
var _identifier = _dereq_("./identifier");
var isIdentifierStart = _identifier.isIdentifierStart;
var isIdentifierChar = _identifier.isIdentifierChar;
var _tokentype = _dereq_("./tokentype");
var tt = _tokentype.types;
var keywordTypes = _tokentype.keywords;
var Parser = _dereq_("./state").Parser;
var SourceLocation = _dereq_("./location").SourceLocation;
var _whitespace = _dereq_("./whitespace");
var lineBreak = _whitespace.lineBreak;
var lineBreakG = _whitespace.lineBreakG;
var isNewLine = _whitespace.isNewLine;
var nonASCIIwhitespace = _whitespace.nonASCIIwhitespace;
// Object type used to represent tokens. Note that normally, tokens
// simply exist as properties on the parser object. This is only
// used for the onToken callback and the external tokenizer.
var Token = exports.Token = function Token(p) {
_classCallCheck(this, Token);
this.type = p.type;
this.value = p.value;
this.start = p.start;
this.end = p.end;
if (p.options.locations) this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
if (p.options.ranges) this.range = [p.start, p.end];
};
// ## Tokenizer
var pp = Parser.prototype;
// Are we running under Rhino?
var isRhino = typeof Packages !== "undefined";
// Move to the next token
pp.next = function () {
if (this.options.onToken) this.options.onToken(new Token(this));
this.lastTokEnd = this.end;
this.lastTokStart = this.start;
this.lastTokEndLoc = this.endLoc;
this.lastTokStartLoc = this.startLoc;
this.nextToken();
};
pp.getToken = function () {
this.next();
return new Token(this);
};
// If we're in an ES6 environment, make parsers iterable
if (typeof Symbol !== "undefined") pp[Symbol.iterator] = function () {
var self = this;
return { next: function next() {
var token = self.getToken();
return {
done: token.type === tt.eof,
value: token
};
} };
};
// Toggle strict mode. Re-reads the next number or string to please
// pedantic tests (`"use strict"; 010;` should fail).
pp.setStrict = function (strict) {
this.strict = strict;
if (this.type !== tt.num && this.type !== tt.string) return;
this.pos = this.start;
if (this.options.locations) {
while (this.pos < this.lineStart) {
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;
--this.curLine;
}
}
this.nextToken();
};
pp.curContext = function () {
return this.context[this.context.length - 1];
};
// Read a single token, updating the parser object's token-related
// properties.
pp.nextToken = function () {
var curContext = this.curContext();
if (!curContext || !curContext.preserveSpace) this.skipSpace();
this.start = this.pos;
if (this.options.locations) this.startLoc = this.curPosition();
if (this.pos >= this.input.length) return this.finishToken(tt.eof);
if (curContext.override) return curContext.override(this);else this.readToken(this.fullCharCodeAtPos());
};
pp.readToken = function (code) {
// Identifier or keyword. '\uXXXX' sequences are allowed in
// identifiers, so '\' also dispatches to that.
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) return this.readWord();
return this.getTokenFromCode(code);
};
pp.fullCharCodeAtPos = function () {
var code = this.input.charCodeAt(this.pos);
if (code <= 55295 || code >= 57344) return code;
var next = this.input.charCodeAt(this.pos + 1);
return (code << 10) + next - 56613888;
};
pp.skipBlockComment = function () {
var startLoc = this.options.onComment && this.options.locations && this.curPosition();
var start = this.pos,
end = this.input.indexOf("*/", this.pos += 2);
if (end === -1) this.raise(this.pos - 2, "Unterminated comment");
this.pos = end + 2;
if (this.options.locations) {
lineBreakG.lastIndex = start;
var match = undefined;
while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
++this.curLine;
this.lineStart = match.index + match[0].length;
}
}
if (this.options.onComment) this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, startLoc, this.options.locations && this.curPosition());
};
pp.skipLineComment = function (startSkip) {
var start = this.pos;
var startLoc = this.options.onComment && this.options.locations && this.curPosition();
var ch = this.input.charCodeAt(this.pos += startSkip);
while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
++this.pos;
ch = this.input.charCodeAt(this.pos);
}
if (this.options.onComment) this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, startLoc, this.options.locations && this.curPosition());
};
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
pp.skipSpace = function () {
while (this.pos < this.input.length) {
var ch = this.input.charCodeAt(this.pos);
if (ch === 32) {
// ' '
++this.pos;
} else if (ch === 13) {
++this.pos;
var next = this.input.charCodeAt(this.pos);
if (next === 10) {
++this.pos;
}
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
} else if (ch === 10 || ch === 8232 || ch === 8233) {
++this.pos;
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
} else if (ch > 8 && ch < 14) {
++this.pos;
} else if (ch === 47) {
// '/'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 42) {
// '*'
this.skipBlockComment();
} else if (next === 47) {
// '/'
this.skipLineComment(2);
} else break;
} else if (ch === 160) {
// '\xa0'
++this.pos;
} else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
++this.pos;
} else {
break;
}
}
};
// Called at the end of every token. Sets `end`, `val`, and
// maintains `context` and `exprAllowed`, and skips the space after
// the token, so that the next one's `start` will point at the
// right position.
pp.finishToken = function (type, val) {
this.end = this.pos;
if (this.options.locations) this.endLoc = this.curPosition();
var prevType = this.type;
this.type = type;
this.value = val;
this.updateContext(prevType);
};
// ### Token reading
// This is the function that is called to fetch the next token. It
// is somewhat obscure, because it works in character codes rather
// than characters, and because operator parsing has been inlined
// into it.
//
// All in the name of speed.
//
pp.readToken_dot = function () {
var next = this.input.charCodeAt(this.pos + 1);
if (next >= 48 && next <= 57) return this.readNumber(true);
var next2 = this.input.charCodeAt(this.pos + 2);
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {
// 46 = dot '.'
this.pos += 3;
return this.finishToken(tt.ellipsis);
} else {
++this.pos;
return this.finishToken(tt.dot);
}
};
pp.readToken_slash = function () {
// '/'
var next = this.input.charCodeAt(this.pos + 1);
if (this.exprAllowed) {
++this.pos;return this.readRegexp();
}
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(tt.slash, 1);
};
pp.readToken_mult_modulo = function (code) {
// '%*'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(code === 42 ? tt.star : tt.modulo, 1);
};
pp.readToken_pipe_amp = function (code) {
// '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2);
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1);
};
pp.readToken_caret = function () {
// '^'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(tt.bitwiseXOR, 1);
};
pp.readToken_plus_min = function (code) {
// '+-'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {
// A `-->` line comment
this.skipLineComment(3);
this.skipSpace();
return this.nextToken();
}
return this.finishOp(tt.incDec, 2);
}
if (next === 61) return this.finishOp(tt.assign, 2);
return this.finishOp(tt.plusMin, 1);
};
pp.readToken_lt_gt = function (code) {
// '<>'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1);
return this.finishOp(tt.bitShift, size);
}
if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) {
if (this.inModule) this.unexpected();
// `<!--`, an XML-style comment that should be interpreted as a line comment
this.skipLineComment(4);
this.skipSpace();
return this.nextToken();
}
if (next === 61) size = this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2;
return this.finishOp(tt.relational, size);
};
pp.readToken_eq_excl = function (code) {
// '=!'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2);
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) {
// '=>'
this.pos += 2;
return this.finishToken(tt.arrow);
}
return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1);
};
pp.getTokenFromCode = function (code) {
switch (code) {
// The interpretation of a dot depends on whether it is followed
// by a digit or another two dots.
case 46:
// '.'
return this.readToken_dot();
// Punctuation tokens.
case 40:
++this.pos;return this.finishToken(tt.parenL);
case 41:
++this.pos;return this.finishToken(tt.parenR);
case 59:
++this.pos;return this.finishToken(tt.semi);
case 44:
++this.pos;return this.finishToken(tt.comma);
case 91:
++this.pos;return this.finishToken(tt.bracketL);
case 93:
++this.pos;return this.finishToken(tt.bracketR);
case 123:
++this.pos;return this.finishToken(tt.braceL);
case 125:
++this.pos;return this.finishToken(tt.braceR);
case 58:
++this.pos;return this.finishToken(tt.colon);
case 63:
++this.pos;return this.finishToken(tt.question);
case 96:
// '`'
if (this.options.ecmaVersion < 6) break;
++this.pos;
return this.finishToken(tt.backQuote);
case 48:
// '0'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
if (this.options.ecmaVersion >= 6) {
if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
}
// Anything else beginning with a digit is an integer, octal
// number, or float.
case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
// 1-9
return this.readNumber(false);
// Quotes produce strings.
case 34:case 39:
// '"', "'"
return this.readString(code);
// Operators are parsed inline in tiny state machines. '=' (61) is
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
case 47:
// '/'
return this.readToken_slash();
case 37:case 42:
// '%*'
return this.readToken_mult_modulo(code);
case 124:case 38:
// '|&'
return this.readToken_pipe_amp(code);
case 94:
// '^'
return this.readToken_caret();
case 43:case 45:
// '+-'
return this.readToken_plus_min(code);
case 60:case 62:
// '<>'
return this.readToken_lt_gt(code);
case 61:case 33:
// '=!'
return this.readToken_eq_excl(code);
case 126:
// '~'
return this.finishOp(tt.prefix, 1);
}
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
pp.finishOp = function (type, size) {
var str = this.input.slice(this.pos, this.pos + size);
this.pos += size;
return this.finishToken(type, str);
};
var regexpUnicodeSupport = false;
try {
new RegExp("", "u");regexpUnicodeSupport = true;
} catch (e) {}
// Parse a regular expression. Some context-awareness is necessary,
// since a '/' inside a '[]' set does not end the expression.
pp.readRegexp = function () {
var escaped = undefined,
inClass = undefined,
start = this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(start, "Unterminated regular expression");
var ch = this.input.charAt(this.pos);
if (lineBreak.test(ch)) this.raise(start, "Unterminated regular expression");
if (!escaped) {
if (ch === "[") inClass = true;else if (ch === "]" && inClass) inClass = false;else if (ch === "/" && !inClass) break;
escaped = ch === "\\";
} else escaped = false;
++this.pos;
}
var content = this.input.slice(start, this.pos);
++this.pos;
// Need to use `readWord1` because '\uXXXX' sequences are allowed
// here (don't ask).
var mods = this.readWord1();
var tmp = content;
if (mods) {
var validFlags = /^[gmsiy]*$/;
if (this.options.ecmaVersion >= 6) validFlags = /^[gmsiyu]*$/;
if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag");
if (mods.indexOf("u") >= 0 && !regexpUnicodeSupport) {
// Replace each astral symbol and every Unicode escape sequence that
// possibly represents an astral symbol or a paired surrogate with a
// single ASCII symbol to avoid throwing on regular expressions that
// are only valid in combination with the `/u` flag.
// Note: replacing with the ASCII symbol `x` might cause false
// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
// perfectly valid pattern that is equivalent to `[a-b]`, but it would
// be replaced by `[x-b]` which throws an error.
tmp = tmp.replace(/\\u([a-fA-F0-9]{4})|\\u\{([0-9a-fA-F]+)\}|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x");
}
}
// Detect invalid regular expressions.
var value = null;
// Rhino's regular expression parser is flaky and throws uncatchable exceptions,
// so don't do detection if we are running under Rhino
if (!isRhino) {
try {
new RegExp(tmp);
} catch (e) {
if (e instanceof SyntaxError) this.raise(start, "Error parsing regular expression: " + e.message);
this.raise(e);
}
// Get a regular expression object for this pattern-flag pair, or `null` in
// case the current environment doesn't support the flags it uses.
try {
value = new RegExp(content, mods);
} catch (err) {}
}
return this.finishToken(tt.regexp, { pattern: content, flags: mods, value: value });
};
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
pp.readInt = function (radix, len) {
var start = this.pos,
total = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
var code = this.input.charCodeAt(this.pos),
val = undefined;
if (code >= 97) val = code - 97 + 10; // a
else if (code >= 65) val = code - 65 + 10; // A
else if (code >= 48 && code <= 57) val = code - 48; // 0-9
else val = Infinity;
if (val >= radix) break;
++this.pos;
total = total * radix + val;
}
if (this.pos === start || len != null && this.pos - start !== len) return null;
return total;
};
pp.readRadixNumber = function (radix) {
this.pos += 2; // 0x
var val = this.readInt(radix);
if (val == null) this.raise(this.start + 2, "Expected number in radix " + radix);
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");
return this.finishToken(tt.num, val);
};
// Read an integer, octal integer, or floating-point number.
pp.readNumber = function (startsWithDot) {
var start = this.pos,
isFloat = false,
octal = this.input.charCodeAt(this.pos) === 48;
if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");
if (this.input.charCodeAt(this.pos) === 46) {
++this.pos;
this.readInt(10);
isFloat = true;
}
var next = this.input.charCodeAt(this.pos);
if (next === 69 || next === 101) {
// 'eE'
next = this.input.charCodeAt(++this.pos);
if (next === 43 || next === 45) ++this.pos; // '+-'
if (this.readInt(10) === null) this.raise(start, "Invalid number");
isFloat = true;
}
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number");
var str = this.input.slice(start, this.pos),
val = undefined;
if (isFloat) val = parseFloat(str);else if (!octal || str.length === 1) val = parseInt(str, 10);else if (/[89]/.test(str) || this.strict) this.raise(start, "Invalid number");else val = parseInt(str, 8);
return this.finishToken(tt.num, val);
};
// Read a string value, interpreting backslash-escapes.
pp.readCodePoint = function () {
var ch = this.input.charCodeAt(this.pos),
code = undefined;
if (ch === 123) {
if (this.options.ecmaVersion < 6) this.unexpected();
++this.pos;
code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
++this.pos;
if (code > 1114111) this.unexpected();
} else {
code = this.readHexChar(4);
}
return code;
};
function codePointToString(code) {
// UTF-16 Decoding
if (code <= 65535) {
return String.fromCharCode(code);
}return String.fromCharCode((code - 65536 >> 10) + 55296, (code - 65536 & 1023) + 56320);
}
pp.readString = function (quote) {
var out = "",
chunkStart = ++this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated string constant");
var ch = this.input.charCodeAt(this.pos);
if (ch === quote) break;
if (ch === 92) {
// '\'
out += this.input.slice(chunkStart, this.pos);
out += this.readEscapedChar();
chunkStart = this.pos;
} else {
if (isNewLine(ch)) this.raise(this.start, "Unterminated string constant");
++this.pos;
}
}
out += this.input.slice(chunkStart, this.pos++);
return this.finishToken(tt.string, out);
};
// Reads template string tokens.
pp.readTmplToken = function () {
var out = "",
chunkStart = this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template");
var ch = this.input.charCodeAt(this.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
// '`', '${'
if (this.pos === this.start && this.type === tt.template) {
if (ch === 36) {
this.pos += 2;
return this.finishToken(tt.dollarBraceL);
} else {
++this.pos;
return this.finishToken(tt.backQuote);
}
}
out += this.input.slice(chunkStart, this.pos);
return this.finishToken(tt.template, out);
}
if (ch === 92) {
// '\'
out += this.input.slice(chunkStart, this.pos);
out += this.readEscapedChar();
chunkStart = this.pos;
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.pos);
++this.pos;
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
++this.pos;
out += "\n";
} else {
out += String.fromCharCode(ch);
}
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
chunkStart = this.pos;
} else {
++this.pos;
}
}
};
// Used to read escaped characters
pp.readEscapedChar = function () {
var ch = this.input.charCodeAt(++this.pos);
var octal = /^[0-7]+/.exec(this.input.slice(this.pos, this.pos + 3));
if (octal) octal = octal[0];
while (octal && parseInt(octal, 8) > 255) octal = octal.slice(0, -1);
if (octal === "0") octal = null;
++this.pos;
if (octal) {
if (this.strict) this.raise(this.pos - 2, "Octal literal in strict mode");
this.pos += octal.length - 1;
return String.fromCharCode(parseInt(octal, 8));
} else {
switch (ch) {
case 110:
return "\n"; // 'n' -> '\n'
case 114:
return "\r"; // 'r' -> '\r'
case 120:
return String.fromCharCode(this.readHexChar(2)); // 'x'
case 117:
return codePointToString(this.readCodePoint()); // 'u'
case 116:
return "\t"; // 't' -> '\t'
case 98:
return "\b"; // 'b' -> '\b'
case 118:
return "\u000b"; // 'v' -> '\u000b'
case 102:
return "\f"; // 'f' -> '\f'
case 48:
return "\u0000"; // 0 -> '\0'
case 13:
if (this.input.charCodeAt(this.pos) === 10) ++this.pos; // '\r\n'
case 10:
// ' \n'
if (this.options.locations) {
this.lineStart = this.pos;++this.curLine;
}
return "";
default:
return String.fromCharCode(ch);
}
}
};
// Used to read character escape sequences ('\x', '\u', '\U').
pp.readHexChar = function (len) {
var n = this.readInt(16, len);
if (n === null) this.raise(this.start, "Bad character escape sequence");
return n;
};
// Used to signal to callers of `readWord1` whether the word
// contained any escape sequences. This is needed because words with
// escape sequences must not be interpreted as keywords.
var containsEsc;
// Read an identifier, and return it as a string. Sets `containsEsc`
// to whether the word contained a '\u' escape.
//
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
pp.readWord1 = function () {
containsEsc = false;
var word = "",
first = true,
chunkStart = this.pos;
var astral = this.options.ecmaVersion >= 6;
while (this.pos < this.input.length) {
var ch = this.fullCharCodeAtPos();
if (isIdentifierChar(ch, astral)) {
this.pos += ch <= 65535 ? 1 : 2;
} else if (ch === 92) {
// "\"
containsEsc = true;
word += this.input.slice(chunkStart, this.pos);
var escStart = this.pos;
if (this.input.charCodeAt(++this.pos) != 117) // "u"
this.raise(this.pos, "Expecting Unicode escape sequence \\uXXXX");
++this.pos;
var esc = this.readCodePoint();
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) this.raise(escStart, "Invalid Unicode escape");
word += codePointToString(esc);
chunkStart = this.pos;
} else {
break;
}
first = false;
}
return word + this.input.slice(chunkStart, this.pos);
};
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
pp.readWord = function () {
var word = this.readWord1();
var type = tt.name;
if ((this.options.ecmaVersion >= 6 || !containsEsc) && this.isKeyword(word)) type = keywordTypes[word];
return this.finishToken(type, word);
};
},{"./identifier":7,"./location":8,"./state":13,"./tokentype":17,"./whitespace":19}],17:[function(_dereq_,module,exports){
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
exports.__esModule = true;
// ## Token types
// The assignment of fine-grained, information-carrying type objects
// allows the tokenizer to store the information it has about a
// token in a way that is very cheap for the parser to look up.
// All token type variables start with an underscore, to make them
// easy to recognize.
// The `beforeExpr` property is used to disambiguate between regular
// expressions and divisions. It is set on all token types that can
// be followed by an expression (thus, a slash after them would be a
// regular expression).
//
// `isLoop` marks a keyword as starting a loop, which is important
// to know when parsing a label, in order to allow or disallow
// continue jumps to that label.
var TokenType = exports.TokenType = function TokenType(label) {
var conf = arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, TokenType);
this.label = label;
this.keyword = conf.keyword;
this.beforeExpr = !!conf.beforeExpr;
this.startsExpr = !!conf.startsExpr;
this.isLoop = !!conf.isLoop;
this.isAssign = !!conf.isAssign;
this.prefix = !!conf.prefix;
this.postfix = !!conf.postfix;
this.binop = conf.binop || null;
this.updateContext = null;
};
function binop(name, prec) {
return new TokenType(name, { beforeExpr: true, binop: prec });
}
var beforeExpr = { beforeExpr: true },
startsExpr = { startsExpr: true };
var types = {
num: new TokenType("num", startsExpr),
regexp: new TokenType("regexp", startsExpr),
string: new TokenType("string", startsExpr),
name: new TokenType("name", startsExpr),
eof: new TokenType("eof"),
// Punctuation token types.
bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
bracketR: new TokenType("]"),
braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
braceR: new TokenType("}"),
parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
// Operators. These carry several kinds of properties to help the
// parser use them properly (the presence of these properties is
// what categorizes them as operators).
//
// `binop`, when present, specifies that this operator is a binary
// operator, and will refer to its precedence.
//
// `prefix` and `postfix` mark the operator as a prefix or postfix
// unary operator.
//
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
// binary operators with a very low precedence, that should result
// in AssignmentExpression nodes.
eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
prefix: new TokenType("prefix", { beforeExpr: true, prefix: true, startsExpr: true }),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=", 6),
relational: binop("</>", 7),
bitShift: binop("<</>>", 8),
plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10)
};
exports.types = types;
// Map keyword names to token types.
var keywords = {};
exports.keywords = keywords;
// Succinct definitions of keyword token types
function kw(name) {
var options = arguments[1] === undefined ? {} : arguments[1];
options.keyword = name;
keywords[name] = types["_" + name] = new TokenType(name, options);
}
kw("break");
kw("case", beforeExpr);
kw("catch");
kw("continue");
kw("debugger");
kw("default");
kw("do", { isLoop: true });
kw("else", beforeExpr);
kw("finally");
kw("for", { isLoop: true });
kw("function", startsExpr);
kw("if");
kw("return", beforeExpr);
kw("switch");
kw("throw", beforeExpr);
kw("try");
kw("var");
kw("let");
kw("const");
kw("while", { isLoop: true });
kw("with");
kw("new", { beforeExpr: true, startsExpr: true });
kw("this", startsExpr);
kw("super", startsExpr);
kw("class");
kw("extends", beforeExpr);
kw("export");
kw("import");
kw("yield", { beforeExpr: true, startsExpr: true });
kw("null", startsExpr);
kw("true", startsExpr);
kw("false", startsExpr);
kw("in", { beforeExpr: true, binop: 7 });
kw("instanceof", { beforeExpr: true, binop: 7 });
kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true });
kw("void", { beforeExpr: true, prefix: true, startsExpr: true });
kw("delete", { beforeExpr: true, prefix: true, startsExpr: true });
},{}],18:[function(_dereq_,module,exports){
"use strict";
exports.isArray = isArray;
// Checks if an object has a property.
exports.has = has;
exports.__esModule = true;
function isArray(obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
}
function has(obj, propName) {
return Object.prototype.hasOwnProperty.call(obj, propName);
}
},{}],19:[function(_dereq_,module,exports){
"use strict";
exports.isNewLine = isNewLine;
exports.__esModule = true;
// Matches a whole line break (where CRLF is considered a single
// line break). Used to count lines.
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
exports.lineBreak = lineBreak;
var lineBreakG = new RegExp(lineBreak.source, "g");
exports.lineBreakG = lineBreakG;
function isNewLine(code) {
return code === 10 || code === 13 || code === 8232 || code == 8233;
}
var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
exports.nonASCIIwhitespace = nonASCIIwhitespace;
},{}]},{},[1])(1)
});
``` | /content/code_sandbox/node_modules/acorn/dist/acorn.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 34,234 |
```coffeescript
vows = require 'vows'
assert = require 'assert'
util = require 'util'
Netmask = require('../lib/netmask').Netmask
fixtures =
[
# addr mask base newmask bitmask
['209.157.68.22/255.255.224.0', null, '209.157.64.0', '255.255.224.0', 19]
['209.157.68.22', '255.255.224.0', '209.157.64.0', '255.255.224.0', 19]
['209.157.70.33/19', null, '209.157.64.0', '255.255.224.0', 19]
['209.157.70.33', null, '209.157.70.33', '255.255.255.255', 32]
['140.174.82', null, '140.174.0.82', '255.255.255.255', 32]
['140.174', null, '140.0.0.174', '255.255.255.255', 32]
['10', null, '0.0.0.10', '255.255.255.255', 32]
['10/8', null, '0.0.0.0', '255.0.0.0', 8]
['209.157.64/19', null, '209.157.0.0', '255.255.224.0', 19]
['216.140.48.16/32', null, '216.140.48.16', '255.255.255.255', 32]
['209.157/17', null, '209.0.0.0', '255.255.128.0', 17]
['0.0.0.0/0', null, '0.0.0.0', '0.0.0.0', 0]
['0xffffffff', null, '255.255.255.255', '255.255.255.255', 32]
['1.1', null, '1.0.0.1', '255.255.255.255', 32]
['1.0xffffff', null, '1.255.255.255', '255.255.255.255', 32]
['1.2.3', null, '1.2.0.3', '255.255.255.255', 32]
['1.2.0xffff', null, '1.2.255.255', '255.255.255.255', 32]
]
contexts = []
fixtures.forEach (fixture) ->
[addr, mask, base, newmask, bitmask] = fixture
context = topic: -> new Netmask(addr, mask)
context["base is `#{base}'"] = (block) -> assert.equal block.base, base
context["mask is `#{newmask}'"] = (block) -> assert.equal block.mask, newmask
context["bitmask is `#{bitmask}'"] = (block) -> assert.equal block.bitmask, bitmask
context["toString is `#{base}/`#{bitmask}'"] = (block) -> assert.equal block.toString(), block.base + "/" + block.bitmask
contexts["for #{addr}" + (if mask then " with #{mask}" else '')] = context
vows.describe('Netmaks parsing').addBatch(contexts).export(module)
vows.describe('Netmask contains IP')
.addBatch
'block 192.168.1.0/24':
topic: -> new Netmask('192.168.1.0/24')
'contains IP 192.168.1.0': (block) -> assert.ok block.contains('192.168.1.0')
'contains IP 192.168.1.255': (block) -> assert.ok block.contains('192.168.1.255')
'contains IP 192.168.1.63': (block) -> assert.ok block.contains('192.168.1.63')
'does not contain IP 192.168.0.255': (block) -> assert.ok not block.contains('192.168.0.255')
'does not contain IP 192.168.2.0': (block) -> assert.ok not block.contains('192.168.2.0')
'does not contain IP 10.168.2.0': (block) -> assert.ok not block.contains('10.168.2.0')
'does not contain IP 209.168.2.0': (block) -> assert.ok not block.contains('209.168.2.0')
'contains block 192.168.1.0/24': (block) -> assert.ok block.contains('192.168.1.0/24')
'contains block 192.168.1 (0.192.168.10)': (block) -> assert.ok not block.contains('192.168.1')
'does not contains block 192.168.1.128/25': (block) -> assert.ok block.contains('192.168.1.128/25')
'does not contain block 192.168.1.0/23': (block) -> assert.ok not block.contains('192.168.1.0/23')
'does not contain block 192.168.2.0/24': (block) -> assert.ok not block.contains('192.168.2.0/24')
'toString equals 192.168.1.0/24': (block) -> assert.equal block.toString(), '192.168.1.0/24'
'block 192.168.0.0/24':
topic: -> new Netmask('192.168.0.0/24')
'does not contain block 192.168 (0.0.192.168)': (block) -> assert.ok not block.contains('192.168')
'does not contain block 192.168.0.0/16': (block) -> assert.ok not block.contains('192.168.0.0/16')
'block 31.0.0.0/8':
topic: -> new Netmask('31.0.0.0/8')
'contains IP 31.5.5.5': (block) -> assert.ok block.contains('31.5.5.5')
'does not contain IP 031.5.5.5 (25.5.5.5)': (block) -> assert.ok not block.contains('031.5.5.5')
'does not contain IP 0x31.5.5.5 (49.5.5.5)': (block) -> assert.ok not block.contains('0x31.5.5.5')
'does not contain IP 0X31.5.5.5 (49.5.5.5)': (block) -> assert.ok not block.contains('0X31.5.5.5')
'block 127.0.0.0/8':
topic: -> new Netmask('127.0.0.0/8')
'contains IP 127.0.0.2': (block) -> assert.ok block.contains('127.0.0.2')
'contains IP 0177.0.0.2 (127.0.0.2)': (block) -> assert.ok block.contains('0177.0.0.2')
'contains IP 0x7f.0.0.2 (127.0.0.2)': (block) -> assert.ok block.contains('0x7f.0.0.2')
'does not contains IP 127 (0.0.0.127)': (block) -> assert.ok not block.contains('127')
'does not contains IP 0177 (0.0.0.127)': (block) -> assert.ok not block.contains('0177')
'block 0.0.0.0/24':
topic: -> new Netmask('0.0.0.0/0')
'contains IP 0.0.0.0': (block) -> assert.ok block.contains('0.0.0.0')
'contains IP 0': (block) -> assert.ok block.contains('0')
'contains IP 10 (0.0.0.10)': (block) -> assert.ok block.contains('10')
'contains IP 010 (0.0.0.8)': (block) -> assert.ok block.contains('010')
'contains IP 0x10 (0.0.0.16)': (block) -> assert.ok block.contains('0x10')
.export(module)
vows.describe('Netmask forEach')
.addBatch
'block 192.168.1.0/24':
topic: -> new Netmask('192.168.1.0/24')
'should loop through all ip addresses': (block) ->
called = 0
block.forEach (ip, long, index) ->
called = index
assert.equal (called + 1), 254
'block 192.168.1.0/23':
topic: -> new Netmask('192.168.1.0/23')
'should loop through all ip addresses': (block) ->
called = 0
block.forEach (ip, long, index) ->
called = index
assert.equal (called + 1), 510
.export(module)
``` | /content/code_sandbox/node_modules/netmask/test/netmasks.coffee | coffeescript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,175 |
```javascript
/* eslint-disable node/no-deprecated-api */
'use strict'
var buffer = require('buffer')
var Buffer = buffer.Buffer
var safer = require('./safer.js')
var Safer = safer.Buffer
var dangerous = {}
var key
for (key in safer) {
if (!safer.hasOwnProperty(key)) continue
dangerous[key] = safer[key]
}
var Dangereous = dangerous.Buffer = {}
// Copy Safer API
for (key in Safer) {
if (!Safer.hasOwnProperty(key)) continue
Dangereous[key] = Safer[key]
}
// Copy those missing unsafe methods, if they are present
for (key in Buffer) {
if (!Buffer.hasOwnProperty(key)) continue
if (Dangereous.hasOwnProperty(key)) continue
Dangereous[key] = Buffer[key]
}
if (!Dangereous.allocUnsafe) {
Dangereous.allocUnsafe = function (size) {
if (typeof size !== 'number') {
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
}
if (size < 0 || size >= 2 * (1 << 30)) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
return Buffer(size)
}
}
if (!Dangereous.allocUnsafeSlow) {
Dangereous.allocUnsafeSlow = function (size) {
if (typeof size !== 'number') {
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
}
if (size < 0 || size >= 2 * (1 << 30)) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
return buffer.SlowBuffer(size)
}
}
module.exports = dangerous
``` | /content/code_sandbox/node_modules/safer-buffer/dangerous.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 402 |
```javascript
/* eslint-disable node/no-deprecated-api */
'use strict'
var buffer = require('buffer')
var Buffer = buffer.Buffer
var safer = {}
var key
for (key in buffer) {
if (!buffer.hasOwnProperty(key)) continue
if (key === 'SlowBuffer' || key === 'Buffer') continue
safer[key] = buffer[key]
}
var Safer = safer.Buffer = {}
for (key in Buffer) {
if (!Buffer.hasOwnProperty(key)) continue
if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
Safer[key] = Buffer[key]
}
safer.Buffer.prototype = Buffer.prototype
if (!Safer.from || Safer.from === Uint8Array.from) {
Safer.from = function (value, encodingOrOffset, length) {
if (typeof value === 'number') {
throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
}
if (value && typeof value.length === 'undefined') {
throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
}
return Buffer(value, encodingOrOffset, length)
}
}
if (!Safer.alloc) {
Safer.alloc = function (size, fill, encoding) {
if (typeof size !== 'number') {
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
}
if (size < 0 || size >= 2 * (1 << 30)) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
var buf = Buffer(size)
if (!fill || fill.length === 0) {
buf.fill(0)
} else if (typeof encoding === 'string') {
buf.fill(fill, encoding)
} else {
buf.fill(fill)
}
return buf
}
}
if (!safer.kStringMaxLength) {
try {
safer.kStringMaxLength = process.binding('buffer').kStringMaxLength
} catch (e) {
// we can't determine kStringMaxLength in environments where process.binding
// is unsupported, so let's not set it
}
}
if (!safer.constants) {
safer.constants = {
MAX_LENGTH: safer.kMaxLength
}
if (safer.kStringMaxLength) {
safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength
}
}
module.exports = safer
``` | /content/code_sandbox/node_modules/safer-buffer/safer.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 543 |
```javascript
"use strict";
var punycode = require("punycode");
var mappingTable = require("./lib/mappingTable.json");
var PROCESSING_OPTIONS = {
TRANSITIONAL: 0,
NONTRANSITIONAL: 1
};
function normalize(str) { // fix bug in v8
return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000');
}
function findStatus(val) {
var start = 0;
var end = mappingTable.length - 1;
while (start <= end) {
var mid = Math.floor((start + end) / 2);
var target = mappingTable[mid];
if (target[0][0] <= val && target[0][1] >= val) {
return target;
} else if (target[0][0] > val) {
end = mid - 1;
} else {
start = mid + 1;
}
}
return null;
}
var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
function countSymbols(string) {
return string
// replace every surrogate pair with a BMP symbol
.replace(regexAstralSymbols, '_')
// then get the length
.length;
}
function mapChars(domain_name, useSTD3, processing_option) {
var hasError = false;
var processed = "";
var len = countSymbols(domain_name);
for (var i = 0; i < len; ++i) {
var codePoint = domain_name.codePointAt(i);
var status = findStatus(codePoint);
switch (status[1]) {
case "disallowed":
hasError = true;
processed += String.fromCodePoint(codePoint);
break;
case "ignored":
break;
case "mapped":
processed += String.fromCodePoint.apply(String, status[2]);
break;
case "deviation":
if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) {
processed += String.fromCodePoint.apply(String, status[2]);
} else {
processed += String.fromCodePoint(codePoint);
}
break;
case "valid":
processed += String.fromCodePoint(codePoint);
break;
case "disallowed_STD3_mapped":
if (useSTD3) {
hasError = true;
processed += String.fromCodePoint(codePoint);
} else {
processed += String.fromCodePoint.apply(String, status[2]);
}
break;
case "disallowed_STD3_valid":
if (useSTD3) {
hasError = true;
}
processed += String.fromCodePoint(codePoint);
break;
}
}
return {
string: processed,
error: hasError
};
}
var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;
function validateLabel(label, processing_option) {
if (label.substr(0, 4) === "xn--") {
label = punycode.toUnicode(label);
processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL;
}
var error = false;
if (normalize(label) !== label ||
(label[3] === "-" && label[4] === "-") ||
label[0] === "-" || label[label.length - 1] === "-" ||
label.indexOf(".") !== -1 ||
label.search(combiningMarksRegex) === 0) {
error = true;
}
var len = countSymbols(label);
for (var i = 0; i < len; ++i) {
var status = findStatus(label.codePointAt(i));
if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") ||
(processing === PROCESSING_OPTIONS.NONTRANSITIONAL &&
status[1] !== "valid" && status[1] !== "deviation")) {
error = true;
break;
}
}
return {
label: label,
error: error
};
}
function processing(domain_name, useSTD3, processing_option) {
var result = mapChars(domain_name, useSTD3, processing_option);
result.string = normalize(result.string);
var labels = result.string.split(".");
for (var i = 0; i < labels.length; ++i) {
try {
var validation = validateLabel(labels[i]);
labels[i] = validation.label;
result.error = result.error || validation.error;
} catch(e) {
result.error = true;
}
}
return {
string: labels.join("."),
error: result.error
};
}
module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) {
var result = processing(domain_name, useSTD3, processing_option);
var labels = result.string.split(".");
labels = labels.map(function(l) {
try {
return punycode.toASCII(l);
} catch(e) {
result.error = true;
return l;
}
});
if (verifyDnsLength) {
var total = labels.slice(0, labels.length - 1).join(".").length;
if (total.length > 253 || total.length === 0) {
result.error = true;
}
for (var i=0; i < labels.length; ++i) {
if (labels.length > 63 || labels.length === 0) {
result.error = true;
break;
}
}
}
if (result.error) return null;
return labels.join(".");
};
module.exports.toUnicode = function(domain_name, useSTD3) {
var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL);
return {
domain: result.string,
error: result.error
};
};
module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
``` | /content/code_sandbox/node_modules/tr46/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,968 |
```javascript
var Ajv = require('ajv');
var ajv = new Ajv({allErrors: true});
var schema = {
"properties": {
"foo": { "type": "string" },
"bar": { "type": "number", "maximum": 3 }
}
};
var validate = ajv.compile(schema);
test({"foo": "abc", "bar": 2});
test({"foo": 2, "bar": 4});
function test(data) {
var valid = validate(data);
if (valid) console.log('Valid!');
else console.log('Invalid: ' + ajv.errorsText(validate.errors));
}
``` | /content/code_sandbox/node_modules/ajv/.tonic_example.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 137 |
```javascript
'use strict';
var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;
var customRuleCode = require('./dotjs/custom');
var definitionSchema = require('./definition_schema');
module.exports = {
add: addKeyword,
get: getKeyword,
remove: removeKeyword,
validate: validateKeyword
};
/**
* Define custom keyword
* @this Ajv
* @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).
* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
* @return {Ajv} this for method chaining
*/
function addKeyword(keyword, definition) {
/* jshint validthis: true */
/* eslint no-shadow: 0 */
var RULES = this.RULES;
if (RULES.keywords[keyword])
throw new Error('Keyword ' + keyword + ' is already defined');
if (!IDENTIFIER.test(keyword))
throw new Error('Keyword ' + keyword + ' is not a valid identifier');
if (definition) {
this.validateKeyword(definition, true);
var dataType = definition.type;
if (Array.isArray(dataType)) {
for (var i=0; i<dataType.length; i++)
_addRule(keyword, dataType[i], definition);
} else {
_addRule(keyword, dataType, definition);
}
var metaSchema = definition.metaSchema;
if (metaSchema) {
if (definition.$data && this._opts.$data) {
metaSchema = {
anyOf: [
metaSchema,
{ '$ref': 'path_to_url#' }
]
};
}
definition.validateSchema = this.compile(metaSchema, true);
}
}
RULES.keywords[keyword] = RULES.all[keyword] = true;
function _addRule(keyword, dataType, definition) {
var ruleGroup;
for (var i=0; i<RULES.length; i++) {
var rg = RULES[i];
if (rg.type == dataType) {
ruleGroup = rg;
break;
}
}
if (!ruleGroup) {
ruleGroup = { type: dataType, rules: [] };
RULES.push(ruleGroup);
}
var rule = {
keyword: keyword,
definition: definition,
custom: true,
code: customRuleCode,
implements: definition.implements
};
ruleGroup.rules.push(rule);
RULES.custom[keyword] = rule;
}
return this;
}
/**
* Get keyword
* @this Ajv
* @param {String} keyword pre-defined or custom keyword.
* @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
*/
function getKeyword(keyword) {
/* jshint validthis: true */
var rule = this.RULES.custom[keyword];
return rule ? rule.definition : this.RULES.keywords[keyword] || false;
}
/**
* Remove keyword
* @this Ajv
* @param {String} keyword pre-defined or custom keyword.
* @return {Ajv} this for method chaining
*/
function removeKeyword(keyword) {
/* jshint validthis: true */
var RULES = this.RULES;
delete RULES.keywords[keyword];
delete RULES.all[keyword];
delete RULES.custom[keyword];
for (var i=0; i<RULES.length; i++) {
var rules = RULES[i].rules;
for (var j=0; j<rules.length; j++) {
if (rules[j].keyword == keyword) {
rules.splice(j, 1);
break;
}
}
}
return this;
}
/**
* Validate keyword definition
* @this Ajv
* @param {Object} definition keyword definition object.
* @param {Boolean} throwError true to throw exception if definition is invalid
* @return {boolean} validation result
*/
function validateKeyword(definition, throwError) {
validateKeyword.errors = null;
var v = this._validateKeyword = this._validateKeyword
|| this.compile(definitionSchema, true);
if (v(definition)) return true;
validateKeyword.errors = v.errors;
if (throwError)
throw new Error('custom keyword definition is invalid: ' + this.errorsText(v.errors));
else
return false;
}
``` | /content/code_sandbox/node_modules/ajv/lib/keyword.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 965 |
```javascript
'use strict';
var KEYWORDS = [
'multipleOf',
'maximum',
'exclusiveMaximum',
'minimum',
'exclusiveMinimum',
'maxLength',
'minLength',
'pattern',
'additionalItems',
'maxItems',
'minItems',
'uniqueItems',
'maxProperties',
'minProperties',
'required',
'additionalProperties',
'enum',
'format',
'const'
];
module.exports = function (metaSchema, keywordsJsonPointers) {
for (var i=0; i<keywordsJsonPointers.length; i++) {
metaSchema = JSON.parse(JSON.stringify(metaSchema));
var segments = keywordsJsonPointers[i].split('/');
var keywords = metaSchema;
var j;
for (j=1; j<segments.length; j++)
keywords = keywords[segments[j]];
for (j=0; j<KEYWORDS.length; j++) {
var key = KEYWORDS[j];
var schema = keywords[key];
if (schema) {
keywords[key] = {
anyOf: [
schema,
{ $ref: 'path_to_url#' }
]
};
}
}
}
return metaSchema;
};
``` | /content/code_sandbox/node_modules/ajv/lib/data.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 264 |
```javascript
/* eslint-disable node/no-deprecated-api */
'use strict'
var test = require('tape')
var buffer = require('buffer')
var index = require('./')
var safer = require('./safer')
var dangerous = require('./dangerous')
/* Inheritance tests */
test('Default is Safer', function (t) {
t.equal(index, safer)
t.notEqual(safer, dangerous)
t.notEqual(index, dangerous)
t.end()
})
test('Is not a function', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(typeof impl, 'object')
t.equal(typeof impl.Buffer, 'object')
});
[buffer].forEach(function (impl) {
t.equal(typeof impl, 'object')
t.equal(typeof impl.Buffer, 'function')
})
t.end()
})
test('Constructor throws', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.throws(function () { impl.Buffer() })
t.throws(function () { impl.Buffer(0) })
t.throws(function () { impl.Buffer('a') })
t.throws(function () { impl.Buffer('a', 'utf-8') })
t.throws(function () { return new impl.Buffer() })
t.throws(function () { return new impl.Buffer(0) })
t.throws(function () { return new impl.Buffer('a') })
t.throws(function () { return new impl.Buffer('a', 'utf-8') })
})
t.end()
})
test('Safe methods exist', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(typeof impl.Buffer.alloc, 'function', 'alloc')
t.equal(typeof impl.Buffer.from, 'function', 'from')
})
t.end()
})
test('Unsafe methods exist only in Dangerous', function (t) {
[index, safer].forEach(function (impl) {
t.equal(typeof impl.Buffer.allocUnsafe, 'undefined')
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined')
});
[dangerous].forEach(function (impl) {
t.equal(typeof impl.Buffer.allocUnsafe, 'function')
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function')
})
t.end()
})
test('Generic methods/properties are defined and equal', function (t) {
['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
test('Built-in buffer static methods/properties are inherited', function (t) {
Object.keys(buffer).forEach(function (method) {
if (method === 'SlowBuffer' || method === 'Buffer') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl[method], buffer[method], method)
t.notEqual(typeof impl[method], 'undefined', method)
})
})
t.end()
})
test('Built-in Buffer static methods/properties are inherited', function (t) {
Object.keys(buffer.Buffer).forEach(function (method) {
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
test('.prototype property of Buffer is inherited', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype')
t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype')
})
t.end()
})
test('All Safer methods are present in Dangerous', function (t) {
Object.keys(safer).forEach(function (method) {
if (method === 'Buffer') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl[method], safer[method], method)
if (method !== 'kStringMaxLength') {
t.notEqual(typeof impl[method], 'undefined', method)
}
})
})
Object.keys(safer.Buffer).forEach(function (method) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], safer.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
test('Safe methods from Dangerous methods are present in Safer', function (t) {
Object.keys(dangerous).forEach(function (method) {
if (method === 'Buffer') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl[method], dangerous[method], method)
if (method !== 'kStringMaxLength') {
t.notEqual(typeof impl[method], 'undefined', method)
}
})
})
Object.keys(dangerous.Buffer).forEach(function (method) {
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer[method], dangerous.Buffer[method], method)
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
})
})
t.end()
})
/* Behaviour tests */
test('Methods return Buffers', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0)))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10)))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10)))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64')))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3])))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3]))))
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([])))
});
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0)))
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10)))
})
t.end()
})
test('Constructor is buffer.Buffer', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer)
t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('string').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer)
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer)
t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer)
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer)
t.equal(impl.Buffer.from([]).constructor, buffer.Buffer)
});
[0, 10, 100].forEach(function (arg) {
t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer)
t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor)
})
t.end()
})
test('Invalid calls throw', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.throws(function () { impl.Buffer.from(0) })
t.throws(function () { impl.Buffer.from(10) })
t.throws(function () { impl.Buffer.from(10, 'utf-8') })
t.throws(function () { impl.Buffer.from('string', 'invalid encoding') })
t.throws(function () { impl.Buffer.from(-10) })
t.throws(function () { impl.Buffer.from(1e90) })
t.throws(function () { impl.Buffer.from(Infinity) })
t.throws(function () { impl.Buffer.from(-Infinity) })
t.throws(function () { impl.Buffer.from(NaN) })
t.throws(function () { impl.Buffer.from(null) })
t.throws(function () { impl.Buffer.from(undefined) })
t.throws(function () { impl.Buffer.from() })
t.throws(function () { impl.Buffer.from({}) })
t.throws(function () { impl.Buffer.alloc('') })
t.throws(function () { impl.Buffer.alloc('string') })
t.throws(function () { impl.Buffer.alloc('string', 'utf-8') })
t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') })
t.throws(function () { impl.Buffer.alloc(-10) })
t.throws(function () { impl.Buffer.alloc(1e90) })
t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) })
t.throws(function () { impl.Buffer.alloc(Infinity) })
t.throws(function () { impl.Buffer.alloc(-Infinity) })
t.throws(function () { impl.Buffer.alloc(null) })
t.throws(function () { impl.Buffer.alloc(undefined) })
t.throws(function () { impl.Buffer.alloc() })
t.throws(function () { impl.Buffer.alloc([]) })
t.throws(function () { impl.Buffer.alloc([0, 42, 3]) })
t.throws(function () { impl.Buffer.alloc({}) })
});
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
t.throws(function () { dangerous.Buffer[method]('') })
t.throws(function () { dangerous.Buffer[method]('string') })
t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') })
t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) })
t.throws(function () { dangerous.Buffer[method](Infinity) })
if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) {
t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0')
} else {
t.throws(function () { dangerous.Buffer[method](-10) })
t.throws(function () { dangerous.Buffer[method](-1e90) })
t.throws(function () { dangerous.Buffer[method](-Infinity) })
}
t.throws(function () { dangerous.Buffer[method](null) })
t.throws(function () { dangerous.Buffer[method](undefined) })
t.throws(function () { dangerous.Buffer[method]() })
t.throws(function () { dangerous.Buffer[method]([]) })
t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) })
t.throws(function () { dangerous.Buffer[method]({}) })
})
t.end()
})
test('Buffers have appropriate lengths', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.equal(impl.Buffer.alloc(0).length, 0)
t.equal(impl.Buffer.alloc(10).length, 10)
t.equal(impl.Buffer.from('').length, 0)
t.equal(impl.Buffer.from('string').length, 6)
t.equal(impl.Buffer.from('string', 'utf-8').length, 6)
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11)
t.equal(impl.Buffer.from([0, 42, 3]).length, 3)
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3)
t.equal(impl.Buffer.from([]).length, 0)
});
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
t.equal(dangerous.Buffer[method](0).length, 0)
t.equal(dangerous.Buffer[method](10).length, 10)
})
t.end()
})
test('Buffers have appropriate lengths (2)', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true;
[ safer.Buffer.alloc,
dangerous.Buffer.allocUnsafe,
dangerous.Buffer.allocUnsafeSlow
].forEach(function (method) {
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 1e5)
var buf = method(length)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
}
})
t.ok(ok)
t.end()
})
test('.alloc(size) is zero-filled and has correct length', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var buf = index.Buffer.alloc(length)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
var j
for (j = 0; j < length; j++) {
if (buf[j] !== 0) ok = false
}
buf.fill(1)
for (j = 0; j < length; j++) {
if (buf[j] !== 1) ok = false
}
}
t.ok(ok)
t.end()
})
test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) {
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var buf = dangerous.Buffer[method](length)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
buf.fill(0, 0, length)
var j
for (j = 0; j < length; j++) {
if (buf[j] !== 0) ok = false
}
buf.fill(1, 0, length)
for (j = 0; j < length; j++) {
if (buf[j] !== 1) ok = false
}
}
t.ok(ok, method)
})
t.end()
})
test('.alloc(size, fill) is `fill`-filled', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var fill = Math.round(Math.random() * 255)
var buf = index.Buffer.alloc(length, fill)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
for (var j = 0; j < length; j++) {
if (buf[j] !== fill) ok = false
}
}
t.ok(ok)
t.end()
})
test('.alloc(size, fill) is `fill`-filled', function (t) {
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
var ok = true
for (var i = 0; i < 1e2; i++) {
var length = Math.round(Math.random() * 2e6)
var fill = Math.round(Math.random() * 255)
var buf = index.Buffer.alloc(length, fill)
if (!buffer.Buffer.isBuffer(buf)) ok = false
if (buf.length !== length) ok = false
for (var j = 0; j < length; j++) {
if (buf[j] !== fill) ok = false
}
}
t.ok(ok)
t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97))
t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98))
var tmp = new buffer.Buffer(2)
tmp.fill('ok')
if (tmp[1] === tmp[0]) {
// Outdated Node.js
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo'))
} else {
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko'))
}
t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok'))
t.end()
})
test('safer.Buffer.from returns results same as Buffer constructor', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.deepEqual(impl.Buffer.from(''), new buffer.Buffer(''))
t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string'))
t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8'))
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64'))
t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3]))
t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3])))
t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([]))
})
t.end()
})
test('safer.Buffer.from returns consistent results', function (t) {
[index, safer, dangerous].forEach(function (impl) {
t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0))
t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0))
t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0))
t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string'))
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103]))
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string')))
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree'))
t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree'))
})
t.end()
})
``` | /content/code_sandbox/node_modules/safer-buffer/tests.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 4,276 |
```javascript
'use strict';
var Cache = module.exports = function Cache() {
this._cache = {};
};
Cache.prototype.put = function Cache_put(key, value) {
this._cache[key] = value;
};
Cache.prototype.get = function Cache_get(key) {
return this._cache[key];
};
Cache.prototype.del = function Cache_del(key) {
delete this._cache[key];
};
Cache.prototype.clear = function Cache_clear() {
this._cache = {};
};
``` | /content/code_sandbox/node_modules/ajv/lib/cache.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 95 |
```javascript
'use strict';
var metaSchema = require('./refs/json-schema-draft-07.json');
module.exports = {
$id: 'path_to_url
definitions: {
simpleTypes: metaSchema.definitions.simpleTypes
},
type: 'object',
dependencies: {
schema: ['validate'],
$data: ['validate'],
statements: ['inline'],
valid: {not: {required: ['macro']}}
},
properties: {
type: metaSchema.properties.type,
schema: {type: 'boolean'},
statements: {type: 'boolean'},
dependencies: {
type: 'array',
items: {type: 'string'}
},
metaSchema: {type: 'object'},
modifying: {type: 'boolean'},
valid: {type: 'boolean'},
$data: {type: 'boolean'},
async: {type: 'boolean'},
errors: {
anyOf: [
{type: 'boolean'},
{const: 'full'}
]
}
}
};
``` | /content/code_sandbox/node_modules/ajv/lib/definition_schema.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 221 |
```javascript
'use strict';
var MissingRefError = require('./error_classes').MissingRef;
module.exports = compileAsync;
/**
* Creates validating function for passed schema with asynchronous loading of missing schemas.
* `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
* @this Ajv
* @param {Object} schema schema object
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
* @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
* @return {Promise} promise that resolves with a validating function.
*/
function compileAsync(schema, meta, callback) {
/* eslint no-shadow: 0 */
/* global Promise */
/* jshint validthis: true */
var self = this;
if (typeof this._opts.loadSchema != 'function')
throw new Error('options.loadSchema should be a function');
if (typeof meta == 'function') {
callback = meta;
meta = undefined;
}
var p = loadMetaSchemaOf(schema).then(function () {
var schemaObj = self._addSchema(schema, undefined, meta);
return schemaObj.validate || _compileAsync(schemaObj);
});
if (callback) {
p.then(
function(v) { callback(null, v); },
callback
);
}
return p;
function loadMetaSchemaOf(sch) {
var $schema = sch.$schema;
return $schema && !self.getSchema($schema)
? compileAsync.call(self, { $ref: $schema }, true)
: Promise.resolve();
}
function _compileAsync(schemaObj) {
try { return self._compile(schemaObj); }
catch(e) {
if (e instanceof MissingRefError) return loadMissingSchema(e);
throw e;
}
function loadMissingSchema(e) {
var ref = e.missingSchema;
if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
var schemaPromise = self._loadingSchemas[ref];
if (!schemaPromise) {
schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
schemaPromise.then(removePromise, removePromise);
}
return schemaPromise.then(function (sch) {
if (!added(ref)) {
return loadMetaSchemaOf(sch).then(function () {
if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
});
}
}).then(function() {
return _compileAsync(schemaObj);
});
function removePromise() {
delete self._loadingSchemas[ref];
}
function added(ref) {
return self._refs[ref] || self._schemas[ref];
}
}
}
}
``` | /content/code_sandbox/node_modules/ajv/lib/compile/async.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 621 |
```javascript
'use strict';
var util = require('./util');
module.exports = SchemaObject;
function SchemaObject(obj) {
util.copy(obj, this);
}
``` | /content/code_sandbox/node_modules/ajv/lib/compile/schema_obj.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 31 |
```javascript
'use strict';
var compileSchema = require('./compile')
, resolve = require('./compile/resolve')
, Cache = require('./cache')
, SchemaObject = require('./compile/schema_obj')
, stableStringify = require('fast-json-stable-stringify')
, formats = require('./compile/formats')
, rules = require('./compile/rules')
, $dataMetaSchema = require('./data')
, util = require('./compile/util');
module.exports = Ajv;
Ajv.prototype.validate = validate;
Ajv.prototype.compile = compile;
Ajv.prototype.addSchema = addSchema;
Ajv.prototype.addMetaSchema = addMetaSchema;
Ajv.prototype.validateSchema = validateSchema;
Ajv.prototype.getSchema = getSchema;
Ajv.prototype.removeSchema = removeSchema;
Ajv.prototype.addFormat = addFormat;
Ajv.prototype.errorsText = errorsText;
Ajv.prototype._addSchema = _addSchema;
Ajv.prototype._compile = _compile;
Ajv.prototype.compileAsync = require('./compile/async');
var customKeyword = require('./keyword');
Ajv.prototype.addKeyword = customKeyword.add;
Ajv.prototype.getKeyword = customKeyword.get;
Ajv.prototype.removeKeyword = customKeyword.remove;
Ajv.prototype.validateKeyword = customKeyword.validate;
var errorClasses = require('./compile/error_classes');
Ajv.ValidationError = errorClasses.Validation;
Ajv.MissingRefError = errorClasses.MissingRef;
Ajv.$dataMetaSchema = $dataMetaSchema;
var META_SCHEMA_ID = 'path_to_url
var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];
var META_SUPPORT_DATA = ['/properties'];
/**
* Creates validator instance.
* Usage: `Ajv(opts)`
* @param {Object} opts optional options
* @return {Object} ajv instance
*/
function Ajv(opts) {
if (!(this instanceof Ajv)) return new Ajv(opts);
opts = this._opts = util.copy(opts) || {};
setLogger(this);
this._schemas = {};
this._refs = {};
this._fragments = {};
this._formats = formats(opts.format);
this._cache = opts.cache || new Cache;
this._loadingSchemas = {};
this._compilations = [];
this.RULES = rules();
this._getId = chooseGetId(opts);
opts.loopRequired = opts.loopRequired || Infinity;
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
if (opts.serialize === undefined) opts.serialize = stableStringify;
this._metaOpts = getMetaSchemaOptions(this);
if (opts.formats) addInitialFormats(this);
if (opts.keywords) addInitialKeywords(this);
addDefaultMetaSchema(this);
if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
addInitialSchemas(this);
}
/**
* Validate data using schema
* Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](path_to_url is used to serialize.
* @this Ajv
* @param {String|Object} schemaKeyRef key, ref or schema object
* @param {Any} data to be validated
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
*/
function validate(schemaKeyRef, data) {
var v;
if (typeof schemaKeyRef == 'string') {
v = this.getSchema(schemaKeyRef);
if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
} else {
var schemaObj = this._addSchema(schemaKeyRef);
v = schemaObj.validate || this._compile(schemaObj);
}
var valid = v(data);
if (v.$async !== true) this.errors = v.errors;
return valid;
}
/**
* Create validating function for passed schema.
* @this Ajv
* @param {Object} schema schema object
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
* @return {Function} validating function
*/
function compile(schema, _meta) {
var schemaObj = this._addSchema(schema, undefined, _meta);
return schemaObj.validate || this._compile(schemaObj);
}
/**
* Adds schema to the instance.
* @this Ajv
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
* @return {Ajv} this for method chaining
*/
function addSchema(schema, key, _skipValidation, _meta) {
if (Array.isArray(schema)){
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
return this;
}
var id = this._getId(schema);
if (id !== undefined && typeof id != 'string')
throw new Error('schema id must be string');
key = resolve.normalizeId(key || id);
checkUnique(this, key);
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
return this;
}
/**
* Add schema that will be used to validate other schemas
* options in META_IGNORE_OPTIONS are alway set to false
* @this Ajv
* @param {Object} schema schema object
* @param {String} key optional schema key
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
* @return {Ajv} this for method chaining
*/
function addMetaSchema(schema, key, skipValidation) {
this.addSchema(schema, key, skipValidation, true);
return this;
}
/**
* Validate schema
* @this Ajv
* @param {Object} schema schema to validate
* @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
* @return {Boolean} true if schema is valid
*/
function validateSchema(schema, throwOrLogError) {
var $schema = schema.$schema;
if ($schema !== undefined && typeof $schema != 'string')
throw new Error('$schema must be a string');
$schema = $schema || this._opts.defaultMeta || defaultMeta(this);
if (!$schema) {
this.logger.warn('meta-schema not available');
this.errors = null;
return true;
}
var valid = this.validate($schema, schema);
if (!valid && throwOrLogError) {
var message = 'schema is invalid: ' + this.errorsText();
if (this._opts.validateSchema == 'log') this.logger.error(message);
else throw new Error(message);
}
return valid;
}
function defaultMeta(self) {
var meta = self._opts.meta;
self._opts.defaultMeta = typeof meta == 'object'
? self._getId(meta) || meta
: self.getSchema(META_SCHEMA_ID)
? META_SCHEMA_ID
: undefined;
return self._opts.defaultMeta;
}
/**
* Get compiled schema from the instance by `key` or `ref`.
* @this Ajv
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
* @return {Function} schema validating function (with property `schema`).
*/
function getSchema(keyRef) {
var schemaObj = _getSchemaObj(this, keyRef);
switch (typeof schemaObj) {
case 'object': return schemaObj.validate || this._compile(schemaObj);
case 'string': return this.getSchema(schemaObj);
case 'undefined': return _getSchemaFragment(this, keyRef);
}
}
function _getSchemaFragment(self, ref) {
var res = resolve.schema.call(self, { schema: {} }, ref);
if (res) {
var schema = res.schema
, root = res.root
, baseId = res.baseId;
var v = compileSchema.call(self, schema, root, undefined, baseId);
self._fragments[ref] = new SchemaObject({
ref: ref,
fragment: true,
schema: schema,
root: root,
baseId: baseId,
validate: v
});
return v;
}
}
function _getSchemaObj(self, keyRef) {
keyRef = resolve.normalizeId(keyRef);
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
}
/**
* Remove cached schema(s).
* If no parameter is passed all schemas but meta-schemas are removed.
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
* @this Ajv
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @return {Ajv} this for method chaining
*/
function removeSchema(schemaKeyRef) {
if (schemaKeyRef instanceof RegExp) {
_removeAllSchemas(this, this._schemas, schemaKeyRef);
_removeAllSchemas(this, this._refs, schemaKeyRef);
return this;
}
switch (typeof schemaKeyRef) {
case 'undefined':
_removeAllSchemas(this, this._schemas);
_removeAllSchemas(this, this._refs);
this._cache.clear();
return this;
case 'string':
var schemaObj = _getSchemaObj(this, schemaKeyRef);
if (schemaObj) this._cache.del(schemaObj.cacheKey);
delete this._schemas[schemaKeyRef];
delete this._refs[schemaKeyRef];
return this;
case 'object':
var serialize = this._opts.serialize;
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
this._cache.del(cacheKey);
var id = this._getId(schemaKeyRef);
if (id) {
id = resolve.normalizeId(id);
delete this._schemas[id];
delete this._refs[id];
}
}
return this;
}
function _removeAllSchemas(self, schemas, regex) {
for (var keyRef in schemas) {
var schemaObj = schemas[keyRef];
if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
self._cache.del(schemaObj.cacheKey);
delete schemas[keyRef];
}
}
}
/* @this Ajv */
function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
if (typeof schema != 'object' && typeof schema != 'boolean')
throw new Error('schema should be object or boolean');
var serialize = this._opts.serialize;
var cacheKey = serialize ? serialize(schema) : schema;
var cached = this._cache.get(cacheKey);
if (cached) return cached;
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
var id = resolve.normalizeId(this._getId(schema));
if (id && shouldAddSchema) checkUnique(this, id);
var willValidate = this._opts.validateSchema !== false && !skipValidation;
var recursiveMeta;
if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
this.validateSchema(schema, true);
var localRefs = resolve.ids.call(this, schema);
var schemaObj = new SchemaObject({
id: id,
schema: schema,
localRefs: localRefs,
cacheKey: cacheKey,
meta: meta
});
if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj;
this._cache.put(cacheKey, schemaObj);
if (willValidate && recursiveMeta) this.validateSchema(schema, true);
return schemaObj;
}
/* @this Ajv */
function _compile(schemaObj, root) {
if (schemaObj.compiling) {
schemaObj.validate = callValidate;
callValidate.schema = schemaObj.schema;
callValidate.errors = null;
callValidate.root = root ? root : callValidate;
if (schemaObj.schema.$async === true)
callValidate.$async = true;
return callValidate;
}
schemaObj.compiling = true;
var currentOpts;
if (schemaObj.meta) {
currentOpts = this._opts;
this._opts = this._metaOpts;
}
var v;
try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
catch(e) {
delete schemaObj.validate;
throw e;
}
finally {
schemaObj.compiling = false;
if (schemaObj.meta) this._opts = currentOpts;
}
schemaObj.validate = v;
schemaObj.refs = v.refs;
schemaObj.refVal = v.refVal;
schemaObj.root = v.root;
return v;
/* @this {*} - custom context, see passContext option */
function callValidate() {
/* jshint validthis: true */
var _validate = schemaObj.validate;
var result = _validate.apply(this, arguments);
callValidate.errors = _validate.errors;
return result;
}
}
function chooseGetId(opts) {
switch (opts.schemaId) {
case 'auto': return _get$IdOrId;
case 'id': return _getId;
default: return _get$Id;
}
}
/* @this Ajv */
function _getId(schema) {
if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
return schema.id;
}
/* @this Ajv */
function _get$Id(schema) {
if (schema.id) this.logger.warn('schema id ignored', schema.id);
return schema.$id;
}
function _get$IdOrId(schema) {
if (schema.$id && schema.id && schema.$id != schema.id)
throw new Error('schema $id is different from id');
return schema.$id || schema.id;
}
/**
* Convert array of error message objects to string
* @this Ajv
* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
* @param {Object} options optional options with properties `separator` and `dataVar`.
* @return {String} human readable string with all errors descriptions
*/
function errorsText(errors, options) {
errors = errors || this.errors;
if (!errors) return 'No errors';
options = options || {};
var separator = options.separator === undefined ? ', ' : options.separator;
var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
var text = '';
for (var i=0; i<errors.length; i++) {
var e = errors[i];
if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;
}
return text.slice(0, -separator.length);
}
/**
* Add custom format
* @this Ajv
* @param {String} name format name
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
* @return {Ajv} this for method chaining
*/
function addFormat(name, format) {
if (typeof format == 'string') format = new RegExp(format);
this._formats[name] = format;
return this;
}
function addDefaultMetaSchema(self) {
var $dataSchema;
if (self._opts.$data) {
$dataSchema = require('./refs/data.json');
self.addMetaSchema($dataSchema, $dataSchema.$id, true);
}
if (self._opts.meta === false) return;
var metaSchema = require('./refs/json-schema-draft-07.json');
if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
self._refs['path_to_url = META_SCHEMA_ID;
}
function addInitialSchemas(self) {
var optsSchemas = self._opts.schemas;
if (!optsSchemas) return;
if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas);
else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key);
}
function addInitialFormats(self) {
for (var name in self._opts.formats) {
var format = self._opts.formats[name];
self.addFormat(name, format);
}
}
function addInitialKeywords(self) {
for (var name in self._opts.keywords) {
var keyword = self._opts.keywords[name];
self.addKeyword(name, keyword);
}
}
function checkUnique(self, id) {
if (self._schemas[id] || self._refs[id])
throw new Error('schema with key or id "' + id + '" already exists');
}
function getMetaSchemaOptions(self) {
var metaOpts = util.copy(self._opts);
for (var i=0; i<META_IGNORE_OPTIONS.length; i++)
delete metaOpts[META_IGNORE_OPTIONS[i]];
return metaOpts;
}
function setLogger(self) {
var logger = self._opts.logger;
if (logger === false) {
self.logger = {log: noop, warn: noop, error: noop};
} else {
if (logger === undefined) logger = console;
if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
throw new Error('logger must implement log, warn and error methods');
self.logger = logger;
}
}
function noop() {}
``` | /content/code_sandbox/node_modules/ajv/lib/ajv.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 3,956 |
```javascript
'use strict';
var resolve = require('./resolve')
, util = require('./util')
, errorClasses = require('./error_classes')
, stableStringify = require('fast-json-stable-stringify');
var validateGenerator = require('../dotjs/validate');
/**
* Functions below are used inside compiled validations function
*/
var ucs2length = util.ucs2length;
var equal = require('fast-deep-equal');
// this error is thrown by async schemas to return validation errors via exception
var ValidationError = errorClasses.Validation;
module.exports = compile;
/**
* Compiles schema to validation function
* @this Ajv
* @param {Object} schema schema object
* @param {Object} root object with information about the root schema for this schema
* @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
* @param {String} baseId base ID for IDs in the schema
* @return {Function} validation function
*/
function compile(schema, root, localRefs, baseId) {
/* jshint validthis: true, evil: true */
/* eslint no-shadow: 0 */
var self = this
, opts = this._opts
, refVal = [ undefined ]
, refs = {}
, patterns = []
, patternsHash = {}
, defaults = []
, defaultsHash = {}
, customRules = [];
root = root || { schema: schema, refVal: refVal, refs: refs };
var c = checkCompiling.call(this, schema, root, baseId);
var compilation = this._compilations[c.index];
if (c.compiling) return (compilation.callValidate = callValidate);
var formats = this._formats;
var RULES = this.RULES;
try {
var v = localCompile(schema, root, localRefs, baseId);
compilation.validate = v;
var cv = compilation.callValidate;
if (cv) {
cv.schema = v.schema;
cv.errors = null;
cv.refs = v.refs;
cv.refVal = v.refVal;
cv.root = v.root;
cv.$async = v.$async;
if (opts.sourceCode) cv.source = v.source;
}
return v;
} finally {
endCompiling.call(this, schema, root, baseId);
}
/* @this {*} - custom context, see passContext option */
function callValidate() {
/* jshint validthis: true */
var validate = compilation.validate;
var result = validate.apply(this, arguments);
callValidate.errors = validate.errors;
return result;
}
function localCompile(_schema, _root, localRefs, baseId) {
var isRoot = !_root || (_root && _root.schema == _schema);
if (_root.schema != root.schema)
return compile.call(self, _schema, _root, localRefs, baseId);
var $async = _schema.$async === true;
var sourceCode = validateGenerator({
isTop: true,
schema: _schema,
isRoot: isRoot,
baseId: baseId,
root: _root,
schemaPath: '',
errSchemaPath: '#',
errorPath: '""',
MissingRefError: errorClasses.MissingRef,
RULES: RULES,
validate: validateGenerator,
util: util,
resolve: resolve,
resolveRef: resolveRef,
usePattern: usePattern,
useDefault: useDefault,
useCustomRule: useCustomRule,
opts: opts,
formats: formats,
logger: self.logger,
self: self
});
sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
+ sourceCode;
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
var validate;
try {
var makeValidate = new Function(
'self',
'RULES',
'formats',
'root',
'refVal',
'defaults',
'customRules',
'equal',
'ucs2length',
'ValidationError',
sourceCode
);
validate = makeValidate(
self,
RULES,
formats,
root,
refVal,
defaults,
customRules,
equal,
ucs2length,
ValidationError
);
refVal[0] = validate;
} catch(e) {
self.logger.error('Error compiling schema, function code:', sourceCode);
throw e;
}
validate.schema = _schema;
validate.errors = null;
validate.refs = refs;
validate.refVal = refVal;
validate.root = isRoot ? validate : _root;
if ($async) validate.$async = true;
if (opts.sourceCode === true) {
validate.source = {
code: sourceCode,
patterns: patterns,
defaults: defaults
};
}
return validate;
}
function resolveRef(baseId, ref, isRoot) {
ref = resolve.url(baseId, ref);
var refIndex = refs[ref];
var _refVal, refCode;
if (refIndex !== undefined) {
_refVal = refVal[refIndex];
refCode = 'refVal[' + refIndex + ']';
return resolvedRef(_refVal, refCode);
}
if (!isRoot && root.refs) {
var rootRefId = root.refs[ref];
if (rootRefId !== undefined) {
_refVal = root.refVal[rootRefId];
refCode = addLocalRef(ref, _refVal);
return resolvedRef(_refVal, refCode);
}
}
refCode = addLocalRef(ref);
var v = resolve.call(self, localCompile, root, ref);
if (v === undefined) {
var localSchema = localRefs && localRefs[ref];
if (localSchema) {
v = resolve.inlineRef(localSchema, opts.inlineRefs)
? localSchema
: compile.call(self, localSchema, root, localRefs, baseId);
}
}
if (v === undefined) {
removeLocalRef(ref);
} else {
replaceLocalRef(ref, v);
return resolvedRef(v, refCode);
}
}
function addLocalRef(ref, v) {
var refId = refVal.length;
refVal[refId] = v;
refs[ref] = refId;
return 'refVal' + refId;
}
function removeLocalRef(ref) {
delete refs[ref];
}
function replaceLocalRef(ref, v) {
var refId = refs[ref];
refVal[refId] = v;
}
function resolvedRef(refVal, code) {
return typeof refVal == 'object' || typeof refVal == 'boolean'
? { code: code, schema: refVal, inline: true }
: { code: code, $async: refVal && !!refVal.$async };
}
function usePattern(regexStr) {
var index = patternsHash[regexStr];
if (index === undefined) {
index = patternsHash[regexStr] = patterns.length;
patterns[index] = regexStr;
}
return 'pattern' + index;
}
function useDefault(value) {
switch (typeof value) {
case 'boolean':
case 'number':
return '' + value;
case 'string':
return util.toQuotedString(value);
case 'object':
if (value === null) return 'null';
var valueStr = stableStringify(value);
var index = defaultsHash[valueStr];
if (index === undefined) {
index = defaultsHash[valueStr] = defaults.length;
defaults[index] = value;
}
return 'default' + index;
}
}
function useCustomRule(rule, schema, parentSchema, it) {
if (self._opts.validateSchema !== false) {
var deps = rule.definition.dependencies;
if (deps && !deps.every(function(keyword) {
return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
}))
throw new Error('parent schema must have all required keywords: ' + deps.join(','));
var validateSchema = rule.definition.validateSchema;
if (validateSchema) {
var valid = validateSchema(schema);
if (!valid) {
var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
if (self._opts.validateSchema == 'log') self.logger.error(message);
else throw new Error(message);
}
}
}
var compile = rule.definition.compile
, inline = rule.definition.inline
, macro = rule.definition.macro;
var validate;
if (compile) {
validate = compile.call(self, schema, parentSchema, it);
} else if (macro) {
validate = macro.call(self, schema, parentSchema, it);
if (opts.validateSchema !== false) self.validateSchema(validate, true);
} else if (inline) {
validate = inline.call(self, it, rule.keyword, schema, parentSchema);
} else {
validate = rule.definition.validate;
if (!validate) return;
}
if (validate === undefined)
throw new Error('custom keyword "' + rule.keyword + '"failed to compile');
var index = customRules.length;
customRules[index] = validate;
return {
code: 'customRule' + index,
validate: validate
};
}
}
/**
* Checks if the schema is currently compiled
* @this Ajv
* @param {Object} schema schema to compile
* @param {Object} root root object
* @param {String} baseId base schema ID
* @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
*/
function checkCompiling(schema, root, baseId) {
/* jshint validthis: true */
var index = compIndex.call(this, schema, root, baseId);
if (index >= 0) return { index: index, compiling: true };
index = this._compilations.length;
this._compilations[index] = {
schema: schema,
root: root,
baseId: baseId
};
return { index: index, compiling: false };
}
/**
* Removes the schema from the currently compiled list
* @this Ajv
* @param {Object} schema schema to compile
* @param {Object} root root object
* @param {String} baseId base schema ID
*/
function endCompiling(schema, root, baseId) {
/* jshint validthis: true */
var i = compIndex.call(this, schema, root, baseId);
if (i >= 0) this._compilations.splice(i, 1);
}
/**
* Index of schema compilation in the currently compiled list
* @this Ajv
* @param {Object} schema schema to compile
* @param {Object} root root object
* @param {String} baseId base schema ID
* @return {Integer} compilation index
*/
function compIndex(schema, root, baseId) {
/* jshint validthis: true */
for (var i=0; i<this._compilations.length; i++) {
var c = this._compilations[i];
if (c.schema == schema && c.root == root && c.baseId == baseId) return i;
}
return -1;
}
function patternCode(i, patterns) {
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
}
function defaultCode(i) {
return 'var default' + i + ' = defaults[' + i + '];';
}
function refValCode(i, refVal) {
return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];';
}
function customRuleCode(i) {
return 'var customRule' + i + ' = customRules[' + i + '];';
}
function vars(arr, statement) {
if (!arr.length) return '';
var code = '';
for (var i=0; i<arr.length; i++)
code += statement(i, arr);
return code;
}
``` | /content/code_sandbox/node_modules/ajv/lib/compile/index.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 2,718 |
```javascript
'use strict';
var resolve = require('./resolve');
module.exports = {
Validation: errorSubclass(ValidationError),
MissingRef: errorSubclass(MissingRefError)
};
function ValidationError(errors) {
this.message = 'validation failed';
this.errors = errors;
this.ajv = this.validation = true;
}
MissingRefError.message = function (baseId, ref) {
return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
};
function MissingRefError(baseId, ref, message) {
this.message = message || MissingRefError.message(baseId, ref);
this.missingRef = resolve.url(baseId, ref);
this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
}
function errorSubclass(Subclass) {
Subclass.prototype = Object.create(Error.prototype);
Subclass.prototype.constructor = Subclass;
return Subclass;
}
``` | /content/code_sandbox/node_modules/ajv/lib/compile/error_classes.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 193 |
```javascript
'use strict';
module.exports = {
copy: copy,
checkDataType: checkDataType,
checkDataTypes: checkDataTypes,
coerceToTypes: coerceToTypes,
toHash: toHash,
getProperty: getProperty,
escapeQuotes: escapeQuotes,
equal: require('fast-deep-equal'),
ucs2length: require('./ucs2length'),
varOccurences: varOccurences,
varReplace: varReplace,
schemaHasRules: schemaHasRules,
schemaHasRulesExcept: schemaHasRulesExcept,
schemaUnknownRules: schemaUnknownRules,
toQuotedString: toQuotedString,
getPathExpr: getPathExpr,
getPath: getPath,
getData: getData,
unescapeFragment: unescapeFragment,
unescapeJsonPointer: unescapeJsonPointer,
escapeFragment: escapeFragment,
escapeJsonPointer: escapeJsonPointer
};
function copy(o, to) {
to = to || {};
for (var key in o) to[key] = o[key];
return to;
}
function checkDataType(dataType, data, strictNumbers, negate) {
var EQUAL = negate ? ' !== ' : ' === '
, AND = negate ? ' || ' : ' && '
, OK = negate ? '!' : ''
, NOT = negate ? '' : '!';
switch (dataType) {
case 'null': return data + EQUAL + 'null';
case 'array': return OK + 'Array.isArray(' + data + ')';
case 'object': return '(' + OK + data + AND +
'typeof ' + data + EQUAL + '"object"' + AND +
NOT + 'Array.isArray(' + data + '))';
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
NOT + '(' + data + ' % 1)' +
AND + data + EQUAL + data +
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
}
}
function checkDataTypes(dataTypes, data, strictNumbers) {
switch (dataTypes.length) {
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
default:
var code = '';
var types = toHash(dataTypes);
if (types.array && types.object) {
code = types.null ? '(': '(!' + data + ' || ';
code += 'typeof ' + data + ' !== "object")';
delete types.null;
delete types.array;
delete types.object;
}
if (types.number) delete types.integer;
for (var t in types)
code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
return code;
}
}
var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
function coerceToTypes(optionCoerceTypes, dataTypes) {
if (Array.isArray(dataTypes)) {
var types = [];
for (var i=0; i<dataTypes.length; i++) {
var t = dataTypes[i];
if (COERCE_TO_TYPES[t]) types[types.length] = t;
else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
}
if (types.length) return types;
} else if (COERCE_TO_TYPES[dataTypes]) {
return [dataTypes];
} else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
return ['array'];
}
}
function toHash(arr) {
var hash = {};
for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
return hash;
}
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
var SINGLE_QUOTE = /'|\\/g;
function getProperty(key) {
return typeof key == 'number'
? '[' + key + ']'
: IDENTIFIER.test(key)
? '.' + key
: "['" + escapeQuotes(key) + "']";
}
function escapeQuotes(str) {
return str.replace(SINGLE_QUOTE, '\\$&')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\f/g, '\\f')
.replace(/\t/g, '\\t');
}
function varOccurences(str, dataVar) {
dataVar += '[^0-9]';
var matches = str.match(new RegExp(dataVar, 'g'));
return matches ? matches.length : 0;
}
function varReplace(str, dataVar, expr) {
dataVar += '([^0-9])';
expr = expr.replace(/\$/g, '$$$$');
return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
}
function schemaHasRules(schema, rules) {
if (typeof schema == 'boolean') return !schema;
for (var key in schema) if (rules[key]) return true;
}
function schemaHasRulesExcept(schema, rules, exceptKeyword) {
if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';
for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
}
function schemaUnknownRules(schema, rules) {
if (typeof schema == 'boolean') return;
for (var key in schema) if (!rules[key]) return key;
}
function toQuotedString(str) {
return '\'' + escapeQuotes(str) + '\'';
}
function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
var path = jsonPointers // false by default
? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
: (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
return joinPaths(currentPath, path);
}
function getPath(currentPath, prop, jsonPointers) {
var path = jsonPointers // false by default
? toQuotedString('/' + escapeJsonPointer(prop))
: toQuotedString(getProperty(prop));
return joinPaths(currentPath, path);
}
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
function getData($data, lvl, paths) {
var up, jsonPointer, data, matches;
if ($data === '') return 'rootData';
if ($data[0] == '/') {
if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
jsonPointer = $data;
data = 'rootData';
} else {
matches = $data.match(RELATIVE_JSON_POINTER);
if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
up = +matches[1];
jsonPointer = matches[2];
if (jsonPointer == '#') {
if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
return paths[lvl - up];
}
if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
data = 'data' + ((lvl - up) || '');
if (!jsonPointer) return data;
}
var expr = data;
var segments = jsonPointer.split('/');
for (var i=0; i<segments.length; i++) {
var segment = segments[i];
if (segment) {
data += getProperty(unescapeJsonPointer(segment));
expr += ' && ' + data;
}
}
return expr;
}
function joinPaths (a, b) {
if (a == '""') return b;
return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
}
function unescapeFragment(str) {
return unescapeJsonPointer(decodeURIComponent(str));
}
function escapeFragment(str) {
return encodeURIComponent(escapeJsonPointer(str));
}
function escapeJsonPointer(str) {
return str.replace(/~/g, '~0').replace(/\//g, '~1');
}
function unescapeJsonPointer(str) {
return str.replace(/~1/g, '/').replace(/~0/g, '~');
}
``` | /content/code_sandbox/node_modules/ajv/lib/compile/util.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 1,921 |
```javascript
'use strict';
// path_to_url
// path_to_url - punycode.ucs2.decode
module.exports = function ucs2length(str) {
var length = 0
, len = str.length
, pos = 0
, value;
while (pos < len) {
length++;
value = str.charCodeAt(pos++);
if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
// high surrogate, and there is a next character
value = str.charCodeAt(pos);
if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
}
}
return length;
};
``` | /content/code_sandbox/node_modules/ajv/lib/compile/ucs2length.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 148 |
```javascript
'use strict';
// do NOT remove this file - it would break pre-compiled schemas
// path_to_url
module.exports = require('fast-deep-equal');
``` | /content/code_sandbox/node_modules/ajv/lib/compile/equal.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 35 |
```javascript
'use strict';
var ruleModules = require('../dotjs')
, toHash = require('./util').toHash;
module.exports = function rules() {
var RULES = [
{ type: 'number',
rules: [ { 'maximum': ['exclusiveMaximum'] },
{ 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },
{ type: 'string',
rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
{ type: 'array',
rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },
{ type: 'object',
rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',
{ 'properties': ['additionalProperties', 'patternProperties'] } ] },
{ rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }
];
var ALL = [ 'type', '$comment' ];
var KEYWORDS = [
'$schema', '$id', 'id', '$data', '$async', 'title',
'description', 'default', 'definitions',
'examples', 'readOnly', 'writeOnly',
'contentMediaType', 'contentEncoding',
'additionalItems', 'then', 'else'
];
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
RULES.all = toHash(ALL);
RULES.types = toHash(TYPES);
RULES.forEach(function (group) {
group.rules = group.rules.map(function (keyword) {
var implKeywords;
if (typeof keyword == 'object') {
var key = Object.keys(keyword)[0];
implKeywords = keyword[key];
keyword = key;
implKeywords.forEach(function (k) {
ALL.push(k);
RULES.all[k] = true;
});
}
ALL.push(keyword);
var rule = RULES.all[keyword] = {
keyword: keyword,
code: ruleModules[keyword],
implements: implKeywords
};
return rule;
});
RULES.all.$comment = {
keyword: '$comment',
code: ruleModules.$comment
};
if (group.type) RULES.types[group.type] = group;
});
RULES.keywords = toHash(ALL.concat(KEYWORDS));
RULES.custom = {};
return RULES;
};
``` | /content/code_sandbox/node_modules/ajv/lib/compile/rules.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 536 |
```javascript
'use strict';
var util = require('./util');
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
// uri-template: path_to_url
var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
// For the source: path_to_url
// For test cases: path_to_url
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed path_to_url
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
module.exports = formats;
function formats(mode) {
mode = mode == 'full' ? 'full' : 'fast';
return util.copy(formats[mode]);
}
formats.fast = {
// date: path_to_url#section-5.6
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
// date-time: path_to_url#section-5.6
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
// uri: path_to_url
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
'uri-template': URITEMPLATE,
url: URL,
// email (sources from jsen validator):
// path_to_url#answer-8829363
// path_to_url#valid-e-mail-address (search for 'willful violation')
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
hostname: HOSTNAME,
// optimized path_to_url
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
// optimized path_to_url
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
regex: regex,
// uuid: path_to_url
uuid: UUID,
// JSON-pointer: path_to_url
// uri fragment: path_to_url#appendix-A
'json-pointer': JSON_POINTER,
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
// relative JSON-pointer: path_to_url
'relative-json-pointer': RELATIVE_JSON_POINTER
};
formats.full = {
date: date,
time: time,
'date-time': date_time,
uri: uri,
'uri-reference': URIREF,
'uri-template': URITEMPLATE,
url: URL,
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
hostname: HOSTNAME,
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
regex: regex,
uuid: UUID,
'json-pointer': JSON_POINTER,
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
'relative-json-pointer': RELATIVE_JSON_POINTER
};
function isLeapYear(year) {
// path_to_url#appendix-C
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function date(str) {
// full-date from path_to_url#section-5.6
var matches = str.match(DATE);
if (!matches) return false;
var year = +matches[1];
var month = +matches[2];
var day = +matches[3];
return month >= 1 && month <= 12 && day >= 1 &&
day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
}
function time(str, full) {
var matches = str.match(TIME);
if (!matches) return false;
var hour = matches[1];
var minute = matches[2];
var second = matches[3];
var timeZone = matches[5];
return ((hour <= 23 && minute <= 59 && second <= 59) ||
(hour == 23 && minute == 59 && second == 60)) &&
(!full || timeZone);
}
var DATE_TIME_SEPARATOR = /t|\s/i;
function date_time(str) {
// path_to_url#section-5.6
var dateTime = str.split(DATE_TIME_SEPARATOR);
return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
}
var NOT_URI_FRAGMENT = /\/|:/;
function uri(str) {
// path_to_url + optional protocol + required "."
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
}
var Z_ANCHOR = /[^\\]\\Z/;
function regex(str) {
if (Z_ANCHOR.test(str)) return false;
try {
new RegExp(str);
return true;
} catch(e) {
return false;
}
}
``` | /content/code_sandbox/node_modules/ajv/lib/compile/formats.js | javascript | 2016-03-11T09:28:00 | 2024-08-16T17:55:54 | antSword | AntSwordProject/antSword | 3,579 | 6,377 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.