Skip to content

Commit

Permalink
feat: map whitespace parser too
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikossor committed Jul 16, 2022
1 parent de86ac9 commit 8e55ca7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parser/JavaScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { NodeType } from "../enums";
import { IParser } from "../Interfaces";

const betweenDoubleQuotes = between(string('"'));
const optionalWhitespace = optional(whitespace());
const optionalWhitespace = optional(whitespace()).map(state => [
NodeType.Whitespace,
state.result,
]);

const declarationKeyword = regex(/^var|let|const/);
const word = regex(/\w+/); // word
Expand Down

0 comments on commit 8e55ca7

Please sign in to comment.