@@ -203,7 +203,7 @@ export class AST {
203203 while ( ( token = this . _expect ( "==" , "!=" , "===" , "!==" ) ) ) {
204204 left = {
205205 _type : ASTType . _BinaryExpression ,
206- _operator : /** @type {Token } */ token . text ,
206+ _operator : /** @type {Token } */ token . _text ,
207207 _left : left ,
208208 _right : this . _relational ( ) ,
209209 } ;
@@ -224,7 +224,7 @@ export class AST {
224224 while ( ( token = this . _expect ( "<" , ">" , "<=" , ">=" ) ) ) {
225225 left = {
226226 _type : ASTType . _BinaryExpression ,
227- _operator : /** @type {Token } */ token . text ,
227+ _operator : /** @type {Token } */ token . _text ,
228228 _left : left ,
229229 _right : this . _additive ( ) ,
230230 } ;
@@ -245,7 +245,7 @@ export class AST {
245245 while ( ( token = this . _expect ( "+" , "-" ) ) ) {
246246 left = {
247247 _type : ASTType . _BinaryExpression ,
248- _operator : /** @type {Token } */ token . text ,
248+ _operator : /** @type {Token } */ token . _text ,
249249 _left : left ,
250250 _right : this . _multiplicative ( ) ,
251251 } ;
@@ -266,7 +266,7 @@ export class AST {
266266 while ( ( token = this . _expect ( "*" , "/" , "%" ) ) ) {
267267 left = {
268268 _type : ASTType . _BinaryExpression ,
269- _operator : token . text ,
269+ _operator : token . _text ,
270270 _left : left ,
271271 _right : this . _unary ( ) ,
272272 } ;
@@ -299,7 +299,7 @@ export class AST {
299299
300300 return {
301301 _type : ASTType . _UpdateExpression ,
302- _operator : /** @type {Token } */ token . text ,
302+ _operator : /** @type {Token } */ token . _text ,
303303 _prefix : true ,
304304 _argument : argument ,
305305 } ;
@@ -309,7 +309,7 @@ export class AST {
309309 if ( ( token = this . _expect ( "+" , "-" , "!" ) ) ) {
310310 return {
311311 _type : ASTType . _UnaryExpression ,
312- _operator : /** @type {Token } */ token . text ,
312+ _operator : /** @type {Token } */ token . _text ,
313313 _prefix : true ,
314314 _argument : this . _unary ( ) ,
315315 } ;
@@ -339,7 +339,7 @@ export class AST {
339339
340340 expr = {
341341 _type : ASTType . _UpdateExpression ,
342- _operator : /** @type {Token } */ token . text ,
342+ _operator : /** @type {Token } */ token . _text ,
343343 _prefix : false ,
344344 _argument : expr ,
345345 } ;
@@ -364,18 +364,18 @@ export class AST {
364364 primary = this . _arrayDeclaration ( ) ;
365365 } else if ( this . _expect ( "{" ) ) {
366366 primary = this . _object ( ) ;
367- } else if ( hasOwn ( this . _selfReferential , ( peekToken as Token ) . text ) ) {
367+ } else if ( hasOwn ( this . _selfReferential , ( peekToken as Token ) . _text ) ) {
368368 primary = cloneSelfReferentialNode (
369- this . _selfReferential [ this . _consume ( ) . text ] ,
369+ this . _selfReferential [ this . _consume ( ) . _text ] ,
370370 ) ;
371- } else if ( hasOwn ( literals , ( peekToken as Token ) . text ) ) {
371+ } else if ( hasOwn ( literals , ( peekToken as Token ) . _text ) ) {
372372 primary = {
373373 _type : ASTType . _Literal ,
374- _value : literals [ this . _consume ( ) . text as keyof typeof literals ] ,
374+ _value : literals [ this . _consume ( ) . _text as keyof typeof literals ] ,
375375 } ;
376- } else if ( ( peekToken as Token ) . identifier ) {
376+ } else if ( ( peekToken as Token ) . _identifier ) {
377377 primary = this . _identifier ( ) ;
378- } else if ( ( peekToken as Token ) . constant ) {
378+ } else if ( ( peekToken as Token ) . _constant ) {
379379 primary = this . _constant ( ) ;
380380 } else {
381381 this . _throwError ( "not a primary expression" , this . _peek ( ) as Token ) ;
@@ -384,22 +384,22 @@ export class AST {
384384 let next : Token | false ;
385385
386386 while ( ( next = this . _expect ( "(" , "[" , "." ) ) ) {
387- if ( next . text === "(" ) {
387+ if ( next . _text === "(" ) {
388388 primary = {
389389 _type : ASTType . _CallExpression ,
390390 _callee : primary ,
391391 _arguments : this . _parseArguments ( ) ,
392392 } ;
393393 this . _consume ( ")" ) ;
394- } else if ( next . text === "[" ) {
394+ } else if ( next . _text === "[" ) {
395395 primary = {
396396 _type : ASTType . _MemberExpression ,
397397 _object : primary ,
398398 _property : this . _assignment ( ) ,
399399 _computed : true ,
400400 } ;
401401 this . _consume ( "]" ) ;
402- } else if ( next . text === "." ) {
402+ } else if ( next . _text === "." ) {
403403 primary = {
404404 _type : ASTType . _MemberExpression ,
405405 _object : primary ,
@@ -443,7 +443,7 @@ export class AST {
443443 _parseArguments ( ) : ASTNode [ ] {
444444 const args : ASTNode [ ] = [ ] ;
445445
446- if ( this . _peekToken ( ) . text !== ")" ) {
446+ if ( this . _peekToken ( ) . _text !== ")" ) {
447447 do {
448448 args . push ( this . _filterChain ( ) ) ;
449449 } while ( this . _expect ( "," ) ) ;
@@ -459,11 +459,11 @@ export class AST {
459459 _identifier ( ) : ASTNode {
460460 const token = this . _consume ( ) ;
461461
462- if ( ! token . identifier ) {
462+ if ( ! token . _identifier ) {
463463 this . _throwError ( "is not a valid identifier" , token ) ;
464464 }
465465
466- return { _type : ASTType . _Identifier , _name : token . text } ;
466+ return { _type : ASTType . _Identifier , _name : token . _text } ;
467467 }
468468
469469 /**
@@ -472,7 +472,7 @@ export class AST {
472472 */
473473 _constant ( ) : ASTNode {
474474 // TODO check that it is a constant
475- return { _type : ASTType . _Literal , _value : this . _consume ( ) . value } ;
475+ return { _type : ASTType . _Literal , _value : this . _consume ( ) . _value } ;
476476 }
477477
478478 /**
@@ -482,7 +482,7 @@ export class AST {
482482 _arrayDeclaration ( ) : ASTNode {
483483 const elements : ASTNode [ ] = [ ] ;
484484
485- if ( this . _peekToken ( ) . text !== "]" ) {
485+ if ( this . _peekToken ( ) . _text !== "]" ) {
486486 do {
487487 if ( this . _peek ( "]" ) ) {
488488 // Support trailing commas per ES5.1.
@@ -505,7 +505,7 @@ export class AST {
505505
506506 let property : ObjectPropertyNode ;
507507
508- if ( this . _peekToken ( ) . text !== "}" ) {
508+ if ( this . _peekToken ( ) . _text !== "}" ) {
509509 do {
510510 if ( this . _peek ( "}" ) ) {
511511 // Support trailing commas per ES5.1.
@@ -520,12 +520,12 @@ export class AST {
520520 _computed : false ,
521521 } ;
522522
523- if ( nextToken . constant ) {
523+ if ( nextToken . _constant ) {
524524 property . _key = this . _constant ( ) ;
525525 property . _computed = false ;
526526 this . _consume ( ":" ) ;
527527 property . _value = this . _assignment ( ) ;
528- } else if ( nextToken . identifier ) {
528+ } else if ( nextToken . _identifier ) {
529529 property . _key = this . _identifier ( ) ;
530530 property . _computed = false ;
531531
@@ -562,11 +562,11 @@ export class AST {
562562 throw $parseMinErr (
563563 "syntax" ,
564564 "Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}]." ,
565- token . text ,
565+ token . _text ,
566566 msg ,
567- token . index + 1 ,
567+ token . _index + 1 ,
568568 this . _text ,
569- this . _text ?. substring ( token . index ) ,
569+ this . _text ?. substring ( token . _index ) ,
570570 ) ;
571571 }
572572
@@ -626,7 +626,7 @@ export class AST {
626626
627627 if ( ! j ) return token ;
628628
629- const txt = token . text ;
629+ const txt = token . _text ;
630630
631631 if ( expected . length === 1 ) return expected [ 0 ] === txt ? token : false ;
632632
0 commit comments