summaryrefslogtreecommitdiff
path: root/isabelle-dump/src/calc.y
diff options
context:
space:
mode:
authorstuebinm2021-09-02 23:31:39 +0200
committerstuebinm2021-09-03 00:02:16 +0200
commitad514f56b6cda288e605c44990ef16d30e6dee53 (patch)
treebec6de5f4bdabf432c7045394af15ba96f525546 /isabelle-dump/src/calc.y
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--isabelle-dump/src/calc.y54
1 files changed, 0 insertions, 54 deletions
diff --git a/isabelle-dump/src/calc.y b/isabelle-dump/src/calc.y
deleted file mode 100644
index 2dd3bd3..0000000
--- a/isabelle-dump/src/calc.y
+++ /dev/null
@@ -1,54 +0,0 @@
-%start AbbrList
-
-%%
-
-AbbrList -> Result<Vec<Isabelle>, ()>:
- Text { Ok(vec![Isabelle::Text($1?)]) }
- | Abbr { Ok(vec![Isabelle::Symbol($1?)]) }
- | AbbrList Abbr
- {
- let mut $1 = $1?;
- $1.push(Isabelle::Symbol($2?));
- Ok($1)
- }
- | AbbrList Text
- {
- let mut $1 = $1?;
- $1.push(Isabelle::Text($2?));
- Ok($1)
- }
- ;
-
-Abbr -> Result<String, ()>:
- 'AOPEN' Name { Ok($2?) }
- ;
-
-Text -> Result<String, ()>:
- 'TEXT'
- {
- let v = $1.map_err(|_| ())?;
- Ok($lexer.span_str(v.span()).to_string())
- }
- | 'AOPEN'
- {
- //let v = $2.map_err(|_| ())?;
- Ok("\\".to_string())
- }
- | 'LT'
- {
- //let v = $2.map_err(|_| ())?;
- Ok("<".to_string()) //format!("<{}", $lexer.span_str(v.span())))
- }
- ;
-
-Name -> Result<String, ()>:
- 'NAME'
- {
- let v = $1.map_err(|_| ())?;
- let name = $lexer.span_str(v.span());
- Ok(name[1..name.len()-1].to_string())
- }
- ;
-%%
-
-use crate::Isabelle;