Replies: 3 comments 1 reply
-
I think we should encourage users to migrate to fast parser anyway, because the main difference is correctness of |
Beta Was this translation helpful? Give feedback.
-
I think we can currently add an |
Beta Was this translation helpful? Give feedback.
-
Closed as #10744 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Since #10399, there has been two sets of lexers and parsers in swc projects:
swc_ecma_lexer
for compatibility. There are also all common lexer and parser logic and traits.swc_ecma_parser
for performance. This is what we are still actively improving their performance.Sadly, it's hard to immediately remove the old-fashion lexer and parser:
swc_ecma_parser
is the exact equivalent ofswc_ecma_lexer
. It could be hard to prove becauseswc_ecma_parser
doesn't have strict token validation as we discussed in refactor(es/parser): Split parser into also-lex/parse-only #10399Note that there's only
fast-strip
crate in swc projects that depends on the old-fashion lexer and parser, but it has been proved possible and worth to migrate, see #10677.Motivation
fast-strip
benefit from our new performant lexer and parser.Design Details
Even if we are only considering the performance of projects in swc itself, due to the usage of the lexer in
fast-strip
, we have to make lexer api inswc_ecma_parser
public.Based on the idea above, I have come up with some options:
swc_ecma_parser
public forfast-strip
. But if we don't want to make it public to all downstream applications we can mark it with an internal feature and add documents as said in fix: change visibility of lexer::token exports from crate to public #10537 (comment)swc_ecma_parser
is an exact equivalent ofswc_ecma_lexer
, we may make it public to all and deprecate the old-fasion lexer and parser in the future.Beta Was this translation helpful? Give feedback.
All reactions