diff --git a/pysd/_version.py b/pysd/_version.py index 8a124bf6..b19ee4b7 100644 --- a/pysd/_version.py +++ b/pysd/_version.py @@ -1 +1 @@ -__version__ = "2.2.0" +__version__ = "2.2.1" diff --git a/pysd/translation/vensim/vensim2py.py b/pysd/translation/vensim/vensim2py.py index 13f841b2..71005fbf 100644 --- a/pysd/translation/vensim/vensim2py.py +++ b/pysd/translation/vensim/vensim2py.py @@ -1144,7 +1144,7 @@ def parse_general_expression(element, namespace={}, subscript_dict={}, reference = (id _ subscript_list) / id # check first for subscript subscript_list = "[" _ ~"\""? _ (subs _ ~"\""? _ "!"? _ ","? _)+ _ "]" - array = (number _ ("," / ";")? _)+ !~r"." # negative lookahead for + array = (number _ ("," / ";")? _ "\\"? _)+ !~r"." # negative lookahead for # anything other than an array string = "\'" ( "\\\'" / ~r"[^\']"IU )* "\'" @@ -1368,7 +1368,8 @@ def visit_array(self, n, vc): element["subs"], subscript_dict, terse=False ) if ";" in n.text or "," in n.text: - text = n.text.strip(";").replace(" ", "").replace(";", ",") + text = n.text.strip(";").replace(" ", "").replace( + ";", ",").replace("\\", "") data = np.array([float(s) for s in text.split(",")]) data = data.reshape(compute_shape(coords)) datastr = ( diff --git a/tests/integration_test_vensim_pathway.py b/tests/integration_test_vensim_pathway.py index 499fb6a9..e2efaff2 100644 --- a/tests/integration_test_vensim_pathway.py +++ b/tests/integration_test_vensim_pathway.py @@ -34,6 +34,10 @@ def test_arguments(self): output, canon = runner(test_models + '/arguments/test_arguments.mdl') assert_frames_close(output, canon, rtol=rtol) + def test_array_with_line_break(self): + output, canon = runner(test_models + '/array_with_line_break/test_array_with_line_break.mdl') + assert_frames_close(output, canon, rtol=rtol) + def test_builtin_max(self): output, canon = runner(test_models + '/builtin_max/builtin_max.mdl') assert_frames_close(output, canon, rtol=rtol) diff --git a/tests/test-models b/tests/test-models index 79653a04..de294a8a 160000 --- a/tests/test-models +++ b/tests/test-models @@ -1 +1 @@ -Subproject commit 79653a0458d66ad20d8487a26f8f787d4c73e576 +Subproject commit de294a8ad0f2c1a2bf41c351cfc4ab637bc39825