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

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

View File

@@ -1,9 +1,9 @@
//! Collects identifiers into a list
use cl_lexer::Lexer;
use cl_parser::Parser;
use cl_repl::repline::Repline;
use cl_structures::span::Loc;
use conlang::lexer::Lexer;
use std::{
collections::HashMap,
error::Error,

View File

@@ -1,7 +1,7 @@
//! This example grabs input from stdin, lexes it, and prints which lexer rules matched
#![allow(unused_imports)]
use cl_lexer::Lexer;
use cl_token::Token;
use conlang::lexer::Lexer;
use std::{
error::Error,
io::{stdin, IsTerminal, Read},

View File

@@ -74,12 +74,9 @@ pub mod program {
};
use cl_ast::{self as ast, ast_impl::format::Pretty};
use cl_lexer::Lexer;
use cl_parser::{error::PResult, Parser};
use conlang::{
// pretty_printer::{PrettyPrintable, Printer},
lexer::Lexer,
resolver::{error::TyResult, Resolver},
};
use conlang::resolver::{error::TyResult, Resolver};
use std::{fmt::Display, io::Write};
pub struct Parsable;
@@ -228,7 +225,7 @@ pub mod cli {
match (repl, path) {
(true, Some(path)) => {
let prog = std::fs::read_to_string(path).unwrap();
let code = cl_parser::Parser::new(conlang::lexer::Lexer::new(&prog))
let code = cl_parser::Parser::new(cl_lexer::Lexer::new(&prog))
.file()
.unwrap();
let mut env = cl_interpret::env::Environment::new();