mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-25 06:48:43 +01:00
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.
This commit is contained in:
parent
9da157ff4a
commit
2d59a7f560
|
@ -1,6 +1,5 @@
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
|
||||||
use chumsky::container::Container;
|
|
||||||
use rowan::{
|
use rowan::{
|
||||||
Checkpoint, GreenNode, GreenNodeBuilder, GreenNodeData, GreenTokenData, Language, NodeOrToken,
|
Checkpoint, GreenNode, GreenNodeBuilder, GreenNodeData, GreenTokenData, Language, NodeOrToken,
|
||||||
};
|
};
|
||||||
|
@ -12,6 +11,23 @@ use crate::parser::{
|
||||||
|
|
||||||
use super::lex::{self, SyntaxKind};
|
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<SyntaxError>,
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Parser {
|
||||||
|
fn parse<'src>(input: &[(SyntaxKind, &'src str)]) -> ParseResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub struct Parse {
|
pub struct Parse {
|
||||||
pub green_node: GreenNode,
|
pub green_node: GreenNode,
|
||||||
|
|
Loading…
Reference in a new issue