Skip to content

Commit

Permalink
Fix Performance regression in Regular Tokens 0.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahar Soel committed Mar 20, 2017
1 parent 3274086 commit 52f3f1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scan/lexer_public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ export class Lexer {
// even though this pattern matched we must try a another longer alternative.
// this can be used to prioritize keywords over identifiers
longerAltIdx = currModePatternIdxToLongerAltIdx[i]
let longerAltPattern = currModePatterns[longerAltIdx]
if (longerAltIdx) {
if (longerAltIdx !== undefined) {
let longerAltPattern = currModePatterns[longerAltIdx]
if (hasCustomTokens) {
matchAlt = longerAltPattern.exec(text, matchedTokens, groups)
} else {
Expand Down Expand Up @@ -658,7 +658,7 @@ export class Lexer {
// even though this pattern matched we must try a another longer alternative.
// this can be used to prioritize keywords over identifiers
longerAltIdx = currModePatternIdxToLongerAltIdx[i]
if (longerAltIdx) {
if (longerAltIdx !== undefined) {
let longerPattern = currModePatterns[longerAltIdx]
if (hasCustomTokens &&
// slower check to optimize the less common case of custom patterns
Expand Down

0 comments on commit 52f3f1a

Please sign in to comment.