-
-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add html parser crate #2163
Conversation
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
CodSpeed Performance ReportMerging #2163 will improve performances by 6.23%Comparing Summary
Benchmarks breakdown
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Just some minor comments.
/// | ||
/// ## Safety | ||
/// Must be called at a valid UT8 char boundary | ||
fn current_char_unchecked(&self) -> char { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is in the generic lexer now.
} | ||
|
||
impl<'src> HtmlLexer<'src> { | ||
/// Make a new lexer from a str, this is safe because strs are valid utf8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The safety comment seems a bit out of place, since there’s nothing unsafe here.
|
||
impl<'src> HtmlLexer<'src> { | ||
fn consume_token(&mut self, current: u8) -> HtmlSyntaxKind { | ||
// The speed difference comes from the difference in table size, a 2kb table is easily fit into cpu cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What speed difference? This comment lacks context.
crates/biome_html_parser/src/lib.rs
Outdated
use biome_parser::diagnostic::ParseDiagnostic; | ||
use biome_rowan::{AstNode, NodeCache}; | ||
|
||
/// Parses the provided string as CSS program using the provided node cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is out of date.
9674e95
to
6d1566d
Compare
Summary
This PR just adds a new
biome_html_parser
crate. The crate doesn't have any logic yet, just some plumbing the start the infrastructure.I took the opportunity to do some further refactor around the lexer.
Test Plan
Currect CI should pass