Skip to content

Commit

Permalink
Rename None to IdentifierOrUnknown
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Jul 2, 2024
1 parent db10cae commit 3bdfe84
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/compiler/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,12 @@ const regExpFlagToFirstAvailableLanguageVersion = new Map<RegularExpressionFlags
]);

const enum TokenCategory {
None = 0,
IdentifierOrUnknown = 0,

/** Single-width tokens whose contents fit in the lower masked bits. */
/**
* Single-width tokens whose SyntaxKind value fits
* in the lower masked bits of the current value.
*/
SimpleToken = 1 << 8, // must come first
Whitespace = 1 << 9,
LineBreak = 1 << 10,
Expand All @@ -321,7 +324,7 @@ const enum TokenCategory {
const tokenCategoryLookup: TokenCategory[] = [];
const tokenCategoryLookupUncommon = new Map<CharacterCodes, TokenCategory>();
for (let i = 0; i < CharacterCodes.maxAsciiCharacter; i++) {
tokenCategoryLookup.push(TokenCategory.None);
tokenCategoryLookup.push(TokenCategory.IdentifierOrUnknown);
}

for (
Expand Down Expand Up @@ -2027,9 +2030,9 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean

const tokenCategory = ch < tokenCategoryLookup.length ?
tokenCategoryLookup[ch] :
tokenCategoryLookupUncommon.get(ch) ?? TokenCategory.None;
tokenCategoryLookupUncommon.get(ch) ?? TokenCategory.IdentifierOrUnknown;

if (tokenCategory === TokenCategory.None) {
if (tokenCategory === TokenCategory.IdentifierOrUnknown) {
const identifierKind = scanIdentifier(ch, languageVersion);
if (identifierKind) {
return token = identifierKind;
Expand Down

0 comments on commit 3bdfe84

Please sign in to comment.