From ad514f56b6cda288e605c44990ef16d30e6dee53 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Thu, 2 Sep 2021 23:31:39 +0200 Subject: remove grmtools the parser using grmtools was way oversized for just doing escape sequences, and only really existed since I wanted to play around with it. The new implementation depends on no external crates, uses just an iter wrapped into a nicely composable function, and appears to be exactly equivalent (but faster). --- util/Cargo.toml | 10 ++++++++++ util/src/main.rs | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 util/Cargo.toml create mode 100644 util/src/main.rs (limited to 'util') diff --git a/util/Cargo.toml b/util/Cargo.toml new file mode 100644 index 0000000..70d66bf --- /dev/null +++ b/util/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "util" +version = "0.1.0" +authors = ["stuebinm "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +isabelle-unicode = { path = "../isabelle-unicode" } diff --git a/util/src/main.rs b/util/src/main.rs new file mode 100644 index 0000000..4670b38 --- /dev/null +++ b/util/src/main.rs @@ -0,0 +1,23 @@ +use std::io; +use std::io::BufRead; + +use isabelle_unicode::PrettyUnicode; + + +fn main() { + + let stdin = io::stdin(); + + stdin.lock() + .lines() + .filter_map(|line| match line { + Ok(line) if line.trim().is_empty() + => Some("\n".to_string()), + Ok(line) + => line.to_pretty_unicode(), + Err(_) + => None + }) + .for_each(|line| print!("{}", line)); + +} -- cgit v1.2.3