This repository was archived by the owner on Jun 15, 2023. It is now read-only.
File tree 1 file changed +14
-21
lines changed 1 file changed +14
-21
lines changed Original file line number Diff line number Diff line change @@ -355,30 +355,23 @@ type identifierStyle =
355
355
| NormalIdent
356
356
357
357
let classifyIdentContent ?(allowUident =false ) txt =
358
- let len = String. length txt in
359
- let rec go i =
360
- if i == len then NormalIdent
361
- else
362
- let c = String. unsafe_get txt i in
363
- if i == 0 && not (
364
- (allowUident && (c > = 'A' && c < = 'Z' )) ||
365
- (c > = 'a' && c < = 'z' ) || c = '_' ) then
366
- ExoticIdent
367
- else if not (
368
- (c > = 'a' && c < = 'z' )
369
- || (c > = 'A' && c < = 'Z' )
370
- || c = '\' '
371
- || c = '_'
372
- || (c > = '0' && c < = '9' ))
373
- then
374
- ExoticIdent
375
- else
376
- go (i + 1 )
377
- in
378
358
if Token. isKeywordTxt txt then
379
359
ExoticIdent
380
360
else
381
- go 0
361
+ let len = String. length txt in
362
+ let rec loop i =
363
+ if i == len then NormalIdent
364
+ else if i == 0 then
365
+ match String. unsafe_get txt i with
366
+ | 'A' ..'Z' when allowUident -> loop (i + 1 )
367
+ | 'a' ..'z' | '_' -> loop (i + 1 )
368
+ | _ -> ExoticIdent
369
+ else
370
+ match String. unsafe_get txt i with
371
+ | 'A' ..'Z' | 'a' ..'z' | '0' ..'9' | '\' ' | '_' -> loop (i + 1 )
372
+ | _ -> ExoticIdent
373
+ in
374
+ loop 0
382
375
383
376
let printIdentLike ?allowUident txt =
384
377
match classifyIdentContent ?allowUident txt with
You can’t perform that action at this time.
0 commit comments