@@ -1052,13 +1052,15 @@ export class Tokenizer extends DiagnosticEmitter {
1052
1052
1053
1053
readIdentifier ( ) : string {
1054
1054
var text = this . source . text ;
1055
- var start = this . pos ;
1056
1055
var end = this . end ;
1056
+ var pos = this . pos ;
1057
+ var start = pos ;
1057
1058
while (
1058
- ++ this . pos < end &&
1059
- isIdentifierPart ( text . charCodeAt ( this . pos ) )
1059
+ ++ pos < end &&
1060
+ isIdentifierPart ( text . charCodeAt ( pos ) )
1060
1061
) ;
1061
- return text . substring ( start , this . pos ) ;
1062
+ this . pos = pos ;
1063
+ return text . substring ( start , pos ) ;
1062
1064
}
1063
1065
1064
1066
readString ( ) : string {
@@ -1362,6 +1364,11 @@ export class Tokenizer extends DiagnosticEmitter {
1362
1364
: DiagnosticCode . Multiple_consecutive_numeric_separators_are_not_permitted ,
1363
1365
this . range ( pos )
1364
1366
) ;
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
+ ) ;
1365
1372
}
1366
1373
sepEnd = pos + 1 ;
1367
1374
} else {
@@ -1497,9 +1504,7 @@ export class Tokenizer extends DiagnosticEmitter {
1497
1504
var text = this . source . text ;
1498
1505
var end = this . end ;
1499
1506
var start = this . pos ;
1500
- var sepCount = 0 ;
1501
-
1502
- sepCount += this . readDecimalFloatPartial ( false ) ;
1507
+ var sepCount = this . readDecimalFloatPartial ( false ) ;
1503
1508
if ( this . pos < end && text . charCodeAt ( this . pos ) == CharCode . DOT ) {
1504
1509
++ this . pos ;
1505
1510
sepCount += this . readDecimalFloatPartial ( ) ;
@@ -1518,7 +1523,7 @@ export class Tokenizer extends DiagnosticEmitter {
1518
1523
}
1519
1524
}
1520
1525
let result = text . substring ( start , this . pos ) ;
1521
- if ( sepCount > 0 ) result = result . replaceAll ( "_" , "" ) ;
1526
+ if ( sepCount ) result = result . replaceAll ( "_" , "" ) ;
1522
1527
return parseFloat ( result ) ;
1523
1528
}
1524
1529
@@ -1553,7 +1558,6 @@ export class Tokenizer extends DiagnosticEmitter {
1553
1558
} else if ( ! isDecimalDigit ( c ) ) {
1554
1559
break ;
1555
1560
}
1556
-
1557
1561
++ pos ;
1558
1562
}
1559
1563
0 commit comments