| Crates.io | sipha-core |
| lib.rs | sipha-core |
| version | 0.3.0 |
| created_at | 2025-11-18 16:32:36.462332+00 |
| updated_at | 2025-11-22 09:47:52.551989+00 |
| description | Core foundation types and traits for sipha - minimal dependencies, no parsing logic |
| homepage | |
| repository | https://github.com/NyalephTheCat/sipha |
| max_upload_size | |
| id | 1938646 |
| size | 41,955 |
Core foundation types and traits for sipha - minimal dependencies, no parsing logic.
sipha-core is the minimal foundation of the sipha parser ecosystem. It provides only the essential traits and types that are shared across all other sipha crates:
TokenKind, RuleId, NodeId, SymbolId, GrammarContext, AstNodeSpan, Token, TokenTriviaThis crate has minimal dependencies and contains no parsing logic, focusing solely on defining the interfaces for tokens, rules, nodes, and spans.
Add sipha-core to your Cargo.toml:
[dependencies]
sipha-core = "0.1.1"
With optional features:
[dependencies]
sipha-core = { version = "0.1.1", features = ["serde"] }
default: No features enabled (minimal dependencies)serde: Enables serialization/deserialization for Span and Tokenuse sipha_core::traits::{TokenKind, RuleId, NodeId};
use sipha_core::span::Span;
use sipha_core::token::Token;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum MyToken {
Ident,
Number,
}
impl TokenKind for MyToken {
fn is_trivia(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum MyRule {
Expression,
Term,
}
impl RuleId for MyRule {}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct MyNodeId(usize);
impl NodeId for MyNodeId {
fn from_raw(raw: usize) -> Self {
MyNodeId(raw)
}
fn to_raw(self) -> usize {
self.0
}
}
For more information, see:
This project is licensed under the MIT License - see the LICENSE file for details.