cl-repl: Rename from cl-frontend.

Also disable escape code printing when debug assertions are off
This commit is contained in:
John 2024-02-28 05:32:10 -06:00
parent 048e41836a
commit 862d81a9d4
7 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,5 @@
[workspace] [workspace]
members = ["libconlang", "cl-frontend"] members = ["libconlang", "cl-repl"]
resolver = "2" resolver = "2"
[workspace.package] [workspace.package]

View File

@ -1,5 +1,5 @@
[package] [package]
name = "cl-frontend" name = "cl-repl"
repository.workspace = true repository.workspace = true
version.workspace = true version.workspace = true
authors.workspace = true authors.workspace = true

View File

@ -1,6 +1,6 @@
//! Collects identifiers into a list //! Collects identifiers into a list
use cl_frontend::repline::Repline; use cl_repl::repline::Repline;
use conlang::{common::Loc, lexer::Lexer, parser::Parser}; use conlang::{common::Loc, lexer::Lexer, parser::Parser};
use std::{ use std::{
collections::HashMap, collections::HashMap,

View File

@ -1,4 +1,4 @@
use cl_frontend::{args::Args, cli::CLI}; use cl_repl::{args::Args, cli::CLI};
use std::error::Error; use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {

View File

@ -255,8 +255,10 @@ impl<'a, R: Read> Repline<'a, R> {
} }
} }
c if c.is_ascii_control() => { c if c.is_ascii_control() => {
if cfg!(debug_assertions) {
eprint!("\\x{:02x}", c as u32); eprint!("\\x{:02x}", c as u32);
} }
}
c => { c => {
self.ed.push(c, stdout)?; self.ed.push(c, stdout)?;
} }
@ -296,9 +298,11 @@ impl<'a, R: Read> Repline<'a, R> {
} }
} }
other => { other => {
if cfg!(debug_assertions) {
eprint!("{}", other.escape_unicode()); eprint!("{}", other.escape_unicode());
} }
} }
}
Ok(()) Ok(())
} }
/// Restores the currently selected history /// Restores the currently selected history