aboutsummaryrefslogtreecommitdiff
path: root/src/sexp
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-14 15:31:27 +0300
committerJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-14 15:31:27 +0300
commit928a3358483f60db84dc2918415882b35adc006b (patch)
tree0b35b8e601f3ca93cdeb7f8d45bb1d06cf274e66 /src/sexp
parent907bd54d19f6bf14a130a136df6f37cc5d256468 (diff)
downloadmyslip-928a3358483f60db84dc2918415882b35adc006b.tar.gz
myslip-928a3358483f60db84dc2918415882b35adc006b.zip
fix: removed obsolete code for handling types as they are now parsed directly to atoms
Diffstat (limited to 'src/sexp')
-rw-r--r--src/sexp/display.rs1
-rw-r--r--src/sexp/mod.rs1
-rw-r--r--src/sexp/step.rs28
3 files changed, 0 insertions, 30 deletions
diff --git a/src/sexp/display.rs b/src/sexp/display.rs
index 9f54efe..ceab833 100644
--- a/src/sexp/display.rs
+++ b/src/sexp/display.rs
@@ -33,7 +33,6 @@ impl fmt::Display for SLeaf {
Fun => "fn".to_string(),
Case => "case".to_string(),
Ty(t) => t.to_string(),
- Arr => "->".to_string(),
Nil => "()".to_string(),
})
}
diff --git a/src/sexp/mod.rs b/src/sexp/mod.rs
index ba8743f..eeeb2d6 100644
--- a/src/sexp/mod.rs
+++ b/src/sexp/mod.rs
@@ -41,7 +41,6 @@ pub enum SLeaf {
Case,
Ty(Type),
- Arr,
Print,
diff --git a/src/sexp/step.rs b/src/sexp/step.rs
index d35c8af..5b60fec 100644
--- a/src/sexp/step.rs
+++ b/src/sexp/step.rs
@@ -323,29 +323,12 @@ impl SExp {
pub fn step(self) -> Result<Self, String> {
match self {
-
- // Type list (maybe these should just be parsed...)
- SCons(op, l) if (*op).is_type_lit() => {
- if *l == Atom(Nil) {
- return Ok(*op);
- }
- let mut res = vec![];
- for exp in std::iter::once(*op).chain(l.parts()) {
- res.push(match exp.multistep()? {
- Atom(Ty(t)) => Ok(t),
- e => Err(format!("not a type: {e}")),
- }?);
- }
- Ok(Atom(Ty(List(res))))
- },
-
// t is value
// ----------
// t -> t
t if t.is_value() => Ok(t),
-
// List processing
// op not a value
@@ -633,17 +616,6 @@ impl SExp {
}
},
- // Type arrow
- SCons(op, l) if *op == Atom(Arr) => {
- let ls = l.parts();
- let t1 = ls.get(0).ok_or("wrong list length".to_string())?;
- let t2 = ls.get(1).ok_or("wrong list length".to_string())?;
- match (t1.clone().multistep()?, t2.clone().multistep()?) {
- (Atom(Ty(a)), Atom(Ty(b))) => Ok(Atom(Ty(arr(a.clone(), b.clone())))),
- _ => Err("invalid args".to_string()),
- }
- },
-
// Nil in list
SCons(op, _) if *op == Atom(Nil) => {
Ok(scons(Vector, Nil))