From fc0e67f5d7d092e5b37d103d2d106733228ddf89 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 18 Dec 2016 14:15:18 -0800 Subject: parser: booleans and arrays --- modelica-parser-lalrpop/src/parser.lalrpop | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modelica-parser-lalrpop/src/parser.lalrpop') 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" "(" ")" => Expr::Der(Box::new(e)), @@ -120,5 +121,10 @@ term: Expr = { "log" "(" ")" => Expr::MathUnaryExpr(MathUnaryFunc::Log, Box::new(e)), "log10" "(" ")" => Expr::MathUnaryExpr(MathUnaryFunc::Log10, Box::new(e)), "(" ")" => e, + // Obviously a hack here, only supporting up to 4 elements in an array + "[" "]" => Expr::Array(vec![e]), + "[" "," "]" => Expr::Array(vec![e1, e2]), + "[" "," "," "]" => Expr::Array(vec![e1, e2, e3]), + "[" "," "," "," "]" => Expr::Array(vec![e1, e2, e3, e4]), }; -- cgit v1.2.3