summaryrefslogtreecommitdiff
path: root/util/src/main.rs
diff options
context:
space:
mode:
authorstuebinm2021-09-02 23:31:39 +0200
committerstuebinm2021-09-03 00:02:16 +0200
commitad514f56b6cda288e605c44990ef16d30e6dee53 (patch)
treebec6de5f4bdabf432c7045394af15ba96f525546 /util/src/main.rs
parent715001ba92799839afc97d92c9f0a79924085a69 (diff)
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).
Diffstat (limited to '')
-rw-r--r--util/src/main.rs23
1 files changed, 23 insertions, 0 deletions
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));
+
+}