diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-12-26 00:08:37 -0800 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-12-26 00:08:37 -0800 |
commit | 9cf287fef8e614f57d0d52d579d6721ba54683f4 (patch) | |
tree | ceda8550fd28770d24a1ab37f5de1bee1f71959a /src | |
parent | 957c2f75ceccfab3d8a8e546961db5f053876689 (diff) | |
download | modelthing-9cf287fef8e614f57d0d52d579d6721ba54683f4.tar.gz modelthing-9cf287fef8e614f57d0d52d579d6721ba54683f4.zip |
updates for new modelica-parser-lalrpop hierarchy
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/mt-tool.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/modelica_model.rs | 8 | ||||
-rw-r--r-- | src/transpile_js.rs | 4 | ||||
-rw-r--r-- | src/transpile_scheme.rs | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/src/bin/mt-tool.rs b/src/bin/mt-tool.rs index 37b1705..b6763b2 100644 --- a/src/bin/mt-tool.rs +++ b/src/bin/mt-tool.rs @@ -25,7 +25,7 @@ fn parse_modelica_files(paths: Vec<String>) { } let time_stamp = Instant::now(); - let result = modelica_parser::parser::parse_model(&s); + let result = modelica_parser::parse_model(&s); let elapsed = time_stamp.elapsed(); let elapsed = elapsed.as_secs() as f64 + elapsed.subsec_nanos() as f64 / 1000_000_000.0; @@ -41,7 +41,7 @@ pub struct ModelVar { #[derive(Debug, PartialEq)] pub struct ModelEntry { - pub ast: modelica_parser::ast::ModelicaModel, + pub ast: modelica_parser::ModelicaModel, pub metadata: ModelMetadata, pub markdown: String, } @@ -66,7 +66,7 @@ pub fn load_model_entry(p: &Path) -> Result<ModelEntry, String> { try!(File::open(p.join("model.modelica")) .and_then(|mut f| f.read_to_string(&mut s)) .map_err(|e| e.to_string())); - try!(modelica_parser::parser::parse_model(&s).map_err(|e| format!("{:?}", e))) + try!(modelica_parser::parse_model(&s).map_err(|e| format!("{:?}", e))) }; let metadata = { diff --git a/src/modelica_model.rs b/src/modelica_model.rs index 7b77123..b0bc825 100644 --- a/src/modelica_model.rs +++ b/src/modelica_model.rs @@ -5,7 +5,7 @@ use std::clone::Clone; use std::collections::HashMap; use std::collections::HashSet; -use self::modelica_parser::ast::*; +use self::modelica_parser::*; /// / Helpers @@ -170,7 +170,7 @@ impl ModelicaModelExt for ModelicaModel { // Recurses through 'original', replacing all instances of 'a' with 'b' fn substitute_with(original: &Expr, a: &Expr, b: &Expr) -> Expr { - use modelica_parser::ast::Expr::*; + use modelica_parser::Expr::*; println!("original: {:?} replacing: {:?} with: {:?}", original, a, b); if *original == *a { return b.clone(); @@ -234,8 +234,8 @@ impl SimpleEquationExt for SimpleEquation { } fn simplify_lhs(&self, ident: &str) -> Result<SimpleEquation, String> { - use modelica_parser::ast::Expr::*; - use modelica_parser::ast::BinOperator::*; + use modelica_parser::Expr::*; + use modelica_parser::BinOperator::*; match self.lhs { Ident(ref s) if s == ident => Ok((*self).clone()), Ident(_) | Integer(_) | Float(_) | Boolean(_) | StringLiteral(_) => { diff --git a/src/transpile_js.rs b/src/transpile_js.rs index 1fa6075..b14b964 100644 --- a/src/transpile_js.rs +++ b/src/transpile_js.rs @@ -1,7 +1,7 @@ extern crate modelica_parser; -use self::modelica_parser::ast::*; +use self::modelica_parser::*; pub trait TranspileJS { fn repr_js(&self) -> Result<String, String>; @@ -42,7 +42,7 @@ impl TranspileJS for ModelicaModel { impl TranspileJS for Expr { fn repr_js(&self) -> Result<String, String> { - use modelica_parser::ast::Expr::*; + use modelica_parser::Expr::*; match *self { Integer(e) => Ok(format!("{}", e)), Float(e) => Ok(format!("{}", e)), diff --git a/src/transpile_scheme.rs b/src/transpile_scheme.rs index 7c25047..68147e2 100644 --- a/src/transpile_scheme.rs +++ b/src/transpile_scheme.rs @@ -1,7 +1,7 @@ extern crate modelica_parser; -use self::modelica_parser::ast::*; +use self::modelica_parser::*; pub trait TranspileScheme { fn repr_scheme(&self) -> Result<String, String>; @@ -40,7 +40,7 @@ impl TranspileScheme for ModelicaModel { impl TranspileScheme for Expr { fn repr_scheme(&self) -> Result<String, String> { - use modelica_parser::ast::Expr::*; + use modelica_parser::Expr::*; match *self { Integer(e) => Ok(format!("{}", e)), Float(e) => Ok(format!("{}", e)), |