@@ -12,8 +12,8 @@ import { ScanError, SyntaxKind, JSONScanner } from '../main';
12
12
*/
13
13
export function createScanner ( text : string , ignoreTrivia : boolean = false ) : JSONScanner {
14
14
15
+ const len = text . length ;
15
16
let pos = 0 ,
16
- len = text . length ,
17
17
value : string = '' ,
18
18
tokenOffset = 0 ,
19
19
token : SyntaxKind = SyntaxKind . Unknown ,
@@ -109,7 +109,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
109
109
scanError = ScanError . UnexpectedEndOfString ;
110
110
break ;
111
111
}
112
- let ch = text . charCodeAt ( pos ) ;
112
+ const ch = text . charCodeAt ( pos ) ;
113
113
if ( ch === CharacterCodes . doubleQuote ) {
114
114
result += text . substring ( start , pos ) ;
115
115
pos ++ ;
@@ -122,8 +122,8 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
122
122
scanError = ScanError . UnexpectedEndOfString ;
123
123
break ;
124
124
}
125
- ch = text . charCodeAt ( pos ++ ) ;
126
- switch ( ch ) {
125
+ const ch2 = text . charCodeAt ( pos ++ ) ;
126
+ switch ( ch2 ) {
127
127
case CharacterCodes . doubleQuote :
128
128
result += '\"' ;
129
129
break ;
@@ -149,9 +149,9 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
149
149
result += '\t' ;
150
150
break ;
151
151
case CharacterCodes . u :
152
- let ch = scanHexDigits ( 4 , true ) ;
153
- if ( ch >= 0 ) {
154
- result += String . fromCharCode ( ch ) ;
152
+ const ch3 = scanHexDigits ( 4 , true ) ;
153
+ if ( ch3 >= 0 ) {
154
+ result += String . fromCharCode ( ch3 ) ;
155
155
} else {
156
156
scanError = ScanError . InvalidUnicode ;
157
157
}
@@ -246,7 +246,7 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
246
246
247
247
// comments
248
248
case CharacterCodes . slash :
249
- let start = pos - 1 ;
249
+ const start = pos - 1 ;
250
250
// Single-line comment
251
251
if ( text . charCodeAt ( pos + 1 ) === CharacterCodes . slash ) {
252
252
pos += 2 ;
@@ -266,10 +266,10 @@ export function createScanner(text: string, ignoreTrivia: boolean = false): JSON
266
266
if ( text . charCodeAt ( pos + 1 ) === CharacterCodes . asterisk ) {
267
267
pos += 2 ;
268
268
269
- let safeLength = len - 1 ; // For lookahead.
269
+ const safeLength = len - 1 ; // For lookahead.
270
270
let commentClosed = false ;
271
271
while ( pos < safeLength ) {
272
- let ch = text . charCodeAt ( pos ) ;
272
+ const ch = text . charCodeAt ( pos ) ;
273
273
274
274
if ( ch === CharacterCodes . asterisk && text . charCodeAt ( pos + 1 ) === CharacterCodes . slash ) {
275
275
pos += 2 ;
0 commit comments