get ready for early publish

This commit is contained in:
Schrottkatze 2025-05-13 09:49:20 +02:00
parent 01de2f385a
commit fdfff2c33a
Signed by: schrottkatze
SSH key fingerprint: SHA256:FPOYVeBy3QP20FEM42uWF1Wa/Qhlk+L3S2+Wuau/Auo
11 changed files with 42 additions and 3 deletions

4
Cargo.lock generated
View file

@ -132,6 +132,10 @@ dependencies = [
"logos-codegen",
]
[[package]]
name = "lopal"
version = "0.1.0"
[[package]]
name = "lopal_core"
version = "0.1.0"

View file

@ -1,5 +1,6 @@
[workspace]
members = [
"crates/lopal",
"crates/lopal_core",
"crates/lopal_json"
]

9
crates/lopal/Cargo.toml Normal file
View 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
View 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
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View file

@ -0,0 +1,3 @@
# LoPaL Core
Currently most development is happening here, until i get to a lot of rewriting and stuff.

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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),

View file

@ -30,6 +30,7 @@
{
default = pkgs.mkShell rec {
buildInputs = with pkgs; [
cargo-watch
toolchain
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;