2 unstable releases
0.2.0 | Mar 26, 2022 |
---|---|
0.1.0 | Feb 27, 2022 |
#2 in #telecss
37 downloads per month
Used in 2 crates
43KB
1K
SLoC
Telecss (WIP)
CSS tokenizer, parser, transformer, written in Rust.
This project is mainly based on the following specs:
- CSS Syntax Module Level 3 document.
- Syntax and basic data types document.
- CSS Values and Units Module Level 3
- Selectors Level 4
Benchmark
Benchmarks on each commit: https://telecss.github.io/telecss/dev/bench/
This benchmark is based on parsing/tokenizing the crates/telecss/examples/normalizecss/normalize.css
file, and the time-consuming of parsing includes the time-consuming of tokenizing:
Pure Parsing Time
=Parsing Time
-Tokenizing Time
TODO
Current Focus
- parsing selectors
Schedule
- Make tokenizer available.
- Make parser available.
- Benchmarks & CI (https://github.com/benchmark-action/github-action-benchmark)
- Make transformer available.
- Make generator available.
- Playground (with WASM)
- Allows writing plugins using Nodejs
- Generate code frame for diagnostics when errors occur.
- Docs
lib.rs
:
A simpler and faster CSS parser.
Usages
use tele_tokenizer::Tokenizer;
use tele_parser::Parser;
// Create a tokenizer
let mut tokenizer: Tokenizer = r".foo { color: red; }".into();
// Tokenize based on the given raw string,
let tokens = tokenizer.tokenize().unwrap();
// Create a parser from a sequence of tokens
let parser = Parser::from(tokens);
// parsing it
let ast = parser.parse();
Dependencies
~0.4–1MB
~24K SLoC