@@ -1052,13 +1052,15 @@ export class Tokenizer extends DiagnosticEmitter {
10521052
10531053 readIdentifier ( ) : string {
10541054 var text = this . source . text ;
1055- var start = this . pos ;
10561055 var end = this . end ;
1056+ var pos = this . pos ;
1057+ var start = pos ;
10571058 while (
1058- ++ this . pos < end &&
1059- isIdentifierPart ( text . charCodeAt ( this . pos ) )
1059+ ++ pos < end &&
1060+ isIdentifierPart ( text . charCodeAt ( pos ) )
10601061 ) ;
1061- return text . substring ( start , this . pos ) ;
1062+ this . pos = pos ;
1063+ return text . substring ( start , pos ) ;
10621064 }
10631065
10641066 readString ( ) : string {
@@ -1362,6 +1364,11 @@ export class Tokenizer extends DiagnosticEmitter {
13621364 : DiagnosticCode . Multiple_consecutive_numeric_separators_are_not_permitted ,
13631365 this . range ( pos )
13641366 ) ;
1367+ } else if ( pos - 1 == start && text . charCodeAt ( pos - 1 ) == CharCode . _0 ) {
1368+ this . error (
1369+ DiagnosticCode . Numeric_separators_are_not_allowed_here ,
1370+ this . range ( pos )
1371+ ) ;
13651372 }
13661373 sepEnd = pos + 1 ;
13671374 } else {
@@ -1497,9 +1504,7 @@ export class Tokenizer extends DiagnosticEmitter {
14971504 var text = this . source . text ;
14981505 var end = this . end ;
14991506 var start = this . pos ;
1500- var sepCount = 0 ;
1501-
1502- sepCount += this . readDecimalFloatPartial ( false ) ;
1507+ var sepCount = this . readDecimalFloatPartial ( false ) ;
15031508 if ( this . pos < end && text . charCodeAt ( this . pos ) == CharCode . DOT ) {
15041509 ++ this . pos ;
15051510 sepCount += this . readDecimalFloatPartial ( ) ;
@@ -1518,7 +1523,7 @@ export class Tokenizer extends DiagnosticEmitter {
15181523 }
15191524 }
15201525 let result = text . substring ( start , this . pos ) ;
1521- if ( sepCount > 0 ) result = result . replaceAll ( "_" , "" ) ;
1526+ if ( sepCount ) result = result . replaceAll ( "_" , "" ) ;
15221527 return parseFloat ( result ) ;
15231528 }
15241529
@@ -1553,7 +1558,6 @@ export class Tokenizer extends DiagnosticEmitter {
15531558 } else if ( ! isDecimalDigit ( c ) ) {
15541559 break ;
15551560 }
1556-
15571561 ++ pos ;
15581562 }
15591563
0 commit comments