rust-cssparser – CSS syntax parser

rust-cssparser is a library implementing the CSS Syntax specification. It provides the parsing primitives needed to process CSS text, including tokenization, component-value parsing, and the recognition of rules and declarations. The library can serve as the foundation for applications that need to interpret CSS, such as browser engines, stylesheet processors, and other developer tools.

CSS parsing involves several stages, from identifying individual tokens to interpreting complete rules and property values. rust-cssparser handles the lower-level syntax processing while leaving the interpretation of individual CSS properties and selectors to applications using the library. This separation allows developers to implement the parts of CSS relevant to their software rather than relying on a complete browser-style processing engine.

This is free and open source software.

Key Features

  • Tokenization of CSS text according to the CSS Syntax specification.
  • Parse CSS component values, including functions and nested blocks.
  • Parsing interfaces for qualified rules, at-rules, and declarations.
  • Support for implementing custom CSS property and selector parsers.
  • Streaming parser interface for processing input without constructing a complete stylesheet tree.
  • Parsing utilities for CSS colours and functional colour notation.
  • Support for An+B expressions used by structural pseudo-classes such as :nth-child().
  • Structured parsing errors with source-position information.
  • Parser state management for attempting alternative parsing operations and restoring input positions.
  • CSS serialization utilities for identifiers, strings, and other syntax elements.
  • Utilities for detecting stylesheet character encodings before decoding input.
  • Support for building higher-level CSS parsers using reusable syntax-processing components.

Website: github.com/servo/rust-cssparser
Support:
Developer: Servo Project contributors
License: Mozilla Public License v2.0

rust-cssparser is written in Rust. Learn Rust with our recommended free books and free tutorials.


Related Software

CSS Parsers
PostCSSTransform styles with JavaScript plugins
Lightning CSSParser, transformer, bundler, and minifier
ReworkPlugin framework for CSS preprocessing
PHP CSS ParserPHP library for reading CSS
MenschNon-validating CSS parser
CSSTreeTool set for CSS
StylisLightweight CSS preprocessor
tinycss2CSS parser and generator
ParseGo library offering lexers, parsers, and parsing utilities
LibCSSCSS parser and selection engine
Ruby CSS ParserLoad, parse and cascade CSS rule sets
ParserLibCSS3 SAX-inspired parser
css-parserFork of the cssutils project
ph-cssParse, represent, modify, and write CSS stylesheets
StylecowModern CSS to all browsers
Gonzales PECSS parser which plays nicely with preprocessors
CSSOMCSS parser written in pure JavaScript

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted