From f97396ea89704ff2ccab28d7b27ceeeb3201ddd0 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Mon, 26 Dec 2016 05:02:38 -0800 Subject: parser: fix string_literals --- modelica-parser-lalrpop/src/ast.rs | 3 +++ modelica-parser-lalrpop/src/parser.lalrpop | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modelica-parser-lalrpop/src/ast.rs b/modelica-parser-lalrpop/src/ast.rs index f31681e..f1e7d93 100644 --- a/modelica-parser-lalrpop/src/ast.rs +++ b/modelica-parser-lalrpop/src/ast.rs @@ -224,6 +224,9 @@ impl SimpleEquation { impl Debug for ModelicaModel { fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> { try!(write!(fmt, "model {}\n", self.name)); + if let Some(ref desc) = self.description { + try!(write!(fmt, " \"{}\"\n", desc)); + } for v in self.components.iter() { try!(write!(fmt, " {:?};\n", v)); } diff --git a/modelica-parser-lalrpop/src/parser.lalrpop b/modelica-parser-lalrpop/src/parser.lalrpop index 94795c6..cb59a82 100644 --- a/modelica-parser-lalrpop/src/parser.lalrpop +++ b/modelica-parser-lalrpop/src/parser.lalrpop @@ -21,7 +21,8 @@ pub identifier: String = { }; string_literal: String = { - r#""[^"\\]*""# => <>.to_string(), + // Strip quotes from string literals + => s[1..s.len()-1].to_string(), }; pub integer: i64 = { -- cgit v1.2.3