Skip to content

Commit

Permalink
fix(lexer): fixed WS skipping issue
Browse files Browse the repository at this point in the history
  • Loading branch information
KFlash committed Jun 3, 2019
1 parent b5eb3ca commit bf27362
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/lexer/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export function isExoticECMAScriptWhitespace(code: number): boolean {
code === Chars.Ogham ||
(code >= Chars.EnQuad && code <= Chars.ZeroWidthSpace) ||
code === Chars.NarrowNoBreakSpace ||
code === Chars.ZeroWidthJoiner ||
code === Chars.ZeroWidthNonJoiner ||
code === Chars.MathematicalSpace ||
code === Chars.IdeographicSpace ||
code === Chars.ByteOrderMark
Expand Down
10 changes: 10 additions & 0 deletions test/lexer/whitespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,16 @@ describe('Lexer - Whitespace', () => {
column: 20
});

pass('skips exotic whitespace', {
source: '\u200D\u200C',
hasNext: false,
newLine: false,
value: '',
line: 1,
index: 2,
column: 2
});

pass('skips single line comment with identifier and newline', {
source: '// foo\n',
hasNext: false,
Expand Down

0 comments on commit bf27362

Please sign in to comment.