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). --- symbolmacro/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'symbolmacro') diff --git a/symbolmacro/src/lib.rs b/symbolmacro/src/lib.rs index f99ccd9..636c786 100644 --- a/symbolmacro/src/lib.rs +++ b/symbolmacro/src/lib.rs @@ -39,14 +39,14 @@ pub fn make_symbols(_item: TokenStream) -> TokenStream { let symbols = fetchsymbols(); format!( - "fn symbol(key: &str) -> Option<&'static str> {{ + "fn symbol(key: &str) -> Option {{ match key {{ {} _ => None }} }}", symbols.iter() - .map(|(k,v)| format!("\"{}\" => Some(\"{}\"),",k,v)) + .map(|(k,v)| format!("\"{}\" => Some(\'{}\'),",k,v)) .collect::>() .join("\n") ).parse().unwrap() -- cgit v1.2.3