From 8fb821f3edf00bfd22901af809bdfd131a03e7f3 Mon Sep 17 00:00:00 2001 From: DIetmar Winkler Date: Wed, 24 Jan 2024 15:50:28 +0100 Subject: [PATCH 1/2] Add Modelica language --- languages.json | 6 ++++++ tests/data/Modelica.mo | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/data/Modelica.mo diff --git a/languages.json b/languages.json index efdd6de45..ff3287499 100644 --- a/languages.json +++ b/languages.json @@ -926,6 +926,12 @@ "quotes": [["\\\"", "\\\""]], "extensions": ["mlt"] }, + "Modelica": { + "line_comment": ["//"], + "multi_line_comments": [["/*", "*/"]], + "quotes": [["\\\"", "\\\""]], + "extensions": ["mo", "mos"] + }, "ModuleDef": { "name": "Module-Definition", "extensions": ["def"], diff --git a/tests/data/Modelica.mo b/tests/data/Modelica.mo new file mode 100644 index 000000000..adec32bb1 --- /dev/null +++ b/tests/data/Modelica.mo @@ -0,0 +1,21 @@ +// 21 lines 13 code 4 comments 3 blanks +block Add "Output the sum of the two inputs" + extends Interfaces.SI2SO; + +/* +parameter section +*/ + parameter Real k1=+1 "Gain of input signal 1"; + parameter Real k2=+1 "Gain of input signal 2"; + +// equation section +equation + y = k1*u1 + k2*u2; + annotation ( + Documentation(info=" +

+Some documentation. +

+")); + +end Add; From 3cebb133bbbb4f8ee96b5a5bb41c62cde3283b10 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Thu, 25 Jan 2024 08:16:41 +0100 Subject: [PATCH 2/2] tests/data/Modelica.mo: Correct number of comment lines. Co-authored-by: Thomas Beutlich --- tests/data/Modelica.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data/Modelica.mo b/tests/data/Modelica.mo index adec32bb1..d2c6303c9 100644 --- a/tests/data/Modelica.mo +++ b/tests/data/Modelica.mo @@ -1,4 +1,4 @@ -// 21 lines 13 code 4 comments 3 blanks +// 21 lines 13 code 5 comments 3 blanks block Add "Output the sum of the two inputs" extends Interfaces.SI2SO;