From 2d59a7f560bf81d24c0fc418a614f858efb454b2 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Fri, 12 Apr 2024 01:02:07 +0200 Subject: [PATCH] lang: start implementing parser combinators (i have no idea what i'm doing) also, the current test.owo crashes for some reason. this is a headache. manual/imperative parsers are a nightmare. --- crates/lang/src/parser/ast/lossless/parser.rs | 18 +++++++++++++++++- flake.nix | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/lang/src/parser/ast/lossless/parser.rs b/crates/lang/src/parser/ast/lossless/parser.rs index a3c30ca..95bb7d7 100644 --- a/crates/lang/src/parser/ast/lossless/parser.rs +++ b/crates/lang/src/parser/ast/lossless/parser.rs @@ -1,6 +1,5 @@ use std::borrow::Borrow; -use chumsky::container::Container; use rowan::{ Checkpoint, GreenNode, GreenNodeBuilder, GreenNodeData, GreenTokenData, Language, NodeOrToken, }; @@ -12,6 +11,23 @@ use crate::parser::{ use super::lex::{self, SyntaxKind}; +mod parsers { + use rowan::GreenNode; + + use crate::parser::ast::lossless::lex::SyntaxKind; + + use super::SyntaxError; + + struct ParseResult { + green_node: GreenNode, + errors: Vec, + } + + trait Parser { + fn parse<'src>(input: &[(SyntaxKind, &'src str)]) -> ParseResult; + } +} + #[derive(PartialEq, Eq)] pub struct Parse { pub green_node: GreenNode, diff --git a/flake.nix b/flake.nix index 9d43d6e..3c8d815 100644 --- a/flake.nix +++ b/flake.nix @@ -46,7 +46,7 @@ }; pre-commit.hooks = { - clippy.enable = true; + clippy.enable = false; rustfmt.enable = true; };