| Crates.io | logosky |
| lib.rs | logosky |
| version | 0.2.0 |
| created_at | 2025-10-15 05:11:19.854062+00 |
| updated_at | 2025-10-20 21:03:35.862349+00 |
| description | A seamless integration layer between Logos lexer and Chumsky parser combinator, providing zero-copy TokenStream adapter and Parseable trait for building robust parsers |
| homepage | https://github.com/al8n/logosky |
| repository | https://github.com/al8n/logosky |
| max_upload_size | |
| id | 1883766 |
| size | 337,804 |
A seamless integration layer between Logos and Chumsky parser combinator, providing zero-copy TokenStream adapter and Parseable trait for building robust parsers
English | įŽäŊ䏿
LogoSky is a Rust library that bridges Logos and Chumsky, combining the speed of Logos' lexical analysis with the expressiveness of Chumsky's parser combinators. It provides a seamless integration layer that allows you to use Logos for tokenization and Chumsky for parsing in a unified, type-safe manner.
TokenStream adapterSpan and Spanned typesstr, [u8], Bytes, BStr, HipStr)Add this to your Cargo.toml:
[dependencies]
logosky = "0.2"
std (default) - Enable standard library supportalloc - Enable allocator support for no-std environmentsbytes - Support for bytes::Bytes as token sourcebstr - Support for bstr::BStr as token sourcehipstr - Support for hipstr::HipStr as token sourceeither - Enable Either<L, R> parseable supportamong - Enable Among<L, M, R> parseable supportsmallvec - Enable small vector optimization utilitiesTokenStream<'a, T>
An zero-copy adapter that bridges Logos lexer output to Chumsky parser input. Implements Chumsky's Input, ValueInput, SliceInput, and ExactSizeInput traits.
Token<'a> Trait
The core trait for defining tokens. Requires:
Char: Character type (usually char or u8)Kind: Token kind discriminatorLogos: Associated Logos token enumLosslessToken<'a> Trait
Extends Token<'a> for tokens that preserve all source information, including trivia (whitespace, comments).
is_trivia() method to identify non-semantic tokensTokenizer trivia handling utilitiesTokenizer<'a, T> Trait
Provides parser combinators for working with token streams:
skip_trivias(): Skip over trivia tokens (whitespace, comments)collect_trivias(): Collect trivia tokens into a container for later processingParseable<'a, I, T, Error> Trait
A trait for types that can be parsed from a token stream. Implement this to create composable parsers.
Span and Spanned<T>
Span: Lightweight span tracking (start/end positions)Spanned<T>: Wraps a value with its source spanUtility Traits
IsAsciiChar: ASCII character checking utilitiesAsSpan / IntoSpan: Span access traitsIntoComponents: Destructure parsed elementslogosky?smear: Blazing fast, fully spec-compliant, reusable parser combinators for standard GraphQL and GraphQL-like DSLs.logosky is dual-licensed under:
You may choose either license for your purposes.
Copyright (c) 2025 Al Liu.