@ibyar/expressions 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- package/api/abstract.d.ts +6 -2
- package/api/abstract.js +15 -8
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +15 -18
- package/api/class/class.js +49 -61
- package/api/class/class.js.map +1 -1
- package/api/class/decorator.d.ts +2 -2
- package/api/class/decorator.js +6 -6
- package/api/class/decorator.js.map +1 -1
- package/api/computing/call.d.ts +2 -2
- package/api/computing/call.js +8 -8
- package/api/computing/call.js.map +1 -1
- package/api/computing/debugger.d.ts +1 -2
- package/api/computing/debugger.js +2 -3
- package/api/computing/debugger.js.map +1 -1
- package/api/computing/new.d.ts +2 -2
- package/api/computing/new.js +7 -7
- package/api/computing/new.js.map +1 -1
- package/api/computing/rest.d.ts +2 -2
- package/api/computing/rest.js +6 -6
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +2 -2
- package/api/computing/return.js +6 -6
- package/api/computing/return.js.map +1 -1
- package/api/computing/spread.d.ts +2 -2
- package/api/computing/spread.js +6 -6
- package/api/computing/spread.js.map +1 -1
- package/api/computing/throw.d.ts +4 -4
- package/api/computing/throw.js +18 -18
- package/api/computing/throw.js.map +1 -1
- package/api/computing/yield.d.ts +2 -2
- package/api/computing/yield.js +7 -7
- package/api/computing/yield.js.map +1 -1
- package/api/definition/array.d.ts +3 -3
- package/api/definition/array.js +14 -14
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +2 -2
- package/api/definition/bind.js +9 -9
- package/api/definition/bind.js.map +1 -1
- package/api/definition/comment.d.ts +3 -3
- package/api/definition/comment.js +6 -6
- package/api/definition/comment.js.map +1 -1
- package/api/definition/function.d.ts +17 -16
- package/api/definition/function.js +60 -55
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.d.ts +2 -2
- package/api/definition/member.js +13 -9
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +4 -4
- package/api/definition/object.js +22 -22
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.d.ts +2 -2
- package/api/definition/statement.js +6 -6
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +15 -37
- package/api/definition/values.js +49 -74
- package/api/definition/values.js.map +1 -1
- package/api/expression.d.ts +42 -8
- package/api/expression.js.map +1 -1
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/api/index.js.map +1 -1
- package/api/module/common.d.ts +3 -3
- package/api/module/common.js +9 -9
- package/api/module/common.js.map +1 -1
- package/api/module/export.d.ts +5 -5
- package/api/module/export.js +30 -29
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +4 -4
- package/api/module/import.js +24 -23
- package/api/module/import.js.map +1 -1
- package/api/operators/assignment.d.ts +3 -3
- package/api/operators/assignment.js +5 -5
- package/api/operators/assignment.js.map +1 -1
- package/api/operators/await.d.ts +3 -3
- package/api/operators/await.js +7 -7
- package/api/operators/await.js.map +1 -1
- package/api/operators/binary.d.ts +1 -1
- package/api/operators/binary.js +1 -1
- package/api/operators/binary.js.map +1 -1
- package/api/operators/chaining.d.ts +2 -2
- package/api/operators/chaining.js +6 -6
- package/api/operators/chaining.js.map +1 -1
- package/api/operators/comma.d.ts +2 -2
- package/api/operators/comma.js +6 -6
- package/api/operators/comma.js.map +1 -1
- package/api/operators/grouping.d.ts +2 -2
- package/api/operators/grouping.js +6 -6
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/logical.d.ts +1 -1
- package/api/operators/logical.js +1 -1
- package/api/operators/logical.js.map +1 -1
- package/api/operators/pipeline.d.ts +3 -3
- package/api/operators/pipeline.js +8 -8
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/ternary.d.ts +2 -2
- package/api/operators/ternary.js +8 -8
- package/api/operators/ternary.js.map +1 -1
- package/api/operators/types.d.ts +1 -1
- package/api/operators/unary.d.ts +3 -3
- package/api/operators/unary.js +7 -7
- package/api/operators/unary.js.map +1 -1
- package/api/operators/update.d.ts +3 -3
- package/api/operators/update.js +8 -8
- package/api/operators/update.js.map +1 -1
- package/api/program.d.ts +3 -3
- package/api/program.js +7 -7
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +2 -2
- package/api/statement/control/block.js +6 -6
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +2 -3
- package/api/statement/control/empty.js +6 -7
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +2 -2
- package/api/statement/control/if.js +8 -8
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +4 -6
- package/api/statement/control/switch.js +19 -20
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +4 -4
- package/api/statement/control/terminate.js +11 -15
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/control/with.d.ts +21 -0
- package/api/statement/control/with.js +67 -0
- package/api/statement/control/with.js.map +1 -0
- package/api/statement/declarations/declares.d.ts +4 -4
- package/api/statement/declarations/declares.js +14 -14
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +7 -7
- package/api/statement/iterations/for.js +35 -35
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +3 -3
- package/api/statement/iterations/while.js +14 -14
- package/api/statement/iterations/while.js.map +1 -1
- package/package.json +14 -4
- package/scope/finalizer.d.ts +1 -1
- package/scope/pool.d.ts +1 -1
- package/scope/proxy.d.ts +1 -1
- package/scope/proxy.js +1 -0
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +2 -2
- package/scope/scope.js +13 -16
- package/scope/scope.js.map +1 -1
- package/scope/stack.js +23 -23
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +4 -2
- package/v8/enums.js.map +1 -1
- package/v8/factory.d.ts +148 -0
- package/v8/factory.js +499 -0
- package/v8/factory.js.map +1 -0
- package/v8/inline.d.ts +49 -49
- package/v8/inline.js +314 -305
- package/v8/inline.js.map +1 -1
- package/v8/node.d.ts +141 -0
- package/v8/node.js +2 -0
- package/v8/node.js.map +1 -0
- package/v8/nodes.d.ts +0 -14
- package/v8/nodes.js +1 -152
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +21 -18
- package/v8/parser.js +97 -84
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +2 -1
- package/v8/stream.js +221 -311
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +3 -1
- package/v8/token.js +7 -5
- package/v8/token.js.map +1 -1
- package/visit/visitor.d.ts +1 -1
package/v8/stream.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Token, TokenExpression } from './token.js';
|
|
2
|
-
import {
|
|
3
|
-
import { PrivateIdentifier } from '../api/class/class.js';
|
|
2
|
+
import { Identifier, Literal } from '../api/definition/values.js';
|
|
3
|
+
import { PrivateIdentifier, Super } from '../api/class/class.js';
|
|
4
4
|
import { DebuggerStatement } from '../api/computing/debugger.js';
|
|
5
5
|
import { isStrict, LanguageMode } from './language.js';
|
|
6
6
|
const FORBIDDEN_CODE_POINT = ['200b', '200c', '200d', 'feff'];
|
|
7
7
|
export const IdentifierRegex = /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
|
8
8
|
export const IdentifierStartRegex = /[_$a-zA-Z\xA0-\uFFFF]/;
|
|
9
9
|
export const IdentifierPartRegex = /[_$a-zA-Z0-9\xA0-\uFFFF]/;
|
|
10
|
-
const EOFToken = Object.freeze(new TokenExpression(Token.EOS));
|
|
11
10
|
;
|
|
12
11
|
export class PreTemplateLiteral {
|
|
13
12
|
constructor(strings, expressions) {
|
|
@@ -17,16 +16,12 @@ export class PreTemplateLiteral {
|
|
|
17
16
|
}
|
|
18
17
|
;
|
|
19
18
|
export class TemplateStringLiteral {
|
|
20
|
-
constructor(string) {
|
|
19
|
+
constructor(string, range) {
|
|
21
20
|
this.string = string;
|
|
21
|
+
this.range = range;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
export class TokenStream {
|
|
25
|
-
constructor(mode = LanguageMode.Strict) {
|
|
26
|
-
this.mode = mode;
|
|
27
|
-
this.pos = 0;
|
|
28
|
-
this.savedPosition = 0;
|
|
29
|
-
}
|
|
30
25
|
static getTokenStream(source, mode) {
|
|
31
26
|
if (Array.isArray(source)) {
|
|
32
27
|
return new TokenStreamer(source, mode);
|
|
@@ -36,6 +31,11 @@ export class TokenStream {
|
|
|
36
31
|
}
|
|
37
32
|
throw new Error(`Can't build token stream for ${source}`);
|
|
38
33
|
}
|
|
34
|
+
constructor(mode = LanguageMode.Strict) {
|
|
35
|
+
this.mode = mode;
|
|
36
|
+
this.pos = 0;
|
|
37
|
+
this.savedPosition = 0;
|
|
38
|
+
}
|
|
39
39
|
setLanguageMode(mode) {
|
|
40
40
|
this.mode = mode;
|
|
41
41
|
}
|
|
@@ -211,7 +211,7 @@ export class TokenStreamer extends TokenStream {
|
|
|
211
211
|
}
|
|
212
212
|
next() {
|
|
213
213
|
if (this.pos === this.tokens.length) {
|
|
214
|
-
return
|
|
214
|
+
return new TokenExpression(Token.EOS, [-1, -1]);
|
|
215
215
|
}
|
|
216
216
|
this.last = this.current;
|
|
217
217
|
return this.current = this.tokens[this.pos++];
|
|
@@ -234,12 +234,12 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
234
234
|
super(mode);
|
|
235
235
|
this.expression = expression;
|
|
236
236
|
}
|
|
237
|
-
newToken(type, value) {
|
|
238
|
-
return new TokenExpression(type, value);
|
|
237
|
+
newToken(type, range, value) {
|
|
238
|
+
return new TokenExpression(type, range, value);
|
|
239
239
|
}
|
|
240
240
|
next() {
|
|
241
241
|
if (this.pos >= this.expression.length) {
|
|
242
|
-
return this.current =
|
|
242
|
+
return this.current = this.newToken(Token.EOS, [this.expression.length, this.expression.length]);
|
|
243
243
|
}
|
|
244
244
|
this.last = this.current;
|
|
245
245
|
if (this.isWhitespace() || this.isComment()) {
|
|
@@ -261,7 +261,7 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
261
261
|
return this.current;
|
|
262
262
|
}
|
|
263
263
|
else if (this.pos >= this.expression.length) {
|
|
264
|
-
return this.current =
|
|
264
|
+
return this.current = this.newToken(Token.EOS, [this.expression.length, this.expression.length]);
|
|
265
265
|
}
|
|
266
266
|
else {
|
|
267
267
|
throw new Error(this.createError('Unknown character "' + this.expression.charAt(this.pos) + '"'));
|
|
@@ -328,8 +328,9 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
328
328
|
const end = this.pos;
|
|
329
329
|
const string = literal.join('');
|
|
330
330
|
const rawString = this.expression.substring(start, end);
|
|
331
|
-
const
|
|
332
|
-
|
|
331
|
+
const range = [start, end];
|
|
332
|
+
const stringNode = new Literal(string, rawString, undefined, undefined, range);
|
|
333
|
+
this.current = this.newToken(Token.STRING, range, stringNode);
|
|
333
334
|
return true;
|
|
334
335
|
}
|
|
335
336
|
if (c0 == '' || this.pos >= this.expression.length) {
|
|
@@ -366,6 +367,7 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
366
367
|
// These scoped helpers save and restore the original error state, so that we
|
|
367
368
|
// can specially treat invalid escape sequences in templates (which are
|
|
368
369
|
// handled by the parser).
|
|
370
|
+
const start = this.pos;
|
|
369
371
|
let result = Token.TEMPLATE_SPAN;
|
|
370
372
|
let literal = [], c0 = this.expression.charAt(this.pos);
|
|
371
373
|
const advance = () => {
|
|
@@ -426,7 +428,8 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
426
428
|
addLiteralChar(c);
|
|
427
429
|
}
|
|
428
430
|
}
|
|
429
|
-
|
|
431
|
+
const range = [start, this.pos];
|
|
432
|
+
return this.newToken(result, range, new TemplateStringLiteral(literal.join(''), range));
|
|
430
433
|
}
|
|
431
434
|
scanTemplateContinuation() {
|
|
432
435
|
if (this.current.isNotType(Token.RBRACE)) {
|
|
@@ -584,13 +587,11 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
584
587
|
isParentheses() {
|
|
585
588
|
const char = this.expression.charAt(this.pos);
|
|
586
589
|
if (char === '(') {
|
|
587
|
-
this.current = this.newToken(Token.LPAREN);
|
|
588
|
-
this.pos++;
|
|
590
|
+
this.current = this.newToken(Token.LPAREN, [this.pos, ++this.pos]);
|
|
589
591
|
return true;
|
|
590
592
|
}
|
|
591
593
|
else if (char === ')') {
|
|
592
|
-
this.current = this.newToken(Token.RPAREN);
|
|
593
|
-
this.pos++;
|
|
594
|
+
this.current = this.newToken(Token.RPAREN, [this.pos, ++this.pos]);
|
|
594
595
|
return true;
|
|
595
596
|
}
|
|
596
597
|
return false;
|
|
@@ -598,13 +599,11 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
598
599
|
isBracket() {
|
|
599
600
|
const char = this.expression.charAt(this.pos);
|
|
600
601
|
if (char === '[') {
|
|
601
|
-
this.current = this.newToken(Token.LBRACK);
|
|
602
|
-
this.pos++;
|
|
602
|
+
this.current = this.newToken(Token.LBRACK, [this.pos, ++this.pos]);
|
|
603
603
|
return true;
|
|
604
604
|
}
|
|
605
605
|
else if (char === ']') {
|
|
606
|
-
this.current = this.newToken(Token.RBRACK);
|
|
607
|
-
this.pos++;
|
|
606
|
+
this.current = this.newToken(Token.RBRACK, [this.pos, ++this.pos]);
|
|
608
607
|
return true;
|
|
609
608
|
}
|
|
610
609
|
return false;
|
|
@@ -612,13 +611,11 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
612
611
|
isCurlY() {
|
|
613
612
|
const char = this.expression.charAt(this.pos);
|
|
614
613
|
if (char === '{') {
|
|
615
|
-
this.current = this.newToken(Token.LBRACE);
|
|
616
|
-
this.pos++;
|
|
614
|
+
this.current = this.newToken(Token.LBRACE, [this.pos, ++this.pos]);
|
|
617
615
|
return true;
|
|
618
616
|
}
|
|
619
617
|
else if (char === '}') {
|
|
620
|
-
this.current = this.newToken(Token.RBRACE);
|
|
621
|
-
this.pos++;
|
|
618
|
+
this.current = this.newToken(Token.RBRACE, [this.pos, ++this.pos]);
|
|
622
619
|
return true;
|
|
623
620
|
}
|
|
624
621
|
return false;
|
|
@@ -626,8 +623,7 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
626
623
|
isComma() {
|
|
627
624
|
const char = this.expression.charAt(this.pos);
|
|
628
625
|
if (char === ',') {
|
|
629
|
-
this.current = this.newToken(Token.COMMA);
|
|
630
|
-
this.pos++;
|
|
626
|
+
this.current = this.newToken(Token.COMMA, [this.pos, ++this.pos]);
|
|
631
627
|
return true;
|
|
632
628
|
}
|
|
633
629
|
return false;
|
|
@@ -635,8 +631,7 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
635
631
|
isSemicolon() {
|
|
636
632
|
const char = this.expression.charAt(this.pos);
|
|
637
633
|
if (char === ';') {
|
|
638
|
-
this.current = this.newToken(Token.SEMICOLON);
|
|
639
|
-
this.pos++;
|
|
634
|
+
this.current = this.newToken(Token.SEMICOLON, [this.pos, ++this.pos]);
|
|
640
635
|
return true;
|
|
641
636
|
}
|
|
642
637
|
return false;
|
|
@@ -701,71 +696,73 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
701
696
|
}
|
|
702
697
|
let node;
|
|
703
698
|
if (isPrivate) {
|
|
704
|
-
|
|
705
|
-
|
|
699
|
+
const range = [startPos - 1, this.pos];
|
|
700
|
+
node = new PrivateIdentifier(identifierName, range);
|
|
701
|
+
this.current = this.newToken(Token.PRIVATE_NAME, range, node);
|
|
706
702
|
}
|
|
707
703
|
else {
|
|
704
|
+
const range = [startPos, this.pos];
|
|
708
705
|
switch (identifierName) {
|
|
709
706
|
case 'this':
|
|
710
|
-
this.current = this.newToken(Token.THIS,
|
|
707
|
+
this.current = this.newToken(Token.THIS, range);
|
|
711
708
|
break;
|
|
712
709
|
case 'null':
|
|
713
|
-
this.current = this.newToken(Token.NULL_LITERAL,
|
|
710
|
+
this.current = this.newToken(Token.NULL_LITERAL, range, new Literal(null, undefined, undefined, undefined, range));
|
|
714
711
|
break;
|
|
715
712
|
case 'undefined':
|
|
716
|
-
this.current = this.newToken(Token.UNDEFINED_LITERAL,
|
|
713
|
+
this.current = this.newToken(Token.UNDEFINED_LITERAL, range, new Literal(undefined, undefined, undefined, undefined, range));
|
|
717
714
|
break;
|
|
718
715
|
case 'true':
|
|
719
|
-
this.current = this.newToken(Token.TRUE_LITERAL,
|
|
716
|
+
this.current = this.newToken(Token.TRUE_LITERAL, range, new Literal(true, undefined, undefined, undefined, range));
|
|
720
717
|
break;
|
|
721
718
|
case 'false':
|
|
722
|
-
this.current = this.newToken(Token.FALSE_LITERAL,
|
|
719
|
+
this.current = this.newToken(Token.FALSE_LITERAL, range, new Literal(false, undefined, undefined, undefined, range));
|
|
723
720
|
break;
|
|
724
721
|
case 'globalThis':
|
|
725
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
722
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('globalThis', range));
|
|
726
723
|
break;
|
|
727
724
|
case 'Symbol':
|
|
728
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
725
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('Symbol', range));
|
|
729
726
|
break;
|
|
730
727
|
case 'of':
|
|
731
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
728
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('of', range));
|
|
732
729
|
break;
|
|
733
730
|
case 'as':
|
|
734
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
731
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('as', range));
|
|
735
732
|
break;
|
|
736
733
|
case 'default':
|
|
737
|
-
this.current = this.newToken(Token.DEFAULT,
|
|
734
|
+
this.current = this.newToken(Token.DEFAULT, range, new Identifier('default', range));
|
|
738
735
|
break;
|
|
739
736
|
case 'yield':
|
|
740
|
-
this.current = this.newToken(Token.YIELD,
|
|
737
|
+
this.current = this.newToken(Token.YIELD, range, new Identifier('yield', range));
|
|
741
738
|
break;
|
|
742
739
|
case 'constructor':
|
|
743
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
740
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('constructor', range));
|
|
744
741
|
break;
|
|
745
742
|
case 'arguments':
|
|
746
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
743
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('arguments', range));
|
|
747
744
|
break;
|
|
748
745
|
case 'name':
|
|
749
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
746
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('name', range));
|
|
750
747
|
break;
|
|
751
748
|
case 'eval':
|
|
752
|
-
this.current = this.newToken(Token.IDENTIFIER,
|
|
749
|
+
this.current = this.newToken(Token.IDENTIFIER, range, new Identifier('eval', range));
|
|
753
750
|
break;
|
|
754
751
|
case 'debugger':
|
|
755
|
-
this.current = this.newToken(Token.DEBUGGER, DebuggerStatement
|
|
752
|
+
this.current = this.newToken(Token.DEBUGGER, range, new DebuggerStatement(range));
|
|
756
753
|
break;
|
|
757
754
|
case 'class':
|
|
758
|
-
this.current = this.newToken(Token.CLASS);
|
|
755
|
+
this.current = this.newToken(Token.CLASS, range);
|
|
759
756
|
break;
|
|
760
757
|
case 'await':
|
|
761
|
-
this.current = this.newToken(Token.AWAIT,
|
|
758
|
+
this.current = this.newToken(Token.AWAIT, range, new Identifier('await', range));
|
|
762
759
|
break;
|
|
763
760
|
case 'async':
|
|
764
|
-
this.current = this.newToken(Token.ASYNC,
|
|
761
|
+
this.current = this.newToken(Token.ASYNC, range, new Identifier('async', range));
|
|
765
762
|
break;
|
|
766
763
|
default:
|
|
767
|
-
node = new Identifier(identifierName);
|
|
768
|
-
this.current = this.newToken(Token.IDENTIFIER, node);
|
|
764
|
+
node = new Identifier(identifierName, range);
|
|
765
|
+
this.current = this.newToken(Token.IDENTIFIER, range, node);
|
|
769
766
|
break;
|
|
770
767
|
}
|
|
771
768
|
}
|
|
@@ -876,62 +873,64 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
876
873
|
}
|
|
877
874
|
scanRegExpPattern() {
|
|
878
875
|
const peek = this.peek();
|
|
879
|
-
if (peek.isType(Token.DIV) || peek.isType(Token.DIV_ASSIGN)) {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
876
|
+
if (!(peek.isType(Token.DIV) || peek.isType(Token.DIV_ASSIGN))) {
|
|
877
|
+
return false;
|
|
878
|
+
}
|
|
879
|
+
const start = this.pos;
|
|
880
|
+
this.next();
|
|
881
|
+
let pattern = peek.isType(Token.DIV_ASSIGN) ? '=' : '';
|
|
882
|
+
let currentPos = this.pos;
|
|
883
|
+
let inCharacterClass = false;
|
|
884
|
+
let c = this.expression.charAt(currentPos);
|
|
885
|
+
while (c !== '/' || inCharacterClass) {
|
|
886
|
+
if (c == '' || this.isLineTerminator(c)) {
|
|
887
|
+
return false;
|
|
888
|
+
}
|
|
889
|
+
if (c === '\\') { // Escape sequence.
|
|
890
|
+
pattern += c;
|
|
891
|
+
c = this.expression.charAt(++currentPos);
|
|
886
892
|
if (c == '' || this.isLineTerminator(c)) {
|
|
887
893
|
return false;
|
|
888
894
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
c = this.expression.charAt(++currentPos);
|
|
892
|
-
if (c == '' || this.isLineTerminator(c)) {
|
|
893
|
-
return false;
|
|
894
|
-
}
|
|
895
|
-
pattern += c;
|
|
896
|
-
c = this.expression.charAt(++currentPos);
|
|
897
|
-
}
|
|
898
|
-
else {
|
|
899
|
-
if (c == '[')
|
|
900
|
-
inCharacterClass = true;
|
|
901
|
-
if (c == ']')
|
|
902
|
-
inCharacterClass = false;
|
|
903
|
-
pattern += c;
|
|
904
|
-
c = this.expression.charAt(++currentPos);
|
|
905
|
-
}
|
|
895
|
+
pattern += c;
|
|
896
|
+
c = this.expression.charAt(++currentPos);
|
|
906
897
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
898
|
+
else {
|
|
899
|
+
if (c == '[')
|
|
900
|
+
inCharacterClass = true;
|
|
901
|
+
if (c == ']')
|
|
902
|
+
inCharacterClass = false;
|
|
903
|
+
pattern += c;
|
|
904
|
+
c = this.expression.charAt(++currentPos);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
currentPos++; // consume '/'
|
|
908
|
+
let flags = '';
|
|
909
|
+
const remainFlags = TokenStreamImpl.REGEXP_FLAGS.slice();
|
|
910
|
+
while (true) {
|
|
911
|
+
const code = this.expression.charCodeAt(currentPos);
|
|
912
|
+
const nextChar = this.expression.charAt(currentPos);
|
|
913
|
+
if (/[\.\s]/.test(nextChar) || Number.isNaN(code) /* || FORBIDDEN_CODE_POINT.includes(code.toString(16))*/) {
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
const nextCharIndex = remainFlags.indexOf(nextChar);
|
|
917
|
+
if (nextCharIndex === -1) {
|
|
918
|
+
if (flags.includes(nextChar)) {
|
|
919
|
+
throw new Error(this.createError('Invalid regular expression flags'));
|
|
927
920
|
}
|
|
921
|
+
break;
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
flags += nextChar;
|
|
925
|
+
remainFlags.splice(nextCharIndex, 1);
|
|
926
|
+
currentPos++;
|
|
928
927
|
}
|
|
929
|
-
const regexNode = new Literal(new RegExp(pattern, flags), `/${pattern}/${flags}`, { pattern, flags });
|
|
930
|
-
this.current = this.newToken(Token.REGEXP_LITERAL, regexNode);
|
|
931
|
-
this.pos = currentPos;
|
|
932
|
-
return true;
|
|
933
928
|
}
|
|
934
|
-
|
|
929
|
+
const range = [start, currentPos];
|
|
930
|
+
const regexNode = new Literal(new RegExp(pattern, flags), `/${pattern}/${flags}`, { pattern, flags }, undefined, range);
|
|
931
|
+
this.current = this.newToken(Token.REGEXP_LITERAL, range, regexNode);
|
|
932
|
+
this.pos = currentPos;
|
|
933
|
+
return true;
|
|
935
934
|
}
|
|
936
935
|
unescape(v) {
|
|
937
936
|
let index = v.indexOf('\\');
|
|
@@ -1079,16 +1078,17 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
1079
1078
|
if (valid) {
|
|
1080
1079
|
const string = this.expression.substring(startPos, pos);
|
|
1081
1080
|
const rawString = this.expression.substring(this.pos, pos);
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1081
|
+
const range = [this.pos, pos];
|
|
1082
|
+
const numNode = new Literal(parseInt(string, radix), rawString, undefined, undefined, range);
|
|
1083
|
+
this.current = this.newToken(Token.NUMBER, range, numNode);
|
|
1084
1084
|
this.pos = pos;
|
|
1085
1085
|
}
|
|
1086
1086
|
return valid;
|
|
1087
1087
|
}
|
|
1088
1088
|
isNumber() {
|
|
1089
|
+
const startPos = this.pos;
|
|
1089
1090
|
let valid = false;
|
|
1090
1091
|
let pos = this.pos;
|
|
1091
|
-
let startPos = pos;
|
|
1092
1092
|
let resetPos = pos;
|
|
1093
1093
|
let foundDot = false;
|
|
1094
1094
|
let foundDigits = false;
|
|
@@ -1147,25 +1147,27 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
1147
1147
|
if (valid) {
|
|
1148
1148
|
const rawString = this.expression.substring(startPos, pos);
|
|
1149
1149
|
if (this.expression.charAt(pos) === 'n') {
|
|
1150
|
-
const bigintNode = new Literal(BigInt(rawString), rawString + 'n', undefined, rawString);
|
|
1151
|
-
this.current = this.newToken(Token.BIGINT, bigintNode);
|
|
1152
1150
|
pos++;
|
|
1151
|
+
const range = [startPos, this.pos];
|
|
1152
|
+
const bigintNode = new Literal(BigInt(rawString), rawString + 'n', undefined, rawString, range);
|
|
1153
|
+
this.current = this.newToken(Token.BIGINT, range, bigintNode);
|
|
1153
1154
|
}
|
|
1154
1155
|
else {
|
|
1155
1156
|
let numNode;
|
|
1157
|
+
const range = [startPos, this.pos];
|
|
1156
1158
|
if (isOctal) {
|
|
1157
1159
|
const octal = rawString.substring(2);
|
|
1158
1160
|
if (TokenStreamImpl.OctalPattern.test(octal)) {
|
|
1159
|
-
numNode = new Literal(parseInt(octal, 8), rawString);
|
|
1161
|
+
numNode = new Literal(parseInt(octal, 8), rawString, undefined, undefined, range);
|
|
1160
1162
|
}
|
|
1161
1163
|
else {
|
|
1162
1164
|
return false;
|
|
1163
1165
|
}
|
|
1164
1166
|
}
|
|
1165
1167
|
else {
|
|
1166
|
-
numNode = new Literal(parseFloat(rawString), rawString);
|
|
1168
|
+
numNode = new Literal(parseFloat(rawString), rawString, undefined, undefined, range);
|
|
1167
1169
|
}
|
|
1168
|
-
this.current = this.newToken(Token.NUMBER, numNode);
|
|
1170
|
+
this.current = this.newToken(Token.NUMBER, range, numNode);
|
|
1169
1171
|
}
|
|
1170
1172
|
this.pos = pos;
|
|
1171
1173
|
}
|
|
@@ -1179,356 +1181,284 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
1179
1181
|
switch (char) {
|
|
1180
1182
|
case '+':
|
|
1181
1183
|
if (this.expression.charAt(this.pos + 1) === '+') {
|
|
1182
|
-
this.current = this.newToken(Token.INC);
|
|
1183
|
-
this.pos += 2;
|
|
1184
|
+
this.current = this.newToken(Token.INC, [this.pos, (this.pos += 2)]);
|
|
1184
1185
|
}
|
|
1185
1186
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1186
|
-
this.current = this.newToken(Token.ADD_ASSIGN);
|
|
1187
|
-
this.pos += 2;
|
|
1187
|
+
this.current = this.newToken(Token.ADD_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1188
1188
|
}
|
|
1189
1189
|
else {
|
|
1190
|
-
this.current = this.newToken(Token.ADD);
|
|
1191
|
-
this.pos++;
|
|
1190
|
+
this.current = this.newToken(Token.ADD, [this.pos, (this.pos += 1)]);
|
|
1192
1191
|
}
|
|
1193
1192
|
return true;
|
|
1194
1193
|
case '-':
|
|
1195
1194
|
if (this.expression.charAt(this.pos + 1) === '-') {
|
|
1196
|
-
this.current = this.newToken(Token.DEC);
|
|
1197
|
-
this.pos += 2;
|
|
1195
|
+
this.current = this.newToken(Token.DEC, [this.pos, (this.pos += 2)]);
|
|
1198
1196
|
}
|
|
1199
1197
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1200
|
-
this.current = this.newToken(Token.SUB_ASSIGN);
|
|
1201
|
-
this.pos += 2;
|
|
1198
|
+
this.current = this.newToken(Token.SUB_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1202
1199
|
}
|
|
1203
1200
|
else {
|
|
1204
|
-
this.current = this.newToken(Token.SUB);
|
|
1205
|
-
this.pos++;
|
|
1201
|
+
this.current = this.newToken(Token.SUB, [this.pos, (this.pos += 1)]);
|
|
1206
1202
|
}
|
|
1207
1203
|
return true;
|
|
1208
1204
|
case '=':
|
|
1209
1205
|
if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1210
1206
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1211
|
-
this.current = this.newToken(Token.EQ_STRICT);
|
|
1212
|
-
this.pos += 3;
|
|
1207
|
+
this.current = this.newToken(Token.EQ_STRICT, [this.pos, (this.pos += 3)]);
|
|
1213
1208
|
}
|
|
1214
1209
|
else {
|
|
1215
|
-
this.current = this.newToken(Token.EQ);
|
|
1216
|
-
this.pos += 2;
|
|
1210
|
+
this.current = this.newToken(Token.EQ, [this.pos, (this.pos += 2)]);
|
|
1217
1211
|
}
|
|
1218
1212
|
}
|
|
1219
1213
|
else if (this.expression.charAt(this.pos + 1) === '>') {
|
|
1220
|
-
this.current = this.newToken(Token.ARROW);
|
|
1221
|
-
this.pos += 2;
|
|
1214
|
+
this.current = this.newToken(Token.ARROW, [this.pos, (this.pos += 2)]);
|
|
1222
1215
|
}
|
|
1223
1216
|
else {
|
|
1224
|
-
this.current = this.newToken(Token.ASSIGN);
|
|
1225
|
-
this.pos++;
|
|
1217
|
+
this.current = this.newToken(Token.ASSIGN, [this.pos, (this.pos += 1)]);
|
|
1226
1218
|
}
|
|
1227
1219
|
return true;
|
|
1228
1220
|
case '*':
|
|
1229
1221
|
if (this.expression.charAt(this.pos + 1) === '*') {
|
|
1230
1222
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1231
|
-
this.current = this.newToken(Token.EXP_ASSIGN);
|
|
1232
|
-
this.pos += 3;
|
|
1223
|
+
this.current = this.newToken(Token.EXP_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1233
1224
|
}
|
|
1234
1225
|
else {
|
|
1235
|
-
this.current = this.newToken(Token.EXP);
|
|
1236
|
-
this.pos += 2;
|
|
1226
|
+
this.current = this.newToken(Token.EXP, [this.pos, (this.pos += 2)]);
|
|
1237
1227
|
}
|
|
1238
1228
|
}
|
|
1239
1229
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1240
|
-
this.current = this.newToken(Token.MUL_ASSIGN);
|
|
1241
|
-
this.pos += 2;
|
|
1230
|
+
this.current = this.newToken(Token.MUL_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1242
1231
|
}
|
|
1243
1232
|
else {
|
|
1244
|
-
this.current = this.newToken(Token.MUL);
|
|
1245
|
-
this.pos++;
|
|
1233
|
+
this.current = this.newToken(Token.MUL, [this.pos, (this.pos += 1)]);
|
|
1246
1234
|
}
|
|
1247
1235
|
return true;
|
|
1248
1236
|
case '/':
|
|
1249
1237
|
if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1250
|
-
this.current = this.newToken(Token.DIV_ASSIGN);
|
|
1251
|
-
this.pos += 2;
|
|
1238
|
+
this.current = this.newToken(Token.DIV_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1252
1239
|
}
|
|
1253
1240
|
else {
|
|
1254
|
-
this.current = this.newToken(Token.DIV);
|
|
1255
|
-
this.pos++;
|
|
1241
|
+
this.current = this.newToken(Token.DIV, [this.pos, (this.pos += 1)]);
|
|
1256
1242
|
}
|
|
1257
1243
|
return true;
|
|
1258
1244
|
case '%':
|
|
1259
1245
|
if (this.expression.charAt(this.pos + 1) === '%') {
|
|
1260
1246
|
if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1261
|
-
this.current = this.newToken(Token.MODULO_ASSIGN);
|
|
1262
|
-
this.pos += 3;
|
|
1247
|
+
this.current = this.newToken(Token.MODULO_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1263
1248
|
}
|
|
1264
1249
|
else {
|
|
1265
|
-
this.current = this.newToken(Token.MODULO);
|
|
1266
|
-
this.pos += 2;
|
|
1250
|
+
this.current = this.newToken(Token.MODULO, [this.pos, (this.pos += 2)]);
|
|
1267
1251
|
}
|
|
1268
1252
|
}
|
|
1269
1253
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1270
|
-
this.current = this.newToken(Token.MOD_ASSIGN);
|
|
1271
|
-
this.pos += 2;
|
|
1254
|
+
this.current = this.newToken(Token.MOD_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1272
1255
|
}
|
|
1273
1256
|
else {
|
|
1274
|
-
this.current = this.newToken(Token.MOD);
|
|
1275
|
-
this.pos++;
|
|
1257
|
+
this.current = this.newToken(Token.MOD, [this.pos, (this.pos += 1)]);
|
|
1276
1258
|
}
|
|
1277
1259
|
return true;
|
|
1278
1260
|
case '^':
|
|
1279
1261
|
if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1280
|
-
this.current = this.newToken(Token.BIT_XOR_ASSIGN);
|
|
1281
|
-
this.pos += 2;
|
|
1262
|
+
this.current = this.newToken(Token.BIT_XOR_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1282
1263
|
}
|
|
1283
1264
|
else {
|
|
1284
|
-
this.current = this.newToken(Token.BIT_XOR);
|
|
1285
|
-
this.pos++;
|
|
1265
|
+
this.current = this.newToken(Token.BIT_XOR, [this.pos, (this.pos += 1)]);
|
|
1286
1266
|
}
|
|
1287
1267
|
return true;
|
|
1288
1268
|
case '>':
|
|
1289
1269
|
if (this.expression.charAt(this.pos + 1) === '>') {
|
|
1290
1270
|
if (this.expression.charAt(this.pos + 2) === '>') {
|
|
1291
1271
|
if (this.expression.charAt(this.pos + 3) === '=') {
|
|
1292
|
-
this.current = this.newToken(Token.SHR_ASSIGN);
|
|
1293
|
-
this.pos += 4;
|
|
1272
|
+
this.current = this.newToken(Token.SHR_ASSIGN, [this.pos, (this.pos += 4)]);
|
|
1294
1273
|
}
|
|
1295
1274
|
else {
|
|
1296
|
-
this.current = this.newToken(Token.SHR);
|
|
1297
|
-
this.pos += 3;
|
|
1275
|
+
this.current = this.newToken(Token.SHR, [this.pos, (this.pos += 3)]);
|
|
1298
1276
|
}
|
|
1299
1277
|
}
|
|
1300
1278
|
else if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1301
|
-
this.current = this.newToken(Token.SAR_ASSIGN);
|
|
1302
|
-
this.pos += 3;
|
|
1279
|
+
this.current = this.newToken(Token.SAR_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1303
1280
|
}
|
|
1304
1281
|
else {
|
|
1305
|
-
this.current = this.newToken(Token.SAR);
|
|
1306
|
-
this.pos += 2;
|
|
1282
|
+
this.current = this.newToken(Token.SAR, [this.pos, (this.pos += 2)]);
|
|
1307
1283
|
}
|
|
1308
1284
|
}
|
|
1309
1285
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1310
|
-
this.current = this.newToken(Token.GTE);
|
|
1311
|
-
this.pos += 2;
|
|
1286
|
+
this.current = this.newToken(Token.GTE, [this.pos, (this.pos += 2)]);
|
|
1312
1287
|
}
|
|
1313
1288
|
else if (this.expression.charAt(this.pos + 1) === '?') {
|
|
1314
1289
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1315
|
-
this.current = this.newToken(Token.LARGER_ASSIGN);
|
|
1316
|
-
this.pos += 3;
|
|
1290
|
+
this.current = this.newToken(Token.LARGER_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1317
1291
|
}
|
|
1318
1292
|
else {
|
|
1319
|
-
this.current = this.newToken(Token.LARGER);
|
|
1320
|
-
this.pos += 2;
|
|
1293
|
+
this.current = this.newToken(Token.LARGER, [this.pos, (this.pos += 2)]);
|
|
1321
1294
|
}
|
|
1322
1295
|
}
|
|
1323
1296
|
else {
|
|
1324
|
-
this.current = this.newToken(Token.GT);
|
|
1325
|
-
this.pos++;
|
|
1297
|
+
this.current = this.newToken(Token.GT, [this.pos, (this.pos += 2)]);
|
|
1326
1298
|
}
|
|
1327
1299
|
return true;
|
|
1328
1300
|
case '<':
|
|
1329
1301
|
if (this.expression.charAt(this.pos + 1) === '<') {
|
|
1330
1302
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1331
|
-
this.current = this.newToken(Token.SHL_ASSIGN);
|
|
1332
|
-
this.pos += 3;
|
|
1303
|
+
this.current = this.newToken(Token.SHL_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1333
1304
|
}
|
|
1334
1305
|
else {
|
|
1335
|
-
this.current = this.newToken(Token.SHL);
|
|
1336
|
-
this.pos += 2;
|
|
1306
|
+
this.current = this.newToken(Token.SHL, [this.pos, (this.pos += 2)]);
|
|
1337
1307
|
}
|
|
1338
1308
|
}
|
|
1339
1309
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1340
1310
|
if (this.expression.charAt(this.pos + 2) === '>') {
|
|
1341
|
-
this.current = this.newToken(Token.SPACESHIP);
|
|
1342
|
-
this.pos += 3;
|
|
1311
|
+
this.current = this.newToken(Token.SPACESHIP, [this.pos, (this.pos += 3)]);
|
|
1343
1312
|
}
|
|
1344
1313
|
else {
|
|
1345
|
-
this.current = this.newToken(Token.LTE);
|
|
1346
|
-
this.pos += 2;
|
|
1314
|
+
this.current = this.newToken(Token.LTE, [this.pos, (this.pos += 2)]);
|
|
1347
1315
|
}
|
|
1348
1316
|
}
|
|
1349
1317
|
else if (this.expression.charAt(this.pos + 1) === '?') {
|
|
1350
1318
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1351
|
-
this.current = this.newToken(Token.SMALLER_ASSIGN);
|
|
1352
|
-
this.pos += 3;
|
|
1319
|
+
this.current = this.newToken(Token.SMALLER_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1353
1320
|
}
|
|
1354
1321
|
else {
|
|
1355
|
-
this.current = this.newToken(Token.SMALLER);
|
|
1356
|
-
this.pos += 2;
|
|
1322
|
+
this.current = this.newToken(Token.SMALLER, [this.pos, (this.pos += 2)]);
|
|
1357
1323
|
}
|
|
1358
1324
|
}
|
|
1359
1325
|
else {
|
|
1360
|
-
this.current = this.newToken(Token.LT);
|
|
1361
|
-
this.pos++;
|
|
1326
|
+
this.current = this.newToken(Token.LT, [this.pos, (this.pos += 1)]);
|
|
1362
1327
|
}
|
|
1363
1328
|
return true;
|
|
1364
1329
|
case '|':
|
|
1365
1330
|
if (this.expression.charAt(this.pos + 1) === '|') {
|
|
1366
1331
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1367
|
-
this.current = this.newToken(Token.OR_ASSIGN);
|
|
1368
|
-
this.pos += 3;
|
|
1332
|
+
this.current = this.newToken(Token.OR_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1369
1333
|
}
|
|
1370
1334
|
else {
|
|
1371
|
-
this.current = this.newToken(Token.OR);
|
|
1372
|
-
this.pos += 2;
|
|
1335
|
+
this.current = this.newToken(Token.OR, [this.pos, (this.pos += 2)]);
|
|
1373
1336
|
}
|
|
1374
1337
|
}
|
|
1375
1338
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1376
|
-
this.current = this.newToken(Token.BIT_OR_ASSIGN);
|
|
1377
|
-
this.pos += 2;
|
|
1339
|
+
this.current = this.newToken(Token.BIT_OR_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1378
1340
|
}
|
|
1379
1341
|
else if (this.expression.charAt(this.pos + 1) === '>') {
|
|
1380
|
-
this.current = this.newToken(Token.PIPELINE);
|
|
1381
|
-
this.pos += 2;
|
|
1342
|
+
this.current = this.newToken(Token.PIPELINE, [this.pos, (this.pos += 2)]);
|
|
1382
1343
|
}
|
|
1383
1344
|
else {
|
|
1384
|
-
this.current = this.newToken(Token.BIT_OR);
|
|
1385
|
-
this.pos++;
|
|
1345
|
+
this.current = this.newToken(Token.BIT_OR, [this.pos, (this.pos += 1)]);
|
|
1386
1346
|
}
|
|
1387
1347
|
return true;
|
|
1388
1348
|
case '&':
|
|
1389
1349
|
if (this.expression.charAt(this.pos + 1) === '&') {
|
|
1390
1350
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1391
|
-
this.current = this.newToken(Token.AND_ASSIGN);
|
|
1392
|
-
this.pos += 3;
|
|
1351
|
+
this.current = this.newToken(Token.AND_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1393
1352
|
}
|
|
1394
1353
|
else {
|
|
1395
|
-
this.current = this.newToken(Token.AND);
|
|
1396
|
-
this.pos += 2;
|
|
1354
|
+
this.current = this.newToken(Token.AND, [this.pos, (this.pos += 2)]);
|
|
1397
1355
|
}
|
|
1398
1356
|
}
|
|
1399
1357
|
else if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1400
|
-
this.current = this.newToken(Token.BIT_AND_ASSIGN);
|
|
1401
|
-
this.pos += 2;
|
|
1358
|
+
this.current = this.newToken(Token.BIT_AND_ASSIGN, [this.pos, (this.pos += 2)]);
|
|
1402
1359
|
}
|
|
1403
1360
|
else {
|
|
1404
|
-
this.current = this.newToken(Token.BIT_AND);
|
|
1405
|
-
this.pos++;
|
|
1361
|
+
this.current = this.newToken(Token.BIT_AND, [this.pos, (this.pos += 1)]);
|
|
1406
1362
|
}
|
|
1407
1363
|
return true;
|
|
1408
1364
|
case '?':
|
|
1409
1365
|
if (this.expression.charAt(this.pos + 1) === '?') {
|
|
1410
1366
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1411
|
-
this.current = this.newToken(Token.NULLISH_ASSIGN);
|
|
1412
|
-
this.pos += 3;
|
|
1367
|
+
this.current = this.newToken(Token.NULLISH_ASSIGN, [this.pos, (this.pos += 3)]);
|
|
1413
1368
|
}
|
|
1414
1369
|
else {
|
|
1415
|
-
this.current = this.newToken(Token.NULLISH);
|
|
1416
|
-
this.pos += 2;
|
|
1370
|
+
this.current = this.newToken(Token.NULLISH, [this.pos, (this.pos += 2)]);
|
|
1417
1371
|
}
|
|
1418
1372
|
}
|
|
1419
1373
|
else if (this.expression.substring(this.pos + 1, this.pos + 3) == '::') {
|
|
1420
|
-
this.current = this.newToken(Token.QUESTION_BIND);
|
|
1421
|
-
this.pos += 3;
|
|
1374
|
+
this.current = this.newToken(Token.QUESTION_BIND, [this.pos, (this.pos += 3)]);
|
|
1422
1375
|
}
|
|
1423
1376
|
else if (this.expression.charAt(this.pos + 1) === '.') {
|
|
1424
|
-
this.current = this.newToken(Token.QUESTION_PERIOD);
|
|
1425
|
-
this.pos += 2;
|
|
1377
|
+
this.current = this.newToken(Token.QUESTION_PERIOD, [this.pos, (this.pos += 2)]);
|
|
1426
1378
|
}
|
|
1427
1379
|
else {
|
|
1428
|
-
this.current = this.newToken(Token.CONDITIONAL);
|
|
1429
|
-
this.pos++;
|
|
1380
|
+
this.current = this.newToken(Token.CONDITIONAL, [this.pos, (this.pos += 1)]);
|
|
1430
1381
|
}
|
|
1431
1382
|
return true;
|
|
1432
1383
|
case '!':
|
|
1433
1384
|
if (this.expression.charAt(this.pos + 1) === '=') {
|
|
1434
1385
|
if (this.expression.charAt(this.pos + 2) === '=') {
|
|
1435
|
-
this.current = this.newToken(Token.NE_STRICT);
|
|
1436
|
-
this.pos += 3;
|
|
1386
|
+
this.current = this.newToken(Token.NE_STRICT, [this.pos, (this.pos += 3)]);
|
|
1437
1387
|
}
|
|
1438
1388
|
else {
|
|
1439
|
-
this.current = this.newToken(Token.NE);
|
|
1440
|
-
this.pos += 2;
|
|
1389
|
+
this.current = this.newToken(Token.NE, [this.pos, (this.pos += 2)]);
|
|
1441
1390
|
}
|
|
1442
1391
|
}
|
|
1443
1392
|
else {
|
|
1444
|
-
this.current = this.newToken(Token.NOT);
|
|
1445
|
-
this.pos++;
|
|
1393
|
+
this.current = this.newToken(Token.NOT, [this.pos, (this.pos += 1)]);
|
|
1446
1394
|
}
|
|
1447
1395
|
return true;
|
|
1448
1396
|
case '.':
|
|
1449
1397
|
if (/\.\.\./.test(this.expression.substring(this.pos, this.pos + 3))) {
|
|
1450
|
-
this.current = this.newToken(Token.ELLIPSIS);
|
|
1451
|
-
this.pos += 3;
|
|
1398
|
+
this.current = this.newToken(Token.ELLIPSIS, [this.pos, (this.pos += 3)]);
|
|
1452
1399
|
return true;
|
|
1453
1400
|
}
|
|
1454
1401
|
else {
|
|
1455
|
-
this.current = this.newToken(Token.PERIOD);
|
|
1456
|
-
this.pos++;
|
|
1402
|
+
this.current = this.newToken(Token.PERIOD, [this.pos, (this.pos += 1)]);
|
|
1457
1403
|
}
|
|
1458
1404
|
return true;
|
|
1459
1405
|
// no break
|
|
1460
1406
|
case ':':
|
|
1461
1407
|
if (this.expression.charAt(this.pos + 1) === ':') {
|
|
1462
|
-
this.current = this.newToken(Token.QUESTION_BIND);
|
|
1463
|
-
this.pos += 2;
|
|
1408
|
+
this.current = this.newToken(Token.QUESTION_BIND, [this.pos, (this.pos += 2)]);
|
|
1464
1409
|
}
|
|
1465
1410
|
else {
|
|
1466
|
-
this.current = this.newToken(Token.COLON);
|
|
1467
|
-
this.pos++;
|
|
1411
|
+
this.current = this.newToken(Token.COLON, [this.pos, (this.pos += 1)]);
|
|
1468
1412
|
}
|
|
1469
1413
|
return true;
|
|
1470
1414
|
case '~':
|
|
1471
|
-
this.current = this.newToken(Token.BIT_NOT);
|
|
1472
|
-
this.pos++;
|
|
1415
|
+
this.current = this.newToken(Token.BIT_NOT, [this.pos, (this.pos += 1)]);
|
|
1473
1416
|
return true;
|
|
1474
1417
|
case 'a':
|
|
1475
1418
|
if (/async\s/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1476
|
-
|
|
1477
|
-
this.
|
|
1419
|
+
const range = [this.pos, (this.pos += 5)];
|
|
1420
|
+
this.current = this.newToken(Token.ASYNC, range, new Identifier('async', range));
|
|
1478
1421
|
return true;
|
|
1479
1422
|
}
|
|
1480
1423
|
if (/await\s/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1481
|
-
|
|
1482
|
-
this.
|
|
1424
|
+
const range = [this.pos, (this.pos += 5)];
|
|
1425
|
+
this.current = this.newToken(Token.AWAIT, range, new Identifier('await', range));
|
|
1483
1426
|
return true;
|
|
1484
1427
|
}
|
|
1485
1428
|
return false;
|
|
1486
1429
|
case 'i': // in, instanceof
|
|
1487
1430
|
if (this.expression.charAt(this.pos + 1) === 'n') {
|
|
1488
1431
|
if (/instanceof\s/.test(this.expression.substring(this.pos, this.pos + 11))) {
|
|
1489
|
-
this.current = this.newToken(Token.INSTANCEOF);
|
|
1490
|
-
this.pos += 11;
|
|
1432
|
+
this.current = this.newToken(Token.INSTANCEOF, [this.pos, (this.pos += 11)]);
|
|
1491
1433
|
return true;
|
|
1492
1434
|
}
|
|
1493
|
-
else if (
|
|
1494
|
-
this.current = this.newToken(Token.IN);
|
|
1495
|
-
this.pos += 3;
|
|
1435
|
+
else if (/n\s/.test(this.expression.charAt(this.pos + 2))) {
|
|
1436
|
+
this.current = this.newToken(Token.IN, [this.pos, (this.pos += 3)]);
|
|
1496
1437
|
return true;
|
|
1497
1438
|
}
|
|
1498
1439
|
}
|
|
1499
1440
|
return false;
|
|
1500
1441
|
case 't': // typeof
|
|
1501
1442
|
if (/typeof\s/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1502
|
-
this.current = this.newToken(Token.TYPEOF);
|
|
1503
|
-
this.pos += 7;
|
|
1443
|
+
this.current = this.newToken(Token.TYPEOF, [this.pos, (this.pos += 7)]);
|
|
1504
1444
|
return true;
|
|
1505
1445
|
}
|
|
1506
1446
|
return false;
|
|
1507
1447
|
case 'v': // void
|
|
1508
1448
|
if (/void\s/.test(this.expression.substring(this.pos, this.pos + 5))) {
|
|
1509
|
-
this.current = this.newToken(Token.VOID);
|
|
1510
|
-
this.pos += 5;
|
|
1449
|
+
this.current = this.newToken(Token.VOID, [this.pos, (this.pos += 5)]);
|
|
1511
1450
|
return true;
|
|
1512
1451
|
}
|
|
1513
1452
|
return false;
|
|
1514
1453
|
case 'd': // delete
|
|
1515
1454
|
if (/delete\s/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1516
|
-
this.current = this.newToken(Token.DELETE);
|
|
1517
|
-
this.pos += 7;
|
|
1518
|
-
return true;
|
|
1519
|
-
}
|
|
1520
|
-
return false;
|
|
1521
|
-
case 'n': // new
|
|
1522
|
-
if (/new\s/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1523
|
-
this.current = this.newToken(Token.NEW);
|
|
1524
|
-
this.pos += 4;
|
|
1455
|
+
this.current = this.newToken(Token.DELETE, [this.pos, (this.pos += 7)]);
|
|
1525
1456
|
return true;
|
|
1526
1457
|
}
|
|
1527
1458
|
return false;
|
|
1528
1459
|
case 'n': // new
|
|
1529
1460
|
if (/new\s/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1530
|
-
this.current = this.newToken(Token.NEW);
|
|
1531
|
-
this.pos += 4;
|
|
1461
|
+
this.current = this.newToken(Token.NEW, [this.pos, (this.pos += 4)]);
|
|
1532
1462
|
return true;
|
|
1533
1463
|
}
|
|
1534
1464
|
return false;
|
|
@@ -1548,169 +1478,149 @@ export class TokenStreamImpl extends TokenStream {
|
|
|
1548
1478
|
// return false;
|
|
1549
1479
|
case 'b':
|
|
1550
1480
|
if (/break\s?;?/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1551
|
-
this.current = this.newToken(Token.BREAK);
|
|
1552
|
-
this.pos += 5;
|
|
1481
|
+
this.current = this.newToken(Token.BREAK, [this.pos, (this.pos += 5)]);
|
|
1553
1482
|
return true;
|
|
1554
1483
|
}
|
|
1555
1484
|
return false;
|
|
1556
1485
|
case 'c':
|
|
1557
1486
|
if (/case[\s~!+-\/\('"`]/.test(this.expression.substring(this.pos, this.pos + 5))) {
|
|
1558
|
-
this.current = this.newToken(Token.CASE);
|
|
1559
|
-
this.pos += 4;
|
|
1487
|
+
this.current = this.newToken(Token.CASE, [this.pos, (this.pos += 4)]);
|
|
1560
1488
|
return true;
|
|
1561
1489
|
}
|
|
1562
1490
|
else if (/const\s/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1563
|
-
this.current = this.newToken(Token.CONST);
|
|
1564
|
-
this.pos += 6;
|
|
1491
|
+
this.current = this.newToken(Token.CONST, [this.pos, (this.pos += 6)]);
|
|
1565
1492
|
return true;
|
|
1566
1493
|
}
|
|
1567
1494
|
else if (/catch[\s\{\(]/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1568
|
-
this.current = this.newToken(Token.CATCH);
|
|
1569
|
-
this.pos += 5;
|
|
1495
|
+
this.current = this.newToken(Token.CATCH, [this.pos, (this.pos += 5)]);
|
|
1570
1496
|
return true;
|
|
1571
1497
|
}
|
|
1572
1498
|
else if (/class\s/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1573
|
-
this.current = this.newToken(Token.CLASS);
|
|
1574
|
-
this.pos += 6;
|
|
1499
|
+
this.current = this.newToken(Token.CLASS, [this.pos, (this.pos += 6)]);
|
|
1575
1500
|
return true;
|
|
1576
1501
|
}
|
|
1577
1502
|
else if (/continue[\s;]/.test(this.expression.substring(this.pos, this.pos + 9))) {
|
|
1578
|
-
this.current = this.newToken(Token.CONTINUE);
|
|
1579
|
-
this.pos += 8;
|
|
1503
|
+
this.current = this.newToken(Token.CONTINUE, [this.pos, (this.pos += 8)]);
|
|
1580
1504
|
return true;
|
|
1581
1505
|
}
|
|
1582
1506
|
return false;
|
|
1583
1507
|
case 'd':
|
|
1584
1508
|
if (/do[\s|\{]/.test(this.expression.substring(this.pos, this.pos + 3))) {
|
|
1585
|
-
this.current = this.newToken(Token.DO);
|
|
1586
|
-
this.pos += 2;
|
|
1509
|
+
this.current = this.newToken(Token.DO, [this.pos, (this.pos += 2)]);
|
|
1587
1510
|
return true;
|
|
1588
1511
|
}
|
|
1589
1512
|
return false;
|
|
1590
1513
|
case 'e':
|
|
1591
1514
|
if (/else[\s|\{]/.test(this.expression.substring(this.pos, this.pos + 5))) {
|
|
1592
|
-
this.current = this.newToken(Token.ELSE);
|
|
1593
|
-
this.pos += 4;
|
|
1515
|
+
this.current = this.newToken(Token.ELSE, [this.pos, (this.pos += 4)]);
|
|
1594
1516
|
return true;
|
|
1595
1517
|
}
|
|
1596
1518
|
if (/export\s/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1597
|
-
this.current = this.newToken(Token.EXPORT);
|
|
1598
|
-
this.pos += 7;
|
|
1519
|
+
this.current = this.newToken(Token.EXPORT, [this.pos, (this.pos += 7)]);
|
|
1599
1520
|
return true;
|
|
1600
1521
|
}
|
|
1601
1522
|
if (/extends\s/.test(this.expression.substring(this.pos, this.pos + 8))) {
|
|
1602
|
-
this.current = this.newToken(Token.EXTENDS);
|
|
1603
|
-
this.pos += 8;
|
|
1523
|
+
this.current = this.newToken(Token.EXTENDS, [this.pos, (this.pos += 8)]);
|
|
1604
1524
|
return true;
|
|
1605
1525
|
}
|
|
1606
1526
|
return false;
|
|
1607
1527
|
case 'g':
|
|
1608
1528
|
if (/get\s/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1609
|
-
|
|
1610
|
-
this.
|
|
1529
|
+
const range = [this.pos, (this.pos += 4)];
|
|
1530
|
+
this.current = this.newToken(Token.GET, range, new Identifier('get', range));
|
|
1611
1531
|
return true;
|
|
1612
1532
|
}
|
|
1613
1533
|
return false;
|
|
1614
1534
|
case 'f':
|
|
1615
1535
|
if (/for[\s\(]/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1616
|
-
this.current = this.newToken(Token.FOR);
|
|
1617
|
-
this.pos += 3;
|
|
1536
|
+
this.current = this.newToken(Token.FOR, [this.pos, (this.pos += 3)]);
|
|
1618
1537
|
return true;
|
|
1619
1538
|
}
|
|
1620
1539
|
if (/finally[\s\{]/.test(this.expression.substring(this.pos, this.pos + 8))) {
|
|
1621
|
-
this.current = this.newToken(Token.FINALLY);
|
|
1622
|
-
this.pos += 7;
|
|
1540
|
+
this.current = this.newToken(Token.FINALLY, [this.pos, (this.pos += 7)]);
|
|
1623
1541
|
return true;
|
|
1624
1542
|
}
|
|
1625
1543
|
if (/function[\s\*\(]/.test(this.expression.substring(this.pos, this.pos + 9))) {
|
|
1626
|
-
this.current = this.newToken(Token.FUNCTION);
|
|
1627
|
-
this.pos += 8;
|
|
1544
|
+
this.current = this.newToken(Token.FUNCTION, [this.pos, (this.pos += 8)]);
|
|
1628
1545
|
return true;
|
|
1629
1546
|
}
|
|
1630
1547
|
return false;
|
|
1631
1548
|
case 'i':
|
|
1632
1549
|
if (/if[\s|\(]/.test(this.expression.substring(this.pos, this.pos + 3))) {
|
|
1633
|
-
this.current = this.newToken(Token.IF);
|
|
1634
|
-
this.pos += 2;
|
|
1550
|
+
this.current = this.newToken(Token.IF, [this.pos, (this.pos += 2)]);
|
|
1635
1551
|
return true;
|
|
1636
1552
|
}
|
|
1637
1553
|
else if (/in\s/.test(this.expression.substring(this.pos, this.pos + 3))) {
|
|
1638
|
-
this.current = this.newToken(Token.IN);
|
|
1639
|
-
this.pos += 3;
|
|
1554
|
+
this.current = this.newToken(Token.IN, [this.pos, (this.pos += 3)]);
|
|
1640
1555
|
return true;
|
|
1641
1556
|
}
|
|
1642
1557
|
else if (/import\s/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1643
|
-
this.current = this.newToken(Token.IMPORT);
|
|
1644
|
-
this.pos += 7;
|
|
1558
|
+
this.current = this.newToken(Token.IMPORT, [this.pos, (this.pos += 7)]);
|
|
1645
1559
|
return true;
|
|
1646
1560
|
}
|
|
1647
1561
|
return false;
|
|
1648
1562
|
case 'l':
|
|
1649
1563
|
if (/let\s/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1650
|
-
|
|
1651
|
-
this.
|
|
1564
|
+
const range = [this.pos, (this.pos += 4)];
|
|
1565
|
+
this.current = this.newToken(Token.LET, range, new Identifier('let', range));
|
|
1652
1566
|
return true;
|
|
1653
1567
|
}
|
|
1654
1568
|
return false;
|
|
1655
1569
|
case 't':
|
|
1656
1570
|
if (/try[\s\{]/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1657
|
-
this.current = this.newToken(Token.TRY);
|
|
1658
|
-
this.pos += 3;
|
|
1571
|
+
this.current = this.newToken(Token.TRY, [this.pos, (this.pos += 3)]);
|
|
1659
1572
|
return true;
|
|
1660
1573
|
}
|
|
1661
1574
|
if (/throw\s/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1662
|
-
this.current = this.newToken(Token.THROW);
|
|
1663
|
-
this.pos += 6;
|
|
1575
|
+
this.current = this.newToken(Token.THROW, [this.pos, (this.pos += 6)]);
|
|
1664
1576
|
return true;
|
|
1665
1577
|
}
|
|
1666
1578
|
return false;
|
|
1667
1579
|
case 'r':
|
|
1668
1580
|
if (/return[\s~!+-\/\('"`]/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1669
|
-
this.current = this.newToken(Token.RETURN);
|
|
1670
|
-
this.pos += 6;
|
|
1581
|
+
this.current = this.newToken(Token.RETURN, [this.pos, (this.pos += 6)]);
|
|
1671
1582
|
return true;
|
|
1672
1583
|
}
|
|
1673
1584
|
return false;
|
|
1674
1585
|
// case 'of':
|
|
1675
1586
|
// if (/of\s/.test(this.expression.substring(this.pos, this.pos + 3))) {
|
|
1676
|
-
// this.current = this.newToken(Token.OF);
|
|
1677
|
-
// this.pos += 3;
|
|
1587
|
+
// this.current = this.newToken(Token.OF, [this.pos, (this.pos += 3)]);
|
|
1678
1588
|
// return true;
|
|
1679
1589
|
// }
|
|
1680
1590
|
// return false;
|
|
1681
1591
|
case 's':
|
|
1682
1592
|
if (/switch(\s|\()/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1683
|
-
this.current = this.newToken(Token.SWITCH);
|
|
1684
|
-
this.pos += 6;
|
|
1593
|
+
this.current = this.newToken(Token.SWITCH, [this.pos, (this.pos += 6)]);
|
|
1685
1594
|
return true;
|
|
1686
1595
|
}
|
|
1687
1596
|
if (/static\s/.test(this.expression.substring(this.pos, this.pos + 7))) {
|
|
1688
|
-
this.current = this.newToken(Token.STATIC);
|
|
1689
|
-
this.pos += 7;
|
|
1597
|
+
this.current = this.newToken(Token.STATIC, [this.pos, (this.pos += 7)]);
|
|
1690
1598
|
return true;
|
|
1691
1599
|
}
|
|
1692
1600
|
if (/set\s/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1693
|
-
|
|
1694
|
-
this.
|
|
1601
|
+
const range = [this.pos, (this.pos += 4)];
|
|
1602
|
+
this.current = this.newToken(Token.SET, range, new Identifier('set', range));
|
|
1695
1603
|
return true;
|
|
1696
1604
|
}
|
|
1697
1605
|
if (/super[\.\(]?/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1698
|
-
|
|
1699
|
-
this.
|
|
1606
|
+
const range = [this.pos, (this.pos += 5)];
|
|
1607
|
+
this.current = this.newToken(Token.SUPER, range, new Super(range));
|
|
1700
1608
|
return true;
|
|
1701
1609
|
}
|
|
1702
1610
|
return false;
|
|
1703
1611
|
case 'w':
|
|
1704
1612
|
if (/while(\s|\()/.test(this.expression.substring(this.pos, this.pos + 6))) {
|
|
1705
|
-
this.current = this.newToken(Token.WHILE);
|
|
1706
|
-
|
|
1613
|
+
this.current = this.newToken(Token.WHILE, [this.pos, (this.pos += 5)]);
|
|
1614
|
+
return true;
|
|
1615
|
+
}
|
|
1616
|
+
else if (/with(\s|\()/.test(this.expression.substring(this.pos, this.pos + 5))) {
|
|
1617
|
+
this.current = this.newToken(Token.WITH, [this.pos, (this.pos += 4)]);
|
|
1707
1618
|
return true;
|
|
1708
1619
|
}
|
|
1709
1620
|
return false;
|
|
1710
1621
|
case 'v':
|
|
1711
1622
|
if (/var\s/.test(this.expression.substring(this.pos, this.pos + 4))) {
|
|
1712
|
-
this.current = this.newToken(Token.VAR);
|
|
1713
|
-
this.pos += 4;
|
|
1623
|
+
this.current = this.newToken(Token.VAR, [this.pos, (this.pos += 4)]);
|
|
1714
1624
|
return true;
|
|
1715
1625
|
}
|
|
1716
1626
|
return false;
|