cl-lexer: Move lexer into its own crate

This commit is contained in:
2024-02-29 20:58:50 -06:00
parent abf00f383c
commit 50b473cd55
15 changed files with 198 additions and 188 deletions

View File

@@ -9,6 +9,6 @@ publish.workspace = true
[dependencies]
cl-ast = { path = "../cl-ast" }
cl-lexer = { path = "../cl-lexer" }
cl-token = { path = "../cl-token" }
cl-structures = { path = "../cl-structures" }
conlang = { path = "../libconlang" }

View File

@@ -1,6 +1,6 @@
use super::*;
use conlang::lexer::error::{Error as LexError, Reason};
use cl_lexer::error::{Error as LexError, Reason};
use std::fmt::Display;
pub type PResult<T> = Result<T, Error>;

View File

@@ -5,7 +5,7 @@ use crate::error::{
PResult, Parsing,
};
use cl_ast::*;
use conlang::lexer::Lexer;
use cl_lexer::Lexer;
/// Parses a sequence of [Tokens](Token) into an [AST](cl_ast)
pub struct Parser<'t> {
@@ -905,11 +905,7 @@ impl<'t> Parser<'t> {
/// [Block] = `{` [Stmt]* `}`
pub fn block(&mut self) -> PResult<Block> {
const PARSING: Parsing = Parsing::Block;
Ok(
Block {
stmts: delim(rep(Self::stmt, CURLIES.1, PARSING), CURLIES, PARSING)(self)?,
},
)
Ok(Block { stmts: delim(rep(Self::stmt, CURLIES.1, PARSING), CURLIES, PARSING)(self)? })
}
}
/// ## Control flow subexpressions