get ready for early publish
This commit is contained in:
parent
01de2f385a
commit
fdfff2c33a
11 changed files with 42 additions and 3 deletions
9
crates/lopal/Cargo.toml
Normal file
9
crates/lopal/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "lopal"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
5
crates/lopal/README.md
Normal file
5
crates/lopal/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# LOssless PArser Library
|
||||
|
||||
Yeah :3
|
||||
|
||||
Reserved for the main crate, work is currently happening over in [lopal_core]
|
3
crates/lopal/src/main.rs
Normal file
3
crates/lopal/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
3
crates/lopal_core/README.md
Normal file
3
crates/lopal_core/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# LoPaL Core
|
||||
|
||||
Currently most development is happening here, until i get to a lot of rewriting and stuff.
|
|
@ -1,3 +1,8 @@
|
|||
//! Heavily in-dev parser library.
|
||||
//!
|
||||
//! Inspired by rust-analyzer.
|
||||
//!
|
||||
//! See [_Modern Parser Generator_](https://matklad.github.io/2018/06/06/modern-parser-generator.html) by Matklad
|
||||
#![feature(iter_collect_into)]
|
||||
pub mod parser;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ pub mod marker;
|
|||
pub mod output;
|
||||
|
||||
/// this is used to define some required SyntaxKinds like an EOF token or an error token
|
||||
/// These should be different, idk what happens if they're the same.
|
||||
pub trait SyntaxElement
|
||||
where
|
||||
Self: EnumSetType
|
||||
|
@ -32,6 +33,10 @@ where
|
|||
const SYNTAX_ROOT: Self;
|
||||
}
|
||||
|
||||
/// The core parser that you interact with.
|
||||
/// Should be passed to all parser functions as first argument.
|
||||
/// Currently very minimal/bare-bones.
|
||||
/// See the [`lopal_json`](https://forge.katzen.cafe/schrottkatze/lopal/src/branch/main/crates/lopal_json) source code for reference.
|
||||
pub struct Parser<'src, SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> {
|
||||
input: Input<'src, SyntaxKind>,
|
||||
pos: usize,
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
use std::fmt;
|
||||
|
||||
/// A marker trait... for now!
|
||||
// TODO: constrain that conversion to `NodeKind::Error` is enforced to be possible
|
||||
///
|
||||
/// Marks a type as, well, an error type.
|
||||
///
|
||||
/// TODO: constrain that conversion to `NodeKind::Error` is enforced to be possible
|
||||
pub trait SyntaxError
|
||||
where
|
||||
Self: fmt::Debug + Clone + PartialEq + Eq,
|
||||
|
|
|
@ -2,7 +2,7 @@ use enumset::EnumSetType;
|
|||
|
||||
use super::{error::SyntaxError, SyntaxElement};
|
||||
|
||||
pub enum Event<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> {
|
||||
pub(crate) enum Event<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> {
|
||||
Start {
|
||||
kind: NodeKind<SyntaxKind, SyntaxErr>,
|
||||
forward_parent: Option<usize>,
|
||||
|
@ -23,7 +23,7 @@ impl<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> Event<SyntaxKind, Syntax
|
|||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub enum NodeKind<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> {
|
||||
pub(crate) enum NodeKind<SyntaxKind: SyntaxElement, SyntaxErr: SyntaxError> {
|
||||
Tombstone,
|
||||
Syntax(SyntaxKind),
|
||||
Error(SyntaxErr),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue