aboutsummaryrefslogtreecommitdiffstats
path: root/modelica-parser-lalrpop/src/parser.lalrpop
diff options
context:
space:
mode:
Diffstat (limited to 'modelica-parser-lalrpop/src/parser.lalrpop')
-rw-r--r--modelica-parser-lalrpop/src/parser.lalrpop6
1 files changed, 6 insertions, 0 deletions
diff --git a/modelica-parser-lalrpop/src/parser.lalrpop b/modelica-parser-lalrpop/src/parser.lalrpop
index a2c5d44..36aa07d 100644
--- a/modelica-parser-lalrpop/src/parser.lalrpop
+++ b/modelica-parser-lalrpop/src/parser.lalrpop
@@ -102,6 +102,7 @@ factor: Expr = {
term: Expr = {
integer => Expr::Integer(<>),
+ boolean => Expr::Boolean(<>),
float => Expr::Float(<>),
identifier => Expr::Ident(<>),
"der" "(" <e:expr> ")" => Expr::Der(Box::new(e)),
@@ -120,5 +121,10 @@ term: Expr = {
"log" "(" <e:expr> ")" => Expr::MathUnaryExpr(MathUnaryFunc::Log, Box::new(e)),
"log10" "(" <e:expr> ")" => Expr::MathUnaryExpr(MathUnaryFunc::Log10, Box::new(e)),
"(" <e:expr> ")" => e,
+ // Obviously a hack here, only supporting up to 4 elements in an array
+ "[" <e:expr> "]" => Expr::Array(vec![e]),
+ "[" <e1:expr> "," <e2:expr> "]" => Expr::Array(vec![e1, e2]),
+ "[" <e1:expr> "," <e2:expr> "," <e3:expr> "]" => Expr::Array(vec![e1, e2, e3]),
+ "[" <e1:expr> "," <e2:expr> "," <e3:expr> "," <e4:expr> "]" => Expr::Array(vec![e1, e2, e3, e4]),
};