html5gum
logos
html5gum | logos | |
---|---|---|
3 | 15 | |
146 | 2,654 | |
- | - | |
6.8 | 8.3 | |
about 1 month ago | 15 days ago | |
Rust | Rust | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
html5gum
-
Ask HN: A fast, Rust HTML parser that works?
So I'm doing some web scraping in Rust, and so I will need to parse HTML. [scraper](https://docs.rs/scraper/latest/scraper/) (which uses [html5ever](https://github.com/servo/html5ever)) is doing fine except that it's the bottleneck of my application.
So I need a faster parser. I've tried [tl](https://docs.rs/tl/latest/tl/) which would've been perfect except that it doesn't actually work on the HTML I have. When I try to `query_selector` the elements I need, it returns nothing.
[Kuchiki](https://docs.rs/kuchiki/latest/kuchiki/) is abandonded.
I couldn't figure out how to get [lol-html](https://github.com/cloudflare/lol-html) to work for me (it's designed for re-writing HTML, whatever that means). It doesn't seem to have an API to extract the inner text of an element.
[html5gum](https://github.com/untitaker/html5gum) seems to be just an HTML tokenizer, or otherwise just too low-level. I have not yet tried [quick-xml](https://github.com/tafia/quick-xml/) but judging from the README, it's pretty low-level too. I mean, if these are the only options left then I will try them. Otherwise, I would love to use a parser that's faster but as ergonomic as `scraper` or `tl`.
At this point, I would be happy with an Lxml bridge/port of some sort. I don't need to mutate HTML, just parse and read data from it.
- html5gum: A WHATWG-compliant HTML5 tokenizer and tag soup parser
logos
-
Beating the fastest lexer generator in Rust
This is mighty impressive! I've been trying to get some motivation for the mythical rewrite of the proc macro in Logos, and this might just do it for me :D. I'll have a proper look later today and see if any of your findings have something that can be generalized. Also really surprised to see aarch64 doing better than x86_64 since the latter is what I've been optimizing for!
-
Letlang — Roadblocks and how to overcome them - My programming language targeting Rust
Rust is a very nice langage for implementing compilers, and has a nice ecosystem for it (logos, rust-peg, lalrpop, astmaker -- this one is mine --, etc...).
-
loxcraft: a compiler, language server, and online playground for the Lox programming language
rust-langdev has a lot of libraries for building compilers in Rust. Perhaps you could use these to make your implementation easier, and revisit it later if you want to build things from scratch. I'd suggest logos for lexing, LALRPOP / chumsky for parsing, and rust-gc for garbage collection.
-
Logos 0.13 released
Thanks! For compile times you might find the CLI version that Andrew Hickman contributed useful, it's undocumented still mostly I fear but shouldn't be hard to use, see original PR: https://github.com/maciejhirsz/logos/pull/248
-
Should I revisit my choice to use nom?
For my lexer generation purposes, I tend to use https://github.com/maciejhirsz/logos, as it not only generates an easy to use lazy lexer, but the result is also exceptionally fast!
-
Position in rowan
Hi, I'm using rowan to create a parser and want to print more useful error messages with position in the text/file. I'm using logos (https://crates.io/crates/logos) to generate the lexer. Is there a way to get the starting and ending positions of a SyntaxToken? If not I thought of adding my own wrapper struct around the SyntaxTokens.
-
Hey Rustaceans! Got a question? Ask here (6/2023)!
Is there a way for a lexer created with the logos crate (https://crates.io/crates/logos) to get the starting and ending positions for the tokens?
-
Best resources for a rust interpreter?
I wouldn't recommend Logos at this point. This recent bug is quite nasty and seems easy to hit, and the maintainer is unresponsive. Last commit was half a year ago. At this point I consider Logos abandonware, though it would be great if its development continued, or if it were forked.
-
Alternatives for "blazingly fast"
logos uses "ridiculously fast".
- Compiler in Rust
What are some alternatives?
sax-wasm - The first streamable, fixed memory XML, HTML, and JSX parser for WebAssembly.
foundation.rust-lang.org - website for Rust Foundation
parse5 - HTML parsing/serialization toolset for Node.js. WHATWG HTML Living Standard (aka HTML5)-compliant.
schema-registry - Confluent Schema Registry for Kafka
germ - 🦠 The Definitive Gemini Protocol Toolkit
book - The Rust Programming Language
html5ever - High-performance browser-grade HTML5 parser
lexgen - A fully-featured lexer generator, implemented as a proc macro
quick-xml - Rust high performance xml reader and writer
sonyflake-rs - 🃏 A distributed unique ID generator inspired by Twitter's Snowflake.
Fuzi - A fast & lightweight XML & HTML parser in Swift with XPath & CSS support
hush - Hush is a unix shell based on the Lua programming language