134
return src;
135
}
137
>
export const enum UnicodeHighlighterReasonKind {
138
>
Ambiguous, Invisible, NonBasicAscii
139
>
}
140
>
141
>
export type UnicodeHighlighterReason = {
142
>
kind: UnicodeHighlighterReasonKind.Ambiguous;
143
>
confusableWith: string;
144
>
notAmbiguousInLocales: string[];
145
>
} | {
146
>
kind: UnicodeHighlighterReasonKind.Invisible;
147
>
} | {
148
>
kind: UnicodeHighlighterReasonKind.NonBasicAscii;
149
>
};
150
>
151
>
class CodePointHighlighter {
152
>
private readonly allowedCodePoints: Set<number>;
153
>
public readonly ambiguousCharacters: strings.AmbiguousCharacters;
154
>
constructor(private readonly options: UnicodeHighlighterOptions) {
155
this.allowedCodePoints = new Set(options.allowedCodePoints);
156
this.ambiguousCharacters = strings.AmbiguousCharacters.getInstance(new Set(options.allowedLocales));
157
}
159
>
public getCandidateCodePoints(): Set<number> | 'allNonBasicAscii' {
160
if (this.options.nonBasicASCII) {
161
return 'allNonBasicAscii';