aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-11-02 19:26:57 -0700
committerbnewbold <bnewbold@robocracy.org>2016-11-02 19:26:57 -0700
commit7d42b73a02d0b2b8964d6a5a633b9102f52c717b (patch)
tree95f20e1f8edcc09aaadbf18e6958fe955ad8d829 /src/bin
parentece67d35847ec89cbf4d3d13236ce5bb1d51b716 (diff)
downloadmodelthing-7d42b73a02d0b2b8964d6a5a633b9102f52c717b.tar.gz
modelthing-7d42b73a02d0b2b8964d6a5a633b9102f52c717b.zip
similarly crude javascript output
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/mt-tool.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bin/mt-tool.rs b/src/bin/mt-tool.rs
index 8aac6ca..7dab194 100644
--- a/src/bin/mt-tool.rs
+++ b/src/bin/mt-tool.rs
@@ -5,6 +5,7 @@ extern crate getopts;
use modelthing::modelica_parser;
use modelthing::transpile_scheme::TranspileScheme;
+use modelthing::transpile_js::TranspileJS;
use getopts::Options;
use std::env;
use std::io::Read;
@@ -82,7 +83,7 @@ fn main() {
let cmd = matches.free[0].clone();
match cmd.as_str() {
"parse" => { parse_modelica_files(matches.free[1..].iter().map(|x| x.to_string()).collect()); },
- "transpile" => {
+ "transpile_scheme" => {
if matches.free.len() != 2 {
println!("Expected a single path to load");
exit(-1);
@@ -90,6 +91,14 @@ fn main() {
let me = modelthing::load_model_entry(Path::new(&matches.free[1])).unwrap();
println!("{}", me.ast.repr_scheme().unwrap());
},
+ "transpile_js" => {
+ if matches.free.len() != 2 {
+ println!("Expected a single path to load");
+ exit(-1);
+ }
+ let me = modelthing::load_model_entry(Path::new(&matches.free[1])).unwrap();
+ println!("{}", me.ast.repr_js().unwrap());
+ },
"list" => {
// XXX: search path?
for m in modelthing::search_models(Path::new("examples")) {