aboutsummaryrefslogtreecommitdiffstats
path: root/src/modelica_parser.lalrpop
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-10-28 00:35:00 -0700
committerbnewbold <bnewbold@robocracy.org>2016-10-28 00:35:00 -0700
commit034c96d0840a724f1865bd988b99d64878212b66 (patch)
tree93794ab1f14d8e22ba37348f6ffddf5dffea6c05 /src/modelica_parser.lalrpop
parent48874591724b853b033d7f11a4e78ffa812ef41e (diff)
downloadmodelthing-034c96d0840a724f1865bd988b99d64878212b66.tar.gz
modelthing-034c96d0840a724f1865bd988b99d64878212b66.zip
tiny additions to parser to handle examples
Diffstat (limited to 'src/modelica_parser.lalrpop')
-rw-r--r--src/modelica_parser.lalrpop4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/modelica_parser.lalrpop b/src/modelica_parser.lalrpop
index 9cb2c1c..52fd5eb 100644
--- a/src/modelica_parser.lalrpop
+++ b/src/modelica_parser.lalrpop
@@ -36,6 +36,8 @@ pub model: Model = {
component_declaration: Component = {
<prefix:component_prefix?> <specifier:identifier> <name:identifier> string_literal? ";" =>
Component { prefix:prefix, specifier:specifier, name:name},
+ <prefix:component_prefix?> <specifier:identifier> <name:identifier> "=" <value:expr> string_literal? ";" =>
+ Component { prefix:prefix, specifier:specifier, name:name},
};
component_prefix: ComponentPrefix = {
@@ -71,6 +73,8 @@ factor: Expr = {
Expr::BinExpr(BinOperator::Multiply, Box::new(lhs), Box::new(rhs)),
<lhs:factor> "/" <rhs:term> =>
Expr::BinExpr(BinOperator::Divide, Box::new(lhs), Box::new(rhs)),
+ <lhs:factor> "^" <rhs:term> =>
+ Expr::BinExpr(BinOperator::Divide, Box::new(lhs), Box::new(rhs)),
"-" <t:term> =>
Expr::BinExpr(BinOperator::Multiply, Box::new(Expr::Integer(-1)), Box::new(t)),
term,