aboutsummaryrefslogtreecommitdiffstats
path: root/src/transpile_js.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transpile_js.rs')
-rw-r--r--src/transpile_js.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/transpile_js.rs b/src/transpile_js.rs
index 7a2132f..d4ed5f7 100644
--- a/src/transpile_js.rs
+++ b/src/transpile_js.rs
@@ -49,14 +49,19 @@ impl TranspileJS for Expr {
match *self {
Integer(e) => Ok(format!("{}", e)),
Float(e) => Ok(format!("{}", e)),
+ Boolean(true) => Ok(format!("true")),
+ Boolean(false) => Ok(format!("false")),
+ StringLiteral(ref s) => Ok(format!("\"{}\"", s)),
Ident(ref e) => Ok(format!("{}", e)),
Der(ref e) => Ok(format!("der({})", try!(e.repr_js()))),
- Abs(ref e) => Ok(format!("abs({})", try!(e.repr_js()))),
+ Sign(ref e) => Ok(format!("sign({})", try!(e.repr_js()))),
+ MathUnaryExpr(func, ref e) => Ok(format!("{:?}({})", func, try!(e.repr_js()))),
BinExpr(op, ref l, ref r) =>
Ok(format!("({} {:?} {})",
try!(l.repr_js()),
op,
try!(r.repr_js()))),
+ Array(_) => Err("Array unimplemented".to_string()),
}
}
}