Skip to content

Commit

Permalink
fix: goldstein: add support of tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Apr 19, 2023
1 parent 6c08af1 commit bf330c5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ export const extendParser = (keywords) => {
};
};

const createParse = (parser) => (a) => parser.parse(a, {
ecmaVersion: 'latest',
sourceType: 'module',
locations: true,
});
const createParse = (parser) => (source) => {
const options = {
ecmaVersion: 'latest',
sourceType: 'module',
locations: true,
};

const result = parser.parse(source, options);
const tokens = Array.from(parser.tokenizer(source, options));

return {
...result,
tokens,
};
};

0 comments on commit bf330c5

Please sign in to comment.