Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 66.6% 582 / 0 / 874
Functions: -% 0 / 1 / 1
Branches: 59.5% 25 / 0 / 42

build_cmake/OMCompiler/Compiler/generated-mo/Template/SCodeDumpTpl.mo
Line Branch Exec Source
1 encapsulated package SCodeDumpTpl
2 "
3 file: SCodeDumpTpl.mo
4 package: SCodeDumpTpl
5 description: Generated by Susan.
6 "
7
8 public import Tpl;
9
10 public import Absyn;
11 public import Dump;
12 public import SCode;
13 public import SCodeDump;
14 public import Config;
15 public import System;
16 public import Util;
17 public import Error;
18 protected import AbsynDumpTpl;
19
20 public function dumpProgram
21 input Tpl.Text txt;
22 input list<SCode.Element> a_program;
23 input SCodeDump.SCodeDumpOptions a_options;
24
25 output Tpl.Text out_txt;
26 algorithm
27 5 out_txt := dumpElements(txt, a_program, false, a_options);
28 end dumpProgram;
29
30 public function dumpElements
31 input Tpl.Text txt;
32 input list<SCode.Element> a_elements;
33 input Boolean a_indent;
34 input SCodeDump.SCodeDumpOptions a_options;
35
36 output Tpl.Text out_txt;
37 protected
38 list<SCode.Element> ret_0;
39 algorithm
40 254 ret_0 := SCodeDump.filterElements(a_elements, a_options);
41 254 out_txt := dumpElements2(txt, ret_0, a_indent, a_options);
42 end dumpElements;
43
44 public function dumpElements2
45 input Tpl.Text txt;
46 input list<SCode.Element> a_elements;
47 input Boolean a_indent;
48 input SCodeDump.SCodeDumpOptions a_options;
49
50 output Tpl.Text out_txt;
51 protected
52 Util.StatefulBoolean ret_2;
53 Util.StatefulBoolean ret_1;
54 Integer ret_0;
55 algorithm
56 254 ret_0 := listLength(a_elements);
57 254 ret_1 := Util.makeStatefulBoolean(false);
58 254 ret_2 := Util.makeStatefulBoolean(true);
59 254 out_txt := dumpElements3(txt, a_elements, ret_0, ret_1, a_indent, ret_2, a_options);
60 end dumpElements2;
61
62 protected function fun_14
63 input Tpl.Text in_txt;
64 input Boolean in_mArg;
65 input array<Boolean> in_a_prevSpacing;
66 input Tpl.Text in_a_spacing;
67
68 output Tpl.Text out_txt;
69 algorithm
70 out_txt :=
71 match(in_txt, in_mArg, in_a_prevSpacing, in_a_spacing)
72 local
73 Tpl.Text txt;
74 array<Boolean> a_prevSpacing;
75 Tpl.Text a_spacing;
76 Boolean ret_0;
77
78 case ( txt,
79 false,
80 _,
81 _ )
82 then txt;
83
84 case ( txt,
85 _,
86 a_prevSpacing,
87 a_spacing )
88 algorithm
89 1375 ret_0 := Util.getStatefulBoolean(a_prevSpacing);
90 1375 txt := dumpPreElementSpacing(txt, Tpl.textString(a_spacing), ret_0);
91 then txt;
92 end match;
93 end fun_14;
94
95 protected function fun_15
96 input Tpl.Text in_txt;
97 input Boolean in_mArg;
98 input array<Boolean> in_a_inPublicSection;
99
100 output Tpl.Text out_txt;
101 algorithm
102 out_txt :=
103 match(in_txt, in_mArg, in_a_inPublicSection)
104 local
105 Tpl.Text txt;
106 array<Boolean> a_inPublicSection;
107 Boolean ret_1;
108 Boolean ret_0;
109
110 case ( txt,
111 true,
112 _ )
113 then txt;
114
115 case ( txt,
116 _,
117 a_inPublicSection )
118 algorithm
119 34 ret_0 := Util.getStatefulBoolean(a_inPublicSection);
120 34 ret_1 := boolNot(ret_0);
121 34 Util.setStatefulBoolean(a_inPublicSection, ret_1);
122 then txt;
123 end match;
124 end fun_15;
125
126 protected function fun_16
127 input Tpl.Text in_txt;
128 input Boolean in_mArg;
129 input Tpl.Text in_a_spacing;
130 input array<Boolean> in_a_prevSpacing;
131
132 output Tpl.Text out_txt;
133 algorithm
134 out_txt :=
135 match(in_txt, in_mArg, in_a_spacing, in_a_prevSpacing)
136 local
137 Tpl.Text txt;
138 Tpl.Text a_spacing;
139 array<Boolean> a_prevSpacing;
140
141 case ( txt,
142 true,
143 _,
144 a_prevSpacing )
145 algorithm
146 1213 Util.setStatefulBoolean(a_prevSpacing, false);
147 then txt;
148
149 case ( txt,
150 _,
151 a_spacing,
152 a_prevSpacing )
153 algorithm
154 162 Util.setStatefulBoolean(a_prevSpacing, true);
155 162 txt := Tpl.writeText(txt, a_spacing);
156 then txt;
157 end match;
158 end fun_16;
159
160 protected function fun_17
161 input Tpl.Text in_txt;
162 input Boolean in_mArg;
163 input Tpl.Text in_a_spacing;
164 input array<Boolean> in_a_prevSpacing;
165
166 output Tpl.Text out_txt;
167 algorithm
168 out_txt :=
169 match(in_txt, in_mArg, in_a_spacing, in_a_prevSpacing)
170 local
171 Tpl.Text txt;
172 Tpl.Text a_spacing;
173 array<Boolean> a_prevSpacing;
174 Boolean ret_0;
175
176 case ( txt,
177 false,
178 _,
179 a_prevSpacing )
180 algorithm
181 237 Util.setStatefulBoolean(a_prevSpacing, false);
182 then txt;
183
184 case ( txt,
185 _,
186 a_spacing,
187 a_prevSpacing )
188 algorithm
189 1375 ret_0 := Tpl.isEmpty(a_spacing);
190 1375 txt := fun_16(txt, ret_0, a_spacing, a_prevSpacing);
191 then txt;
192 end match;
193 end fun_17;
194
195 protected function fun_18
196 input Tpl.Text in_txt;
197 input Boolean in_a_indent;
198 input Tpl.Text in_a_post__spacing;
199 input Tpl.Text in_a_el__str;
200 input Tpl.Text in_a_vis__str;
201 input Tpl.Text in_a_pre__spacing;
202
203 output Tpl.Text out_txt;
204 algorithm
205 out_txt :=
206 match(in_txt, in_a_indent, in_a_post__spacing, in_a_el__str, in_a_vis__str, in_a_pre__spacing)
207 local
208 Tpl.Text txt;
209 Tpl.Text a_post__spacing;
210 Tpl.Text a_el__str;
211 Tpl.Text a_vis__str;
212 Tpl.Text a_pre__spacing;
213
214 case ( txt,
215 false,
216 a_post__spacing,
217 a_el__str,
218 a_vis__str,
219 a_pre__spacing )
220 algorithm
221 11 txt := Tpl.writeText(txt, a_pre__spacing);
222 11 txt := Tpl.writeText(txt, a_vis__str);
223 11 txt := Tpl.softNewLine(txt);
224 11 txt := Tpl.writeText(txt, a_el__str);
225 11 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
226 11 txt := Tpl.writeText(txt, a_post__spacing);
227 11 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
228 then txt;
229
230 case ( txt,
231 _,
232 a_post__spacing,
233 a_el__str,
234 a_vis__str,
235 a_pre__spacing )
236 algorithm
237 1601 txt := Tpl.writeText(txt, a_pre__spacing);
238 1601 txt := Tpl.writeText(txt, a_vis__str);
239 1601 txt := Tpl.softNewLine(txt);
240 1601 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
241 1601 txt := Tpl.writeText(txt, a_el__str);
242 1601 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
243 1601 txt := Tpl.writeText(txt, a_post__spacing);
244 1601 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
245 1601 txt := Tpl.popBlock(txt);
246 then txt;
247 end match;
248 end fun_18;
249
250 protected function lm_19
251 input output Tpl.Text txt;
252 input list<SCode.Element> items;
253 input Boolean a_indent;
254 input Integer a_numElements;
255 input array<Boolean> a_inPublicSection;
256 input SCodeDump.SCodeDumpOptions a_options;
257 input array<Boolean> a_prevSpacing;
258 algorithm
259
2/2
✓ Branch 0 taken 1612 times.
✓ Branch 1 taken 254 times.
1866 for lstElt_19 in items loop
260 txt := match lstElt_19
261 local
262 Integer x_i1;
263 SCode.Element i_el;
264 Boolean ret_11;
265 Boolean ret_10;
266 Tpl.Text l_post__spacing;
267 Boolean ret_8;
268 Tpl.Text l_dummyTxt;
269 Boolean ret_6;
270 Tpl.Text l_vis__str;
271 Tpl.Text l_el__str;
272 Boolean ret_3;
273 Boolean ret_2;
274 Tpl.Text l_pre__spacing;
275 Tpl.Text l_spacing;
276
277 case i_el
278 algorithm
279 1612 x_i1 := Tpl.getIteri_i0(txt);
280 1612 l_spacing := dumpElementSpacing(Tpl.emptyTxt, i_el);
281 ret_2 := intEq(1, x_i1);
282 1612 ret_3 := boolNot(ret_2);
283 1612 l_pre__spacing := fun_14(Tpl.emptyTxt, ret_3, a_prevSpacing, l_spacing);
284 1612 l_el__str := dumpElement(Tpl.emptyTxt, i_el, "", a_options);
285 1612 ret_6 := Util.getStatefulBoolean(a_inPublicSection);
286 1612 l_vis__str := dumpElementVisibility(Tpl.emptyTxt, i_el, ret_6);
287 1612 ret_8 := Tpl.isEmpty(l_vis__str);
288 1612 l_dummyTxt := fun_15(Tpl.emptyTxt, ret_8, a_inPublicSection);
289 ret_10 := intEq(x_i1, a_numElements);
290 1612 ret_11 := boolNot(ret_10);
291 1612 l_post__spacing := fun_17(Tpl.emptyTxt, ret_11, l_spacing, a_prevSpacing);
292 1612 txt := fun_18(txt, a_indent, l_post__spacing, l_el__str, l_vis__str, l_pre__spacing);
293 1612 txt := Tpl.nextIter(txt);
294 then txt;
295 end match;
296 end for;
297 end lm_19;
298
299 public function dumpElements3
300 input Tpl.Text txt;
301 input list<SCode.Element> a_elements;
302 input Integer a_numElements;
303 input array<Boolean> a_prevSpacing;
304 input Boolean a_indent;
305 input array<Boolean> a_inPublicSection;
306 input SCodeDump.SCodeDumpOptions a_options;
307
308 output Tpl.Text out_txt;
309 algorithm
310 254 out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(1, NONE(), NONE(), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
311 254 out_txt := lm_19(out_txt, a_elements, a_indent, a_numElements, a_inPublicSection, a_options, a_prevSpacing);
312 254 out_txt := Tpl.popIter(out_txt);
313 end dumpElements3;
314
315 protected function fun_21
316 input Tpl.Text in_txt;
317 input Boolean in_a_prevSpacing;
318 input String in_a_curSpacing;
319
320 output Tpl.Text out_txt;
321 algorithm
322 out_txt :=
323 match(in_txt, in_a_prevSpacing, in_a_curSpacing)
324 local
325 Tpl.Text txt;
326 String a_curSpacing;
327
328 case ( txt,
329 false,
330 a_curSpacing )
331 algorithm
332 1213 txt := Tpl.writeStr(txt, a_curSpacing);
333 then txt;
334
335 case ( txt,
336 _,
337 _ )
338 then txt;
339 end match;
340 end fun_21;
341
342 public function dumpPreElementSpacing
343 input Tpl.Text txt;
344 input String a_curSpacing;
345 input Boolean a_prevSpacing;
346
347 output Tpl.Text out_txt;
348 algorithm
349 1375 out_txt := fun_21(txt, a_prevSpacing, a_curSpacing);
350 end dumpPreElementSpacing;
351
352 public function dumpElementSpacing
353 input Tpl.Text in_txt;
354 input SCode.Element in_a_element;
355
356 output Tpl.Text out_txt;
357 algorithm
358 out_txt :=
359 match(in_txt, in_a_element)
360 local
361 Tpl.Text txt;
362 SCode.ClassDef i_classDef;
363
364 case ( txt,
365 SCode.CLASS(classDef = i_classDef) )
366 algorithm
367 331 txt := dumpClassDefSpacing(txt, i_classDef);
368 then txt;
369
370 case ( txt,
371 _ )
372 then txt;
373 end match;
374 end dumpElementSpacing;
375
376 public function dumpClassDefSpacing
377 input Tpl.Text in_txt;
378 input SCode.ClassDef in_a_classDef;
379
380 output Tpl.Text out_txt;
381 algorithm
382 out_txt :=
383 match(in_txt, in_a_classDef)
384 local
385 Tpl.Text txt;
386 SCode.ClassDef i_composition;
387
388 case ( txt,
389 SCode.CLASS_EXTENDS(composition = i_composition) )
390 algorithm
391 17 txt := dumpClassDefSpacing(txt, i_composition);
392 then txt;
393
394 case ( txt,
395 SCode.PARTS(elementLst = _) )
396 algorithm
397 242 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
398 then txt;
399
400 case ( txt,
401 _ )
402 then txt;
403 end match;
404 end dumpClassDefSpacing;
405
406 protected function fun_25
407 input Tpl.Text in_txt;
408 input SCodeDump.SCodeDumpOptions in_a_options;
409 input SCode.Element in_a_element;
410
411 output Tpl.Text out_txt;
412 algorithm
413 out_txt :=
414 match(in_txt, in_a_options, in_a_element)
415 local
416 Tpl.Text txt;
417 SCode.Element a_element;
418
419 case ( txt,
420 SCodeDump.OPTIONS(stripProtectedImports = true),
421 _ )
422 then txt;
423
424 case ( txt,
425 _,
426 a_element )
427 algorithm
428 ✗ txt := dumpImport(txt, a_element);
429 then txt;
430 end match;
431 end fun_25;
432
433 protected function fun_26
434 input Tpl.Text in_txt;
435 input SCode.Visibility in_a_visibility;
436 input SCode.Element in_a_element;
437 input SCodeDump.SCodeDumpOptions in_a_options;
438
439 output Tpl.Text out_txt;
440 algorithm
441 out_txt :=
442 match(in_txt, in_a_visibility, in_a_element, in_a_options)
443 local
444 Tpl.Text txt;
445 SCode.Element a_element;
446 SCodeDump.SCodeDumpOptions a_options;
447
448 case ( txt,
449 SCode.PROTECTED(),
450 a_element,
451 a_options )
452 algorithm
453 ✗ txt := fun_25(txt, a_options, a_element);
454 then txt;
455
456 case ( txt,
457 _,
458 a_element,
459 _ )
460 algorithm
461 44 txt := dumpImport(txt, a_element);
462 then txt;
463 end match;
464 end fun_26;
465
466 public function dumpElement
467 input Tpl.Text in_txt;
468 input SCode.Element in_a_element;
469 input String in_a_each;
470 input SCodeDump.SCodeDumpOptions in_a_options;
471
472 output Tpl.Text out_txt;
473 algorithm
474 out_txt :=
475 match(in_txt, in_a_element, in_a_each, in_a_options)
476 local
477 Tpl.Text txt;
478 String a_each;
479 SCodeDump.SCodeDumpOptions a_options;
480 SCode.Element i_element;
481 SCode.Visibility i_visibility;
482
483 case ( txt,
484 (i_element as SCode.IMPORT(visibility = i_visibility)),
485 _,
486 a_options )
487 algorithm
488 44 txt := fun_26(txt, i_visibility, i_element, a_options);
489 then txt;
490
491 case ( txt,
492 (i_element as SCode.EXTENDS(baseClassPath = _)),
493 _,
494 a_options )
495 algorithm
496 169 txt := dumpExtends(txt, i_element, a_options);
497 then txt;
498
499 case ( txt,
500 (i_element as SCode.CLASS(name = _)),
501 a_each,
502 a_options )
503 algorithm
504 360 txt := dumpClass(txt, i_element, a_each, a_options);
505 then txt;
506
507 case ( txt,
508 (i_element as SCode.COMPONENT(name = _)),
509 a_each,
510 a_options )
511 algorithm
512 1125 txt := dumpComponent(txt, i_element, a_each, a_options);
513 then txt;
514
515 case ( txt,
516 (i_element as SCode.DEFINEUNIT(name = _)),
517 _,
518 _ )
519 algorithm
520 ✗ txt := dumpDefineUnit(txt, i_element);
521 then txt;
522
523 case ( txt,
524 _,
525 _,
526 _ )
527 algorithm
528 ✗ txt := errorMsg(txt, "SCodeDump.dumpElement: Unknown element.");
529 then txt;
530 end match;
531 end dumpElement;
532
533 public function dumpElementVisibility
534 input Tpl.Text in_txt;
535 input SCode.Element in_a_element;
536 input Boolean in_a_inPublicSection;
537
538 output Tpl.Text out_txt;
539 algorithm
540 out_txt :=
541 match(in_txt, in_a_element, in_a_inPublicSection)
542 local
543 Tpl.Text txt;
544 Boolean a_inPublicSection;
545 SCode.Visibility i_vis;
546 SCode.Visibility i_visibility;
547
548 case ( txt,
549 SCode.IMPORT(visibility = i_visibility),
550 a_inPublicSection )
551 algorithm
552 44 txt := dumpSectionVisibility(txt, i_visibility, a_inPublicSection);
553 then txt;
554
555 case ( txt,
556 SCode.EXTENDS(visibility = i_visibility),
557 a_inPublicSection )
558 algorithm
559 169 txt := dumpSectionVisibility(txt, i_visibility, a_inPublicSection);
560 then txt;
561
562 case ( txt,
563 SCode.CLASS(prefixes = SCode.PREFIXES(visibility = i_vis)),
564 a_inPublicSection )
565 algorithm
566 331 txt := dumpSectionVisibility(txt, i_vis, a_inPublicSection);
567 then txt;
568
569 case ( txt,
570 SCode.COMPONENT(prefixes = SCode.PREFIXES(visibility = i_vis)),
571 a_inPublicSection )
572 algorithm
573 1068 txt := dumpSectionVisibility(txt, i_vis, a_inPublicSection);
574 then txt;
575
576 case ( txt,
577 SCode.DEFINEUNIT(visibility = i_visibility),
578 a_inPublicSection )
579 algorithm
580 ✗ txt := dumpSectionVisibility(txt, i_visibility, a_inPublicSection);
581 then txt;
582
583 case ( txt,
584 _,
585 _ )
586 then txt;
587 end match;
588 end dumpElementVisibility;
589
590 protected function fun_29
591 input Tpl.Text in_txt;
592 input Boolean in_a_inPublicSection;
593
594 output Tpl.Text out_txt;
595 algorithm
596 out_txt :=
597 match(in_txt, in_a_inPublicSection)
598 local
599 Tpl.Text txt;
600
601 case ( txt,
602 false )
603 algorithm
604 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("public"));
605 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
606 then txt;
607
608 case ( txt,
609 _ )
610 then txt;
611 end match;
612 end fun_29;
613
614 protected function fun_30
615 input Tpl.Text in_txt;
616 input Boolean in_a_inPublicSection;
617
618 output Tpl.Text out_txt;
619 algorithm
620 out_txt :=
621 match(in_txt, in_a_inPublicSection)
622 local
623 Tpl.Text txt;
624
625 case ( txt,
626 false )
627 then txt;
628
629 case ( txt,
630 _ )
631 algorithm
632 34 txt := Tpl.writeTok(txt, Tpl.ST_STRING("protected"));
633 34 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
634 then txt;
635 end match;
636 end fun_30;
637
638 public function dumpSectionVisibility
639 input Tpl.Text in_txt;
640 input SCode.Visibility in_a_visibility;
641 input Boolean in_a_inPublicSection;
642
643 output Tpl.Text out_txt;
644 algorithm
645 out_txt :=
646 match(in_txt, in_a_visibility, in_a_inPublicSection)
647 local
648 Tpl.Text txt;
649 Boolean a_inPublicSection;
650
651 case ( txt,
652 SCode.PUBLIC(),
653 a_inPublicSection )
654 algorithm
655 1353 txt := fun_29(txt, a_inPublicSection);
656 then txt;
657
658 case ( txt,
659 SCode.PROTECTED(),
660 a_inPublicSection )
661 algorithm
662 259 txt := fun_30(txt, a_inPublicSection);
663 then txt;
664
665 case ( txt,
666 _,
667 _ )
668 then txt;
669 end match;
670 end dumpSectionVisibility;
671
672 protected function fun_32
673 input Tpl.Text in_txt;
674 input Absyn.Import in_a_imp;
675
676 output Tpl.Text out_txt;
677 algorithm
678 out_txt :=
679 match(in_txt, in_a_imp)
680 local
681 Tpl.Text txt;
682 Absyn.Path i_path;
683 Absyn.Ident i_name;
684
685 case ( txt,
686 Absyn.NAMED_IMPORT(name = i_name, path = i_path) )
687 algorithm
688 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("import "));
689 4 txt := Tpl.writeStr(txt, i_name);
690 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
691 4 txt := AbsynDumpTpl.dumpPath(txt, i_path);
692 then txt;
693
694 case ( txt,
695 Absyn.QUAL_IMPORT(path = i_path) )
696 algorithm
697 40 txt := Tpl.writeTok(txt, Tpl.ST_STRING("import "));
698 40 txt := AbsynDumpTpl.dumpPath(txt, i_path);
699 then txt;
700
701 case ( txt,
702 Absyn.UNQUAL_IMPORT(path = i_path) )
703 algorithm
704 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("import "));
705 ✗ txt := AbsynDumpTpl.dumpPath(txt, i_path);
706 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(".*"));
707 then txt;
708
709 case ( txt,
710 _ )
711 algorithm
712 ✗ txt := errorMsg(txt, "SCodeDump.dumpImport: Unknown import.");
713 then txt;
714 end match;
715 end fun_32;
716
717 public function dumpImport
718 input Tpl.Text in_txt;
719 input SCode.Element in_a_import;
720
721 output Tpl.Text out_txt;
722 algorithm
723 out_txt :=
724 match(in_txt, in_a_import)
725 local
726 Tpl.Text txt;
727 Absyn.Import i_imp;
728 SCode.Visibility i_visibility;
729 Tpl.Text l_import__str;
730 Tpl.Text l_visibility__str;
731
732 case ( txt,
733 SCode.IMPORT(visibility = i_visibility, imp = i_imp) )
734 algorithm
735 44 l_visibility__str := dumpVisibility(Tpl.emptyTxt, i_visibility);
736 44 l_import__str := fun_32(Tpl.emptyTxt, i_imp);
737 44 txt := Tpl.writeText(txt, l_visibility__str);
738 44 txt := Tpl.writeText(txt, l_import__str);
739 then txt;
740
741 case ( txt,
742 _ )
743 then txt;
744 end match;
745 end dumpImport;
746
747 public function dumpExtends
748 input Tpl.Text in_txt;
749 input SCode.Element in_a_extends;
750 input SCodeDump.SCodeDumpOptions in_a_options;
751
752 output Tpl.Text out_txt;
753 algorithm
754 out_txt :=
755 match(in_txt, in_a_extends, in_a_options)
756 local
757 Tpl.Text txt;
758 SCodeDump.SCodeDumpOptions a_options;
759 Option<SCode.Annotation> i_ann;
760 SCode.Mod i_modifications;
761 SCode.Visibility i_visibility;
762 SCode.Path i_baseClassPath;
763 Tpl.Text l_ann__str;
764 Tpl.Text l_mod__str;
765 Tpl.Text l_visibility__str;
766 Tpl.Text l_bc__str;
767
768 case ( txt,
769 SCode.EXTENDS(baseClassPath = i_baseClassPath, visibility = i_visibility, modifications = i_modifications, ann = i_ann),
770 a_options )
771 algorithm
772 169 l_bc__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_baseClassPath);
773 169 l_visibility__str := dumpVisibility(Tpl.emptyTxt, i_visibility);
774 169 l_mod__str := dumpModifier(Tpl.emptyTxt, i_modifications, a_options);
775 169 l_ann__str := dumpAnnotationOpt(Tpl.emptyTxt, i_ann, a_options);
776 169 txt := Tpl.writeText(txt, l_visibility__str);
777 169 txt := Tpl.writeTok(txt, Tpl.ST_STRING("extends "));
778 169 txt := Tpl.writeText(txt, l_bc__str);
779 169 txt := Tpl.writeText(txt, l_mod__str);
780 169 txt := Tpl.writeText(txt, l_ann__str);
781 then txt;
782
783 case ( txt,
784 _,
785 _ )
786 then txt;
787 end match;
788 end dumpExtends;
789
790 public function dumpClass
791 input Tpl.Text in_txt;
792 input SCode.Element in_a_class;
793 input String in_a_each;
794 input SCodeDump.SCodeDumpOptions in_a_options;
795
796 output Tpl.Text out_txt;
797 algorithm
798 out_txt :=
799 match(in_txt, in_a_class, in_a_each, in_a_options)
800 local
801 Tpl.Text txt;
802 String a_each;
803 SCodeDump.SCodeDumpOptions a_options;
804 SCode.Ident i_name;
805 SCode.Comment i_cmt;
806 SCode.ClassDef i_classDef;
807 SCode.Restriction i_restriction;
808 SCode.Partial i_partialPrefix;
809 SCode.Encapsulated i_encapsulatedPrefix;
810 SCode.Prefixes i_prefixes;
811 Tpl.Text l_footer__str;
812 Tpl.Text l_header__str;
813 Tpl.Text l_cc__str;
814 Tpl.Text l_ann__str;
815 Tpl.Text l_cmt__str;
816 Tpl.Text l_cdef__str;
817 Tpl.Text l_prefixes__str;
818 Tpl.Text l_res__str;
819 Tpl.Text l_partial__str;
820 Tpl.Text l_enc__str;
821 Tpl.Text l_prefix__str;
822
823 case ( txt,
824 SCode.CLASS(prefixes = i_prefixes, encapsulatedPrefix = i_encapsulatedPrefix, partialPrefix = i_partialPrefix, restriction = i_restriction, classDef = i_classDef, cmt = i_cmt, name = i_name),
825 a_each,
826 a_options )
827 algorithm
828 360 l_prefix__str := dumpPrefixes(Tpl.emptyTxt, i_prefixes, a_each);
829 360 l_enc__str := dumpEncapsulated(Tpl.emptyTxt, i_encapsulatedPrefix);
830 360 l_partial__str := dumpPartial(Tpl.emptyTxt, i_partialPrefix);
831 360 l_res__str := dumpRestriction(Tpl.emptyTxt, i_restriction);
832 360 l_prefixes__str := Tpl.writeText(Tpl.emptyTxt, l_prefix__str);
833 360 l_prefixes__str := Tpl.writeText(l_prefixes__str, l_enc__str);
834 360 l_prefixes__str := Tpl.writeText(l_prefixes__str, l_partial__str);
835 360 l_prefixes__str := Tpl.writeText(l_prefixes__str, l_res__str);
836 360 l_cdef__str := dumpClassDef(Tpl.emptyTxt, i_classDef, a_options);
837 360 l_cmt__str := dumpClassComment(Tpl.emptyTxt, i_cmt, a_options);
838 360 l_ann__str := dumpClassAnnotation(Tpl.emptyTxt, i_cmt, a_options);
839 360 l_cc__str := dumpReplaceableConstrainClass(Tpl.emptyTxt, i_prefixes, a_options);
840 360 l_header__str := dumpClassHeader(Tpl.emptyTxt, i_classDef, i_name, i_restriction, Tpl.textString(l_cmt__str), a_options);
841 360 l_footer__str := dumpClassFooter(Tpl.emptyTxt, i_classDef, Tpl.textString(l_cdef__str), i_name, Tpl.textString(l_cmt__str), Tpl.textString(l_ann__str), Tpl.textString(l_cc__str));
842 360 txt := Tpl.writeText(txt, l_prefixes__str);
843 360 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
844 360 txt := Tpl.writeText(txt, l_header__str);
845 360 txt := Tpl.writeText(txt, l_footer__str);
846 then txt;
847
848 case ( txt,
849 _,
850 _,
851 _ )
852 then txt;
853 end match;
854 end dumpClass;
855
856 public function dumpClassHeader
857 input Tpl.Text in_txt;
858 input SCode.ClassDef in_a_classDef;
859 input String in_a_name;
860 input SCode.Restriction in_a_restr;
861 input String in_a_cmt;
862 input SCodeDump.SCodeDumpOptions in_a_options;
863
864 output Tpl.Text out_txt;
865 algorithm
866 out_txt :=
867 match(in_txt, in_a_classDef, in_a_name, in_a_restr, in_a_cmt, in_a_options)
868 local
869 Tpl.Text txt;
870 String a_name;
871 SCode.Restriction a_restr;
872 String a_cmt;
873 SCodeDump.SCodeDumpOptions a_options;
874 SCode.Mod i_modifications;
875 Tpl.Text l_mod__str;
876
877 case ( txt,
878 SCode.CLASS_EXTENDS(modifications = i_modifications),
879 a_name,
880 _,
881 a_cmt,
882 a_options )
883 algorithm
884 17 l_mod__str := dumpModifier(Tpl.emptyTxt, i_modifications, a_options);
885 17 txt := Tpl.writeTok(txt, Tpl.ST_STRING("extends "));
886 17 txt := Tpl.writeStr(txt, a_name);
887 17 txt := Tpl.writeText(txt, l_mod__str);
888 17 txt := Tpl.writeStr(txt, a_cmt);
889 then txt;
890
891 case ( txt,
892 SCode.PARTS(elementLst = _),
893 a_name,
894 a_restr,
895 a_cmt,
896 _ )
897 algorithm
898 232 txt := Tpl.writeStr(txt, a_name);
899 232 txt := dumpRestrictionTypeVars(txt, a_restr);
900 232 txt := Tpl.writeStr(txt, a_cmt);
901 then txt;
902
903 case ( txt,
904 _,
905 a_name,
906 _,
907 _,
908 _ )
909 algorithm
910 111 txt := Tpl.writeStr(txt, a_name);
911 then txt;
912 end match;
913 end dumpClassHeader;
914
915 protected function fun_37
916 input Tpl.Text in_txt;
917 input SCodeDump.SCodeDumpOptions in_a_options;
918 input list<SCode.AlgorithmSection> in_a_p_normalAlgorithmLst;
919
920 output Tpl.Text out_txt;
921 algorithm
922 out_txt :=
923 match(in_txt, in_a_options, in_a_p_normalAlgorithmLst)
924 local
925 Tpl.Text txt;
926 list<SCode.AlgorithmSection> a_p_normalAlgorithmLst;
927 SCodeDump.SCodeDumpOptions i_options;
928
929 case ( txt,
930 (i_options as SCodeDump.OPTIONS(stripAlgorithmSections = false)),
931 a_p_normalAlgorithmLst )
932 algorithm
933 249 txt := dumpAlgorithmSections(txt, a_p_normalAlgorithmLst, "algorithm", i_options);
934 then txt;
935
936 case ( txt,
937 _,
938 _ )
939 then txt;
940 end match;
941 end fun_37;
942
943 protected function fun_38
944 input Tpl.Text in_txt;
945 input SCodeDump.SCodeDumpOptions in_a_options;
946 input list<SCode.AlgorithmSection> in_a_p_initialAlgorithmLst;
947
948 output Tpl.Text out_txt;
949 algorithm
950 out_txt :=
951 match(in_txt, in_a_options, in_a_p_initialAlgorithmLst)
952 local
953 Tpl.Text txt;
954 list<SCode.AlgorithmSection> a_p_initialAlgorithmLst;
955 SCodeDump.SCodeDumpOptions i_options;
956
957 case ( txt,
958 (i_options as SCodeDump.OPTIONS(stripAlgorithmSections = false)),
959 a_p_initialAlgorithmLst )
960 algorithm
961 249 txt := dumpAlgorithmSections(txt, a_p_initialAlgorithmLst, "initial algorithm", i_options);
962 then txt;
963
964 case ( txt,
965 _,
966 _ )
967 then txt;
968 end match;
969 end fun_38;
970
971 protected function lm_39
972 input output Tpl.Text txt;
973 input list<SCode.Enum> items;
974 input SCodeDump.SCodeDumpOptions a_options;
975 algorithm
976
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 5 times.
25 for lstElt_39 in items loop
977 txt := match lstElt_39
978 local
979 SCode.Enum i_enum;
980
981 case i_enum
982 algorithm
983 20 txt := dumpEnumLiteral(txt, i_enum, a_options);
984 20 txt := Tpl.nextIter(txt);
985 then txt;
986 end match;
987 end for;
988 end lm_39;
989
990 protected function fun_40
991 input Tpl.Text in_txt;
992 input list<SCode.Enum> in_a_enumLst;
993 input SCodeDump.SCodeDumpOptions in_a_options;
994
995 output Tpl.Text out_txt;
996 algorithm
997 out_txt :=
998 match(in_txt, in_a_enumLst, in_a_options)
999 local
1000 Tpl.Text txt;
1001 SCodeDump.SCodeDumpOptions a_options;
1002 list<SCode.Enum> i_enumLst;
1003
1004 case ( txt,
1005 {},
1006 _ )
1007 algorithm
1008 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(":"));
1009 then txt;
1010
1011 case ( txt,
1012 i_enumLst,
1013 a_options )
1014 algorithm
1015 5 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1016 5 txt := lm_39(txt, i_enumLst, a_options);
1017 5 txt := Tpl.popIter(txt);
1018 then txt;
1019 end match;
1020 end fun_40;
1021
1022 protected function lm_41
1023 input output Tpl.Text txt;
1024 input list<SCode.Ident> items;
1025 algorithm
1026 ✗ for lstElt_41 in items loop
1027 txt := match lstElt_41
1028 local
1029 SCode.Ident i_it;
1030
1031 case i_it
1032 algorithm
1033 ✗ txt := Tpl.writeStr(txt, i_it);
1034 ✗ txt := Tpl.nextIter(txt);
1035 then txt;
1036 end match;
1037 end for;
1038 end lm_41;
1039
1040 protected function lm_42
1041 input output Tpl.Text txt;
1042 input list<Absyn.Path> items;
1043 algorithm
1044 ✗ for lstElt_42 in items loop
1045 txt := match lstElt_42
1046 local
1047 Absyn.Path i_path;
1048
1049 case i_path
1050 algorithm
1051 ✗ txt := AbsynDumpTpl.dumpPath(txt, i_path);
1052 ✗ txt := Tpl.nextIter(txt);
1053 then txt;
1054 end match;
1055 end for;
1056 end lm_42;
1057
1058 public function dumpClassDef
1059 input Tpl.Text in_txt;
1060 input SCode.ClassDef in_a_classDef;
1061 input SCodeDump.SCodeDumpOptions in_a_options;
1062
1063 output Tpl.Text out_txt;
1064 algorithm
1065 out_txt :=
1066 match(in_txt, in_a_classDef, in_a_options)
1067 local
1068 Tpl.Text txt;
1069 SCodeDump.SCodeDumpOptions a_options;
1070 list<Absyn.Path> i_pathLst;
1071 list<SCode.Ident> i_derivedVariables;
1072 Absyn.Path i_functionPath;
1073 list<SCode.Enum> i_enumLst;
1074 SCode.Attributes i_attributes;
1075 Absyn.TypeSpec i_typeSpec;
1076 SCode.ClassDef i_composition;
1077 SCode.Mod i_modifications;
1078 Option<SCode.ExternalDecl> i_p_externalDecl;
1079 list<SCode.AlgorithmSection> i_p_initialAlgorithmLst;
1080 list<SCode.AlgorithmSection> i_p_normalAlgorithmLst;
1081 list<SCode.Equation> i_initialEquationLst;
1082 list<SCode.Equation> i_normalEquationLst;
1083 list<SCode.Element> i_elementLst;
1084 Tpl.Text l_func__str;
1085 Tpl.Text l_enum__str;
1086 Tpl.Text l_attr__str;
1087 Tpl.Text l_type__str;
1088 Tpl.Text l_mod__str;
1089 Tpl.Text l_cdef__str;
1090 Tpl.Text l_extdecl__str;
1091 Tpl.Text l_ial__str;
1092 Tpl.Text l_nal__str;
1093 Tpl.Text l_ieq__str;
1094 Tpl.Text l_neq__str;
1095 Tpl.Text l_el__str;
1096
1097 case ( txt,
1098 SCode.PARTS(elementLst = i_elementLst, normalEquationLst = i_normalEquationLst, initialEquationLst = i_initialEquationLst, normalAlgorithmLst = i_p_normalAlgorithmLst, initialAlgorithmLst = i_p_initialAlgorithmLst, externalDecl = i_p_externalDecl),
1099 a_options )
1100 algorithm
1101 249 l_el__str := dumpElements(Tpl.emptyTxt, i_elementLst, true, a_options);
1102 249 l_neq__str := dumpEquations(Tpl.emptyTxt, i_normalEquationLst, "equation", a_options);
1103 249 l_ieq__str := dumpEquations(Tpl.emptyTxt, i_initialEquationLst, "initial equation", a_options);
1104 249 l_nal__str := fun_37(Tpl.emptyTxt, a_options, i_p_normalAlgorithmLst);
1105 249 l_ial__str := fun_38(Tpl.emptyTxt, a_options, i_p_initialAlgorithmLst);
1106 249 l_extdecl__str := dumpExternalDeclOpt(Tpl.emptyTxt, i_p_externalDecl, a_options);
1107 249 l_cdef__str := Tpl.writeText(Tpl.emptyTxt, l_el__str);
1108 249 l_cdef__str := Tpl.softNewLine(l_cdef__str);
1109 249 l_cdef__str := Tpl.writeText(l_cdef__str, l_ieq__str);
1110 249 l_cdef__str := Tpl.softNewLine(l_cdef__str);
1111 249 l_cdef__str := Tpl.writeText(l_cdef__str, l_ial__str);
1112 249 l_cdef__str := Tpl.softNewLine(l_cdef__str);
1113 249 l_cdef__str := Tpl.writeText(l_cdef__str, l_neq__str);
1114 249 l_cdef__str := Tpl.softNewLine(l_cdef__str);
1115 249 l_cdef__str := Tpl.writeText(l_cdef__str, l_nal__str);
1116 249 l_cdef__str := Tpl.softNewLine(l_cdef__str);
1117 249 l_cdef__str := Tpl.pushBlock(l_cdef__str, Tpl.BT_INDENT(2));
1118 249 l_cdef__str := Tpl.writeText(l_cdef__str, l_extdecl__str);
1119 249 l_cdef__str := Tpl.popBlock(l_cdef__str);
1120 249 txt := Tpl.writeText(txt, l_cdef__str);
1121 then txt;
1122
1123 case ( txt,
1124 SCode.CLASS_EXTENDS(modifications = i_modifications, composition = i_composition),
1125 a_options )
1126 algorithm
1127 17 l_mod__str := dumpModifier(Tpl.emptyTxt, i_modifications, a_options);
1128 17 l_cdef__str := dumpClassDef(Tpl.emptyTxt, i_composition, a_options);
1129 17 txt := Tpl.writeText(txt, l_cdef__str);
1130 then txt;
1131
1132 case ( txt,
1133 SCode.DERIVED(typeSpec = i_typeSpec, modifications = i_modifications, attributes = i_attributes),
1134 a_options )
1135 algorithm
1136 106 l_type__str := AbsynDumpTpl.dumpTypeSpec(Tpl.emptyTxt, i_typeSpec);
1137 106 l_mod__str := dumpModifier(Tpl.emptyTxt, i_modifications, a_options);
1138 106 l_attr__str := dumpAttributes(Tpl.emptyTxt, i_attributes);
1139 106 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1140 106 txt := Tpl.writeTok(txt, Tpl.ST_STRING("= "));
1141 106 txt := Tpl.writeText(txt, l_attr__str);
1142 106 txt := Tpl.writeText(txt, l_type__str);
1143 106 txt := Tpl.writeText(txt, l_mod__str);
1144 106 txt := Tpl.popBlock(txt);
1145 then txt;
1146
1147 case ( txt,
1148 SCode.ENUMERATION(enumLst = i_enumLst),
1149 a_options )
1150 algorithm
1151 5 l_enum__str := fun_40(Tpl.emptyTxt, i_enumLst, a_options);
1152 5 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1153 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("= enumeration("));
1154 5 txt := Tpl.writeText(txt, l_enum__str);
1155 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1156 5 txt := Tpl.popBlock(txt);
1157 then txt;
1158
1159 case ( txt,
1160 SCode.PDER(functionPath = i_functionPath, derivedVariables = i_derivedVariables),
1161 _ )
1162 algorithm
1163 ✗ l_func__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_functionPath);
1164 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1165 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("= der("));
1166 ✗ txt := Tpl.writeText(txt, l_func__str);
1167 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
1168 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1169 ✗ txt := lm_41(txt, i_derivedVariables);
1170 ✗ txt := Tpl.popIter(txt);
1171 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1172 ✗ txt := Tpl.popBlock(txt);
1173 then txt;
1174
1175 case ( txt,
1176 SCode.OVERLOAD(pathLst = i_pathLst),
1177 _ )
1178 algorithm
1179 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1180 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("= overload("));
1181 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1182 ✗ txt := lm_42(txt, i_pathLst);
1183 ✗ txt := Tpl.popIter(txt);
1184 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1185 ✗ txt := Tpl.popBlock(txt);
1186 then txt;
1187
1188 case ( txt,
1189 _,
1190 _ )
1191 algorithm
1192 ✗ txt := errorMsg(txt, "SCodeDump.dumpClassDef: Unknown class definition.");
1193 then txt;
1194 end match;
1195 end dumpClassDef;
1196
1197 protected function fun_44
1198 input Tpl.Text in_txt;
1199 input String in_a_ann;
1200
1201 output Tpl.Text out_txt;
1202 algorithm
1203 out_txt :=
1204 match(in_txt, in_a_ann)
1205 local
1206 Tpl.Text txt;
1207 String i_ann;
1208
1209 case ( txt,
1210 "" )
1211 then txt;
1212
1213 case ( txt,
1214 i_ann )
1215 algorithm
1216 53 txt := Tpl.writeStr(txt, i_ann);
1217 53 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
1218 then txt;
1219 end match;
1220 end fun_44;
1221
1222 protected function fun_45
1223 input Tpl.Text in_txt;
1224 input Boolean in_mArg;
1225
1226 output Tpl.Text out_txt;
1227 algorithm
1228 out_txt :=
1229 match(in_txt, in_mArg)
1230 local
1231 Tpl.Text txt;
1232
1233 case ( txt,
1234 true )
1235 then txt;
1236
1237 case ( txt,
1238 _ )
1239 algorithm
1240 53 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
1241 then txt;
1242 end match;
1243 end fun_45;
1244
1245 protected function fun_46
1246 input Tpl.Text in_txt;
1247 input String in_a_cdefStr;
1248 input String in_a_cc__str;
1249 input String in_a_name;
1250 input Tpl.Text in_a_annstr;
1251
1252 output Tpl.Text out_txt;
1253 algorithm
1254 out_txt :=
1255 match(in_txt, in_a_cdefStr, in_a_cc__str, in_a_name, in_a_annstr)
1256 local
1257 Tpl.Text txt;
1258 String a_cc__str;
1259 String a_name;
1260 Tpl.Text a_annstr;
1261 String i_cdefStr;
1262 Boolean ret_0;
1263
1264 case ( txt,
1265 "",
1266 a_cc__str,
1267 a_name,
1268 a_annstr )
1269 algorithm
1270 10 txt := Tpl.writeText(txt, a_annstr);
1271 10 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" end "));
1272 10 txt := Tpl.writeStr(txt, a_name);
1273 10 txt := Tpl.writeStr(txt, a_cc__str);
1274 then txt;
1275
1276 case ( txt,
1277 i_cdefStr,
1278 a_cc__str,
1279 a_name,
1280 a_annstr )
1281 algorithm
1282 239 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
1283 239 txt := Tpl.writeStr(txt, i_cdefStr);
1284 239 txt := Tpl.softNewLine(txt);
1285 239 ret_0 := Tpl.isEmpty(a_annstr);
1286 239 txt := fun_45(txt, ret_0);
1287 239 txt := Tpl.writeText(txt, a_annstr);
1288 239 txt := Tpl.softNewLine(txt);
1289 239 txt := Tpl.writeTok(txt, Tpl.ST_STRING("end "));
1290 239 txt := Tpl.writeStr(txt, a_name);
1291 239 txt := Tpl.writeStr(txt, a_cc__str);
1292 then txt;
1293 end match;
1294 end fun_46;
1295
1296 public function dumpClassFooter
1297 input Tpl.Text in_txt;
1298 input SCode.ClassDef in_a_classDef;
1299 input String in_a_cdefStr;
1300 input String in_a_name;
1301 input String in_a_cmt;
1302 input String in_a_ann;
1303 input String in_a_cc__str;
1304
1305 output Tpl.Text out_txt;
1306 algorithm
1307 out_txt :=
1308 match(in_txt, in_a_classDef, in_a_cdefStr, in_a_name, in_a_cmt, in_a_ann, in_a_cc__str)
1309 local
1310 Tpl.Text txt;
1311 String a_cdefStr;
1312 String a_name;
1313 String a_cmt;
1314 String a_ann;
1315 String a_cc__str;
1316 Tpl.Text l_annstr;
1317
1318 case ( txt,
1319 SCode.DERIVED(typeSpec = _),
1320 a_cdefStr,
1321 _,
1322 a_cmt,
1323 a_ann,
1324 a_cc__str )
1325 algorithm
1326 106 txt := Tpl.writeStr(txt, a_cdefStr);
1327 106 txt := Tpl.writeStr(txt, a_cmt);
1328 106 txt := Tpl.writeStr(txt, a_ann);
1329 106 txt := Tpl.writeStr(txt, a_cc__str);
1330 then txt;
1331
1332 case ( txt,
1333 SCode.ENUMERATION(enumLst = _),
1334 a_cdefStr,
1335 _,
1336 a_cmt,
1337 a_ann,
1338 a_cc__str )
1339 algorithm
1340 5 txt := Tpl.writeStr(txt, a_cdefStr);
1341 5 txt := Tpl.writeStr(txt, a_cmt);
1342 5 txt := Tpl.writeStr(txt, a_ann);
1343 5 txt := Tpl.writeStr(txt, a_cc__str);
1344 then txt;
1345
1346 case ( txt,
1347 SCode.PDER(functionPath = _),
1348 a_cdefStr,
1349 _,
1350 _,
1351 _,
1352 _ )
1353 algorithm
1354 ✗ txt := Tpl.writeStr(txt, a_cdefStr);
1355 then txt;
1356
1357 case ( txt,
1358 _,
1359 a_cdefStr,
1360 a_name,
1361 _,
1362 a_ann,
1363 a_cc__str )
1364 algorithm
1365 249 l_annstr := fun_44(Tpl.emptyTxt, a_ann);
1366 249 txt := fun_46(txt, a_cdefStr, a_cc__str, a_name, l_annstr);
1367 then txt;
1368 end match;
1369 end dumpClassFooter;
1370
1371 public function dumpClassComment
1372 input Tpl.Text in_txt;
1373 input SCode.Comment in_a_comment;
1374 input SCodeDump.SCodeDumpOptions in_a_options;
1375
1376 output Tpl.Text out_txt;
1377 algorithm
1378 out_txt :=
1379 match(in_txt, in_a_comment, in_a_options)
1380 local
1381 Tpl.Text txt;
1382 SCodeDump.SCodeDumpOptions a_options;
1383 Option<String> i_comment;
1384
1385 case ( txt,
1386 SCode.COMMENT(comment = i_comment),
1387 a_options )
1388 algorithm
1389 360 txt := dumpCommentStr(txt, i_comment, a_options);
1390 then txt;
1391
1392 case ( txt,
1393 _,
1394 _ )
1395 then txt;
1396 end match;
1397 end dumpClassComment;
1398
1399 public function dumpClassAnnotation
1400 input Tpl.Text in_txt;
1401 input SCode.Comment in_a_comment;
1402 input SCodeDump.SCodeDumpOptions in_a_options;
1403
1404 output Tpl.Text out_txt;
1405 algorithm
1406 out_txt :=
1407 match(in_txt, in_a_comment, in_a_options)
1408 local
1409 Tpl.Text txt;
1410 SCodeDump.SCodeDumpOptions a_options;
1411 Option<SCode.Annotation> i_annotation__;
1412
1413 case ( txt,
1414 SCode.COMMENT(annotation_ = i_annotation__),
1415 a_options )
1416 algorithm
1417 360 txt := dumpAnnotationOpt(txt, i_annotation__, a_options);
1418 then txt;
1419
1420 case ( txt,
1421 _,
1422 _ )
1423 then txt;
1424 end match;
1425 end dumpClassAnnotation;
1426
1427 protected function fun_50
1428 input Tpl.Text in_txt;
1429 input SCode.Attributes in_a_attributes;
1430 input Tpl.Text in_a_mod__str1;
1431
1432 output Tpl.Text out_txt;
1433 algorithm
1434 out_txt :=
1435 match(in_txt, in_a_attributes, in_a_mod__str1)
1436 local
1437 Tpl.Text txt;
1438 Tpl.Text a_mod__str1;
1439
1440 case ( txt,
1441 SCode.ATTR(direction = Absyn.OUTPUT()),
1442 _ )
1443 then txt;
1444
1445 case ( txt,
1446 _,
1447 a_mod__str1 )
1448 algorithm
1449 ✗ txt := Tpl.writeText(txt, a_mod__str1);
1450 then txt;
1451 end match;
1452 end fun_50;
1453
1454 protected function fun_51
1455 input Tpl.Text in_txt;
1456 input SCodeDump.SCodeDumpOptions in_a_options;
1457 input SCode.Attributes in_a_attributes;
1458 input Tpl.Text in_a_mod__str1;
1459
1460 output Tpl.Text out_txt;
1461 algorithm
1462 out_txt :=
1463 match(in_txt, in_a_options, in_a_attributes, in_a_mod__str1)
1464 local
1465 Tpl.Text txt;
1466 SCode.Attributes a_attributes;
1467 Tpl.Text a_mod__str1;
1468
1469 case ( txt,
1470 SCodeDump.OPTIONS(stripOutputBindings = false),
1471 _,
1472 a_mod__str1 )
1473 algorithm
1474 1125 txt := Tpl.writeText(txt, a_mod__str1);
1475 then txt;
1476
1477 case ( txt,
1478 _,
1479 a_attributes,
1480 a_mod__str1 )
1481 algorithm
1482 ✗ txt := fun_50(txt, a_attributes, a_mod__str1);
1483 then txt;
1484 end match;
1485 end fun_51;
1486
1487 protected function fun_52
1488 input Tpl.Text in_txt;
1489 input Option<Absyn.Exp> in_a_condition;
1490
1491 output Tpl.Text out_txt;
1492 algorithm
1493 out_txt :=
1494 match(in_txt, in_a_condition)
1495 local
1496 Tpl.Text txt;
1497 Absyn.Exp i_cond;
1498
1499 case ( txt,
1500 SOME(i_cond) )
1501 algorithm
1502 7 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
1503 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("if "));
1504 7 txt := AbsynDumpTpl.dumpExp(txt, i_cond);
1505 7 txt := Tpl.popBlock(txt);
1506 then txt;
1507
1508 case ( txt,
1509 _ )
1510 then txt;
1511 end match;
1512 end fun_52;
1513
1514 public function dumpComponent
1515 input Tpl.Text in_txt;
1516 input SCode.Element in_a_component;
1517 input String in_a_each;
1518 input SCodeDump.SCodeDumpOptions in_a_options;
1519
1520 output Tpl.Text out_txt;
1521 algorithm
1522 out_txt :=
1523 match(in_txt, in_a_component, in_a_each, in_a_options)
1524 local
1525 Tpl.Text txt;
1526 String a_each;
1527 SCodeDump.SCodeDumpOptions a_options;
1528 SCode.Ident i_name;
1529 SCode.Comment i_comment;
1530 Option<Absyn.Exp> i_condition;
1531 SCode.Mod i_modifications;
1532 Absyn.TypeSpec i_typeSpec;
1533 SCode.Attributes i_attributes;
1534 SCode.Prefixes i_prefixes;
1535 Tpl.Text l_cmt__str;
1536 Tpl.Text l_cond__str;
1537 Tpl.Text l_mod__str;
1538 Tpl.Text l_mod__str1;
1539 Tpl.Text l_type__str;
1540 Tpl.Text l_attr__dim__str;
1541 Tpl.Text l_attr__pre__str;
1542 Tpl.Text l_cc__str;
1543 Tpl.Text l_prefix__str;
1544
1545 case ( txt,
1546 SCode.COMPONENT(prefixes = i_prefixes, attributes = i_attributes, typeSpec = i_typeSpec, modifications = i_modifications, condition = i_condition, comment = i_comment, name = i_name),
1547 a_each,
1548 a_options )
1549 algorithm
1550 1125 l_prefix__str := dumpPrefixes(Tpl.emptyTxt, i_prefixes, a_each);
1551 1125 l_cc__str := dumpReplaceableConstrainClass(Tpl.emptyTxt, i_prefixes, a_options);
1552 1125 l_attr__pre__str := dumpAttributes(Tpl.emptyTxt, i_attributes);
1553 1125 l_attr__dim__str := dumpAttributeDim(Tpl.emptyTxt, i_attributes);
1554 1125 l_type__str := AbsynDumpTpl.dumpTypeSpec(Tpl.emptyTxt, i_typeSpec);
1555 1125 l_mod__str1 := dumpModifier(Tpl.emptyTxt, i_modifications, a_options);
1556 1125 l_mod__str := fun_51(Tpl.emptyTxt, a_options, i_attributes, l_mod__str1);
1557 1125 l_cond__str := fun_52(Tpl.emptyTxt, i_condition);
1558 1125 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1559 1125 txt := Tpl.writeText(txt, l_prefix__str);
1560 1125 txt := Tpl.writeText(txt, l_attr__pre__str);
1561 1125 txt := Tpl.writeText(txt, l_type__str);
1562 1125 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
1563 1125 txt := Tpl.writeStr(txt, i_name);
1564 1125 txt := Tpl.writeText(txt, l_attr__dim__str);
1565 1125 txt := Tpl.writeText(txt, l_mod__str);
1566 1125 txt := Tpl.writeText(txt, l_cond__str);
1567 1125 txt := Tpl.writeText(txt, l_cc__str);
1568 1125 txt := Tpl.writeText(txt, l_cmt__str);
1569 then txt;
1570
1571 case ( txt,
1572 _,
1573 _,
1574 _ )
1575 then txt;
1576 end match;
1577 end dumpComponent;
1578
1579 protected function fun_54
1580 input Tpl.Text in_txt;
1581 input Option<String> in_a_exp;
1582
1583 output Tpl.Text out_txt;
1584 algorithm
1585 out_txt :=
1586 match(in_txt, in_a_exp)
1587 local
1588 Tpl.Text txt;
1589 String i_e;
1590
1591 case ( txt,
1592 SOME(i_e) )
1593 algorithm
1594 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("exp = \""));
1595 ✗ txt := Tpl.writeStr(txt, i_e);
1596 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1597 then txt;
1598
1599 case ( txt,
1600 _ )
1601 then txt;
1602 end match;
1603 end fun_54;
1604
1605 protected function fun_55
1606 input Tpl.Text in_txt;
1607 input Option<Real> in_a_weight;
1608
1609 output Tpl.Text out_txt;
1610 algorithm
1611 out_txt :=
1612 match(in_txt, in_a_weight)
1613 local
1614 Tpl.Text txt;
1615 Real i_w;
1616
1617 case ( txt,
1618 SOME(i_w) )
1619 algorithm
1620 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("weight = "));
1621 ✗ txt := Tpl.writeStr(txt, realString(i_w));
1622 then txt;
1623
1624 case ( txt,
1625 _ )
1626 then txt;
1627 end match;
1628 end fun_55;
1629
1630 protected function smf_56
1631 input Tpl.Text in_txt;
1632 input Tpl.Text in_it;
1633
1634 output Tpl.Text out_txt;
1635 algorithm
1636 out_txt :=
1637 match(in_txt, in_it)
1638 local
1639 Tpl.Text txt;
1640 Tpl.Text i_it;
1641
1642 case ( txt,
1643 i_it )
1644 algorithm
1645 ✗ txt := Tpl.writeText(txt, i_it);
1646 ✗ txt := Tpl.nextIter(txt);
1647 then txt;
1648 end match;
1649 end smf_56;
1650
1651 protected function smf_57
1652 input Tpl.Text in_txt;
1653 input Tpl.Text in_it;
1654
1655 output Tpl.Text out_txt;
1656 algorithm
1657 out_txt :=
1658 match(in_txt, in_it)
1659 local
1660 Tpl.Text txt;
1661 Tpl.Text i_it;
1662
1663 case ( txt,
1664 i_it )
1665 algorithm
1666 ✗ txt := Tpl.writeText(txt, i_it);
1667 ✗ txt := Tpl.nextIter(txt);
1668 then txt;
1669 end match;
1670 end smf_57;
1671
1672 protected function fun_58
1673 input Tpl.Text in_txt;
1674 input Boolean in_mArg;
1675
1676 output Tpl.Text out_txt;
1677 algorithm
1678 out_txt :=
1679 match(in_txt, in_mArg)
1680 local
1681 Tpl.Text txt;
1682
1683 case ( txt,
1684 true )
1685 then txt;
1686
1687 case ( txt,
1688 _ )
1689 algorithm
1690 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
1691 then txt;
1692 end match;
1693 end fun_58;
1694
1695 protected function fun_59
1696 input Tpl.Text in_txt;
1697 input Boolean in_mArg;
1698
1699 output Tpl.Text out_txt;
1700 algorithm
1701 out_txt :=
1702 match(in_txt, in_mArg)
1703 local
1704 Tpl.Text txt;
1705
1706 case ( txt,
1707 true )
1708 then txt;
1709
1710 case ( txt,
1711 _ )
1712 algorithm
1713 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1714 then txt;
1715 end match;
1716 end fun_59;
1717
1718 public function dumpDefineUnit
1719 input Tpl.Text in_txt;
1720 input SCode.Element in_a_defineUnit;
1721
1722 output Tpl.Text out_txt;
1723 algorithm
1724 out_txt :=
1725 match(in_txt, in_a_defineUnit)
1726 local
1727 Tpl.Text txt;
1728 SCode.Ident i_name;
1729 Option<Real> i_weight;
1730 Option<String> i_exp;
1731 SCode.Visibility i_visibility;
1732 Boolean ret_7;
1733 Tpl.Text l_pe;
1734 Boolean ret_5;
1735 Tpl.Text l_pb;
1736 Tpl.Text l_args__str;
1737 Tpl.Text l_weight__str;
1738 Tpl.Text l_exp__str;
1739 Tpl.Text l_vis__str;
1740
1741 case ( txt,
1742 SCode.DEFINEUNIT(visibility = i_visibility, exp = i_exp, weight = i_weight, name = i_name) )
1743 algorithm
1744 ✗ l_vis__str := dumpVisibility(Tpl.emptyTxt, i_visibility);
1745 ✗ l_exp__str := fun_54(Tpl.emptyTxt, i_exp);
1746 ✗ l_weight__str := fun_55(Tpl.emptyTxt, i_weight);
1747 ✗ l_args__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1748 ✗ l_args__str := smf_56(l_args__str, l_exp__str);
1749 ✗ l_args__str := smf_57(l_args__str, l_weight__str);
1750 ✗ l_args__str := Tpl.popIter(l_args__str);
1751 ✗ ret_5 := Tpl.isEmpty(l_args__str);
1752 ✗ l_pb := fun_58(Tpl.emptyTxt, ret_5);
1753 ✗ ret_7 := Tpl.isEmpty(l_args__str);
1754 ✗ l_pe := fun_59(Tpl.emptyTxt, ret_7);
1755 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("defineunit "));
1756 ✗ txt := Tpl.writeStr(txt, i_name);
1757 ✗ txt := Tpl.writeText(txt, l_pb);
1758 ✗ txt := Tpl.writeText(txt, l_args__str);
1759 ✗ txt := Tpl.writeText(txt, l_pe);
1760 then txt;
1761
1762 case ( txt,
1763 _ )
1764 then txt;
1765 end match;
1766 end dumpDefineUnit;
1767
1768 public function dumpEnumLiteral
1769 input Tpl.Text in_txt;
1770 input SCode.Enum in_a_enum;
1771 input SCodeDump.SCodeDumpOptions in_a_options;
1772
1773 output Tpl.Text out_txt;
1774 algorithm
1775 out_txt :=
1776 match(in_txt, in_a_enum, in_a_options)
1777 local
1778 Tpl.Text txt;
1779 SCodeDump.SCodeDumpOptions a_options;
1780 SCode.Ident i_literal;
1781 SCode.Comment i_comment;
1782 Tpl.Text l_cmt__str;
1783
1784 case ( txt,
1785 SCode.ENUM(comment = i_comment, literal = i_literal),
1786 a_options )
1787 algorithm
1788 20 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1789 20 txt := Tpl.writeStr(txt, i_literal);
1790 20 txt := Tpl.writeText(txt, l_cmt__str);
1791 then txt;
1792
1793 case ( txt,
1794 _,
1795 _ )
1796 then txt;
1797 end match;
1798 end dumpEnumLiteral;
1799
1800 protected function lm_62
1801 input output Tpl.Text txt;
1802 input list<SCode.Equation> items;
1803 input SCodeDump.SCodeDumpOptions a_options;
1804 algorithm
1805
2/2
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 26 times.
130 for lstElt_62 in items loop
1806 txt := match lstElt_62
1807 local
1808 SCode.Equation i_eq;
1809
1810 case i_eq
1811 algorithm
1812 104 txt := dumpEquation(txt, i_eq, a_options);
1813 104 txt := Tpl.nextIter(txt);
1814 then txt;
1815 end match;
1816 end for;
1817 end lm_62;
1818
1819 public function dumpEquations
1820 input Tpl.Text in_txt;
1821 input list<SCode.Equation> in_a_equations;
1822 input String in_a_label;
1823 input SCodeDump.SCodeDumpOptions in_a_options;
1824
1825 output Tpl.Text out_txt;
1826 algorithm
1827 out_txt :=
1828 match(in_txt, in_a_equations, in_a_label, in_a_options)
1829 local
1830 Tpl.Text txt;
1831 String a_label;
1832 SCodeDump.SCodeDumpOptions a_options;
1833 list<SCode.Equation> i_equations;
1834
1835 case ( txt,
1836 {},
1837 _,
1838 _ )
1839 then txt;
1840
1841 case ( txt,
1842 i_equations,
1843 a_label,
1844 a_options )
1845 algorithm
1846 26 txt := Tpl.writeStr(txt, a_label);
1847 26 txt := Tpl.softNewLine(txt);
1848 26 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1849 26 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1850 26 txt := lm_62(txt, i_equations, a_options);
1851 26 txt := Tpl.popIter(txt);
1852 26 txt := Tpl.popBlock(txt);
1853 then txt;
1854 end match;
1855 end dumpEquations;
1856
1857 public function dumpEquation
1858 input Tpl.Text in_txt;
1859 input SCode.Equation in_a_equation;
1860 input SCodeDump.SCodeDumpOptions in_a_options;
1861
1862 output Tpl.Text out_txt;
1863 algorithm
1864 out_txt :=
1865 match(in_txt, in_a_equation, in_a_options)
1866 local
1867 Tpl.Text txt;
1868 SCodeDump.SCodeDumpOptions a_options;
1869 Absyn.Exp i_exp;
1870 Absyn.Exp i_expReinit;
1871 Absyn.Exp i_cref;
1872 Absyn.Exp i_level;
1873 Absyn.Exp i_message;
1874 Absyn.Exp i_condition;
1875 Absyn.ComponentRef i_crefRight;
1876 Absyn.ComponentRef i_crefLeft;
1877 SCode.Comment i_comment;
1878 Absyn.Exp i_expRight;
1879 Absyn.Exp i_expLeft;
1880 SCode.Equation i_equation;
1881 Tpl.Text l_exp__str;
1882 Tpl.Text l_cref__str;
1883 Tpl.Text l_lvl__str;
1884 Tpl.Text l_msg__str;
1885 Tpl.Text l_cond__str;
1886 Tpl.Text l_cmt__str;
1887 Tpl.Text l_rhs__str;
1888 Tpl.Text l_lhs__str;
1889
1890 case ( txt,
1891 (i_equation as SCode.EQ_IF(condition = _)),
1892 a_options )
1893 algorithm
1894 43 txt := dumpIfEquation(txt, i_equation, a_options);
1895 then txt;
1896
1897 case ( txt,
1898 SCode.EQ_EQUALS(expLeft = i_expLeft, expRight = i_expRight, comment = i_comment),
1899 a_options )
1900 algorithm
1901 264 l_lhs__str := AbsynDumpTpl.dumpLhsExp(Tpl.emptyTxt, i_expLeft);
1902 264 l_rhs__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_expRight);
1903 264 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1904 264 txt := Tpl.writeText(txt, l_lhs__str);
1905 264 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
1906 264 txt := Tpl.writeText(txt, l_rhs__str);
1907 264 txt := Tpl.writeText(txt, l_cmt__str);
1908 264 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
1909 then txt;
1910
1911 case ( txt,
1912 SCode.EQ_CONNECT(crefLeft = i_crefLeft, crefRight = i_crefRight, comment = i_comment),
1913 a_options )
1914 algorithm
1915 14 l_lhs__str := AbsynDumpTpl.dumpCref(Tpl.emptyTxt, i_crefLeft);
1916 14 l_rhs__str := AbsynDumpTpl.dumpCref(Tpl.emptyTxt, i_crefRight);
1917 14 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1918 14 txt := Tpl.writeTok(txt, Tpl.ST_STRING("connect("));
1919 14 txt := Tpl.writeText(txt, l_lhs__str);
1920 14 txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
1921 14 txt := Tpl.writeText(txt, l_rhs__str);
1922 14 txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1923 14 txt := Tpl.writeText(txt, l_cmt__str);
1924 14 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
1925 then txt;
1926
1927 case ( txt,
1928 (i_equation as SCode.EQ_FOR(index = _)),
1929 a_options )
1930 algorithm
1931 18 txt := dumpForEquation(txt, i_equation, a_options);
1932 then txt;
1933
1934 case ( txt,
1935 (i_equation as SCode.EQ_WHEN(condition = _)),
1936 a_options )
1937 algorithm
1938 ✗ txt := dumpWhenEquation(txt, i_equation, a_options);
1939 then txt;
1940
1941 case ( txt,
1942 SCode.EQ_ASSERT(condition = i_condition, message = i_message, level = i_level, comment = i_comment),
1943 a_options )
1944 algorithm
1945 12 l_cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_condition);
1946 12 l_msg__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_message);
1947 12 l_lvl__str := dumpAssertionLevel(Tpl.emptyTxt, i_level);
1948 12 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1949 12 txt := Tpl.writeTok(txt, Tpl.ST_STRING("assert("));
1950 12 txt := Tpl.writeText(txt, l_cond__str);
1951 12 txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
1952 12 txt := Tpl.writeText(txt, l_msg__str);
1953 12 txt := Tpl.writeText(txt, l_lvl__str);
1954 12 txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1955 12 txt := Tpl.writeText(txt, l_cmt__str);
1956 12 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
1957 then txt;
1958
1959 case ( txt,
1960 SCode.EQ_TERMINATE(message = i_message, comment = i_comment),
1961 a_options )
1962 algorithm
1963 ✗ l_msg__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_message);
1964 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1965 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("terminate("));
1966 ✗ txt := Tpl.writeText(txt, l_msg__str);
1967 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1968 ✗ txt := Tpl.writeText(txt, l_cmt__str);
1969 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
1970 then txt;
1971
1972 case ( txt,
1973 SCode.EQ_REINIT(cref = i_cref, expReinit = i_expReinit, comment = i_comment),
1974 a_options )
1975 algorithm
1976 ✗ l_cref__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_cref);
1977 ✗ l_exp__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_expReinit);
1978 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1979 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("reinit("));
1980 ✗ txt := Tpl.writeText(txt, l_cref__str);
1981 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
1982 ✗ txt := Tpl.writeText(txt, l_exp__str);
1983 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
1984 ✗ txt := Tpl.writeText(txt, l_cmt__str);
1985 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
1986 then txt;
1987
1988 case ( txt,
1989 SCode.EQ_NORETCALL(exp = i_exp, comment = i_comment),
1990 a_options )
1991 algorithm
1992 2 l_exp__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_exp);
1993 2 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
1994 2 txt := Tpl.writeText(txt, l_exp__str);
1995 2 txt := Tpl.writeText(txt, l_cmt__str);
1996 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
1997 then txt;
1998
1999 case ( txt,
2000 _,
2001 _ )
2002 algorithm
2003 ✗ txt := errorMsg(txt, "SCodeDump.dumpEquation: Unknown Equation.");
2004 then txt;
2005 end match;
2006 end dumpEquation;
2007
2008 protected function lm_65
2009 input output Tpl.Text txt;
2010 input list<SCode.Equation> items;
2011 input SCodeDump.SCodeDumpOptions a_options;
2012 algorithm
2013
2/2
✓ Branch 0 taken 73 times.
✓ Branch 1 taken 43 times.
116 for lstElt_65 in items loop
2014 txt := match lstElt_65
2015 local
2016 SCode.Equation i_e;
2017
2018 case i_e
2019 algorithm
2020 73 txt := dumpEquation(txt, i_e, a_options);
2021 73 txt := Tpl.nextIter(txt);
2022 then txt;
2023 end match;
2024 end for;
2025 end lm_65;
2026
2027 protected function lm_66
2028 input output Tpl.Text txt;
2029 input list<SCode.Equation> items;
2030 input SCodeDump.SCodeDumpOptions a_options;
2031 algorithm
2032
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 28 times.
64 for lstElt_66 in items loop
2033 txt := match lstElt_66
2034 local
2035 SCode.Equation i_e;
2036
2037 case i_e
2038 algorithm
2039 36 txt := dumpEquation(txt, i_e, a_options);
2040 36 txt := Tpl.nextIter(txt);
2041 then txt;
2042 end match;
2043 end for;
2044 end lm_66;
2045
2046 protected function fun_67
2047 input Tpl.Text in_txt;
2048 input list<SCode.Equation> in_a_elseBranch;
2049 input SCodeDump.SCodeDumpOptions in_a_options;
2050
2051 output Tpl.Text out_txt;
2052 algorithm
2053 out_txt :=
2054 match(in_txt, in_a_elseBranch, in_a_options)
2055 local
2056 Tpl.Text txt;
2057 SCodeDump.SCodeDumpOptions a_options;
2058 list<SCode.Equation> i_elseBranch;
2059
2060 case ( txt,
2061 {},
2062 _ )
2063 then txt;
2064
2065 case ( txt,
2066 i_elseBranch,
2067 a_options )
2068 algorithm
2069 28 txt := Tpl.writeTok(txt, Tpl.ST_LINE("else\n"));
2070 28 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2071 28 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2072 28 txt := lm_66(txt, i_elseBranch, a_options);
2073 28 txt := Tpl.popIter(txt);
2074 28 txt := Tpl.popBlock(txt);
2075 then txt;
2076 end match;
2077 end fun_67;
2078
2079 public function dumpIfEquation
2080 input Tpl.Text in_txt;
2081 input SCode.Equation in_a_ifequation;
2082 input SCodeDump.SCodeDumpOptions in_a_options;
2083
2084 output Tpl.Text out_txt;
2085 algorithm
2086 out_txt :=
2087 match(in_txt, in_a_ifequation, in_a_options)
2088 local
2089 Tpl.Text txt;
2090 SCodeDump.SCodeDumpOptions a_options;
2091 SCode.Comment i_comment;
2092 list<SCode.Equation> i_elseBranch;
2093 list<list<SCode.Equation>> i_elseif__branches;
2094 list<Absyn.Exp> i_elseif__conds;
2095 list<SCode.Equation> i_if__branch;
2096 Absyn.Exp i_if__cond;
2097 Tpl.Text l_cmt__str;
2098 Tpl.Text l_else__str;
2099 Tpl.Text l_elseif__str;
2100 Tpl.Text l_if__branch__str;
2101 Tpl.Text l_if__cond__str;
2102
2103 case ( txt,
2104 SCode.EQ_IF(condition = i_if__cond :: i_elseif__conds, thenBranch = i_if__branch :: i_elseif__branches, elseBranch = i_elseBranch, comment = i_comment),
2105 a_options )
2106 algorithm
2107 43 l_if__cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_if__cond);
2108 43 l_if__branch__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2109 43 l_if__branch__str := lm_65(l_if__branch__str, i_if__branch, a_options);
2110 43 l_if__branch__str := Tpl.popIter(l_if__branch__str);
2111 43 l_elseif__str := dumpElseIfEquation(Tpl.emptyTxt, i_elseif__conds, i_elseif__branches, a_options);
2112 43 l_else__str := fun_67(Tpl.emptyTxt, i_elseBranch, a_options);
2113 43 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2114 43 txt := Tpl.writeTok(txt, Tpl.ST_STRING("if "));
2115 43 txt := Tpl.writeText(txt, l_if__cond__str);
2116 43 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
2117 43 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2118 43 txt := Tpl.writeText(txt, l_if__branch__str);
2119 43 txt := Tpl.softNewLine(txt);
2120 43 txt := Tpl.popBlock(txt);
2121 43 txt := Tpl.writeText(txt, l_elseif__str);
2122 43 txt := Tpl.softNewLine(txt);
2123 43 txt := Tpl.writeText(txt, l_else__str);
2124 43 txt := Tpl.softNewLine(txt);
2125 43 txt := Tpl.writeTok(txt, Tpl.ST_STRING("end if"));
2126 43 txt := Tpl.writeText(txt, l_cmt__str);
2127 43 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2128 then txt;
2129
2130 case ( txt,
2131 _,
2132 _ )
2133 then txt;
2134 end match;
2135 end dumpIfEquation;
2136
2137 protected function lm_69
2138 input output Tpl.Text txt;
2139 input list<SCode.Equation> items;
2140 input SCodeDump.SCodeDumpOptions a_options;
2141 algorithm
2142
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 19 times.
89 for lstElt_69 in items loop
2143 txt := match lstElt_69
2144 local
2145 SCode.Equation i_e;
2146
2147 case i_e
2148 algorithm
2149 70 txt := dumpEquation(txt, i_e, a_options);
2150 70 txt := Tpl.nextIter(txt);
2151 then txt;
2152 end match;
2153 end for;
2154 end lm_69;
2155
2156 protected function fun_70
2157 input Tpl.Text in_txt;
2158 input list<list<SCode.Equation>> in_a_branches;
2159 input list<Absyn.Exp> in_a_rest__conds;
2160 input SCodeDump.SCodeDumpOptions in_a_options;
2161 input Absyn.Exp in_a_cond;
2162
2163 output Tpl.Text out_txt;
2164 algorithm
2165 out_txt :=
2166 match(in_txt, in_a_branches, in_a_rest__conds, in_a_options, in_a_cond)
2167 local
2168 Tpl.Text txt;
2169 list<Absyn.Exp> a_rest__conds;
2170 SCodeDump.SCodeDumpOptions a_options;
2171 Absyn.Exp a_cond;
2172 list<list<SCode.Equation>> i_rest__branches;
2173 list<SCode.Equation> i_branch;
2174 Tpl.Text l_rest__str;
2175 Tpl.Text l_branch__str;
2176 Tpl.Text l_cond__str;
2177
2178 case ( txt,
2179 i_branch :: i_rest__branches,
2180 a_rest__conds,
2181 a_options,
2182 a_cond )
2183 algorithm
2184 19 l_cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, a_cond);
2185 19 l_branch__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2186 19 l_branch__str := lm_69(l_branch__str, i_branch, a_options);
2187 19 l_branch__str := Tpl.popIter(l_branch__str);
2188 19 l_rest__str := dumpElseIfEquation(Tpl.emptyTxt, a_rest__conds, i_rest__branches, a_options);
2189 19 txt := Tpl.writeTok(txt, Tpl.ST_STRING("elseif "));
2190 19 txt := Tpl.writeText(txt, l_cond__str);
2191 19 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
2192 19 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2193 19 txt := Tpl.writeText(txt, l_branch__str);
2194 19 txt := Tpl.softNewLine(txt);
2195 19 txt := Tpl.popBlock(txt);
2196 19 txt := Tpl.writeText(txt, l_rest__str);
2197 then txt;
2198
2199 case ( txt,
2200 _,
2201 _,
2202 _,
2203 _ )
2204 then txt;
2205 end match;
2206 end fun_70;
2207
2208 public function dumpElseIfEquation
2209 input Tpl.Text in_txt;
2210 input list<Absyn.Exp> in_a_condition;
2211 input list<list<SCode.Equation>> in_a_branches;
2212 input SCodeDump.SCodeDumpOptions in_a_options;
2213
2214 output Tpl.Text out_txt;
2215 algorithm
2216 out_txt :=
2217 match(in_txt, in_a_condition, in_a_branches, in_a_options)
2218 local
2219 Tpl.Text txt;
2220 list<list<SCode.Equation>> a_branches;
2221 SCodeDump.SCodeDumpOptions a_options;
2222 list<Absyn.Exp> i_rest__conds;
2223 Absyn.Exp i_cond;
2224
2225 case ( txt,
2226 i_cond :: i_rest__conds,
2227 a_branches,
2228 a_options )
2229 algorithm
2230 19 txt := fun_70(txt, a_branches, i_rest__conds, a_options, i_cond);
2231 then txt;
2232
2233 case ( txt,
2234 _,
2235 _,
2236 _ )
2237 then txt;
2238 end match;
2239 end dumpElseIfEquation;
2240
2241 protected function lm_72
2242 input output Tpl.Text txt;
2243 input list<SCode.Equation> items;
2244 input SCodeDump.SCodeDumpOptions a_options;
2245 algorithm
2246
2/2
✓ Branch 0 taken 35 times.
✓ Branch 1 taken 18 times.
53 for lstElt_72 in items loop
2247 txt := match lstElt_72
2248 local
2249 SCode.Equation i_e;
2250
2251 case i_e
2252 algorithm
2253 35 txt := dumpEquation(txt, i_e, a_options);
2254 35 txt := Tpl.nextIter(txt);
2255 then txt;
2256 end match;
2257 end for;
2258 end lm_72;
2259
2260 protected function lm_73
2261 input output Tpl.Text txt;
2262 input list<SCode.Equation> items;
2263 input SCodeDump.SCodeDumpOptions a_options;
2264 algorithm
2265 ✗ for lstElt_73 in items loop
2266 txt := match lstElt_73
2267 local
2268 SCode.Equation i_e;
2269
2270 case i_e
2271 algorithm
2272 ✗ txt := dumpEquation(txt, i_e, a_options);
2273 ✗ txt := Tpl.nextIter(txt);
2274 then txt;
2275 end match;
2276 end for;
2277 end lm_73;
2278
2279 public function dumpForEquation
2280 input Tpl.Text in_txt;
2281 input SCode.Equation in_a_for__equation;
2282 input SCodeDump.SCodeDumpOptions in_a_options;
2283
2284 output Tpl.Text out_txt;
2285 algorithm
2286 out_txt :=
2287 match(in_txt, in_a_for__equation, in_a_options)
2288 local
2289 Tpl.Text txt;
2290 SCodeDump.SCodeDumpOptions a_options;
2291 SCode.Ident i_index;
2292 SCode.Comment i_comment;
2293 list<SCode.Equation> i_eEquationLst;
2294 Absyn.Exp i_range;
2295 Tpl.Text l_cmt__str;
2296 Tpl.Text l_eq__str;
2297 Tpl.Text l_range__str;
2298
2299 case ( txt,
2300 SCode.EQ_FOR(range = SOME(i_range), eEquationLst = i_eEquationLst, comment = i_comment, index = i_index),
2301 a_options )
2302 algorithm
2303 18 l_range__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_range);
2304 18 l_eq__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2305 18 l_eq__str := lm_72(l_eq__str, i_eEquationLst, a_options);
2306 18 l_eq__str := Tpl.popIter(l_eq__str);
2307 18 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2308 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("for "));
2309 18 txt := Tpl.writeStr(txt, i_index);
2310 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" in "));
2311 18 txt := Tpl.writeText(txt, l_range__str);
2312 18 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" loop\n"));
2313 18 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2314 18 txt := Tpl.writeText(txt, l_eq__str);
2315 18 txt := Tpl.softNewLine(txt);
2316 18 txt := Tpl.popBlock(txt);
2317 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("end for"));
2318 18 txt := Tpl.writeText(txt, l_cmt__str);
2319 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2320 then txt;
2321
2322 case ( txt,
2323 SCode.EQ_FOR(eEquationLst = i_eEquationLst, comment = i_comment, index = i_index),
2324 a_options )
2325 algorithm
2326 ✗ l_eq__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2327 ✗ l_eq__str := lm_73(l_eq__str, i_eEquationLst, a_options);
2328 ✗ l_eq__str := Tpl.popIter(l_eq__str);
2329 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2330 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("for "));
2331 ✗ txt := Tpl.writeStr(txt, i_index);
2332 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" loop\n"));
2333 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2334 ✗ txt := Tpl.writeText(txt, l_eq__str);
2335 ✗ txt := Tpl.softNewLine(txt);
2336 ✗ txt := Tpl.popBlock(txt);
2337 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("end for"));
2338 ✗ txt := Tpl.writeText(txt, l_cmt__str);
2339 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2340 then txt;
2341
2342 case ( txt,
2343 _,
2344 _ )
2345 then txt;
2346 end match;
2347 end dumpForEquation;
2348
2349 protected function lm_75
2350 input output Tpl.Text txt;
2351 input list<SCode.Equation> items;
2352 input SCodeDump.SCodeDumpOptions a_options;
2353 algorithm
2354 ✗ for lstElt_75 in items loop
2355 txt := match lstElt_75
2356 local
2357 SCode.Equation i_e;
2358
2359 case i_e
2360 algorithm
2361 ✗ txt := dumpEquation(txt, i_e, a_options);
2362 ✗ txt := Tpl.nextIter(txt);
2363 then txt;
2364 end match;
2365 end for;
2366 end lm_75;
2367
2368 protected function lm_76
2369 input output Tpl.Text txt;
2370 input list<SCode.Equation> items;
2371 input SCodeDump.SCodeDumpOptions a_options;
2372 algorithm
2373 ✗ for lstElt_76 in items loop
2374 txt := match lstElt_76
2375 local
2376 SCode.Equation i_e;
2377
2378 case i_e
2379 algorithm
2380 ✗ txt := dumpEquation(txt, i_e, a_options);
2381 ✗ txt := Tpl.nextIter(txt);
2382 then txt;
2383 end match;
2384 end for;
2385 end lm_76;
2386
2387 protected function lm_77
2388 input output Tpl.Text txt;
2389 input list<tuple<Absyn.Exp, list<SCode.Equation>>> items;
2390 input SCodeDump.SCodeDumpOptions a_options;
2391 algorithm
2392 ✗ for lstElt_77 in items loop
2393 txt := match lstElt_77
2394 local
2395 list<SCode.Equation> i_else__body;
2396 Absyn.Exp i_else__cond;
2397 Tpl.Text l_else__body__str;
2398 Tpl.Text l_else__cond__str;
2399
2400 case (i_else__cond, i_else__body)
2401 algorithm
2402 ✗ l_else__cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_else__cond);
2403 ✗ l_else__body__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2404 ✗ l_else__body__str := lm_76(l_else__body__str, i_else__body, a_options);
2405 ✗ l_else__body__str := Tpl.popIter(l_else__body__str);
2406 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("elsewhen "));
2407 ✗ txt := Tpl.writeText(txt, l_else__cond__str);
2408 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
2409 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2410 ✗ txt := Tpl.writeText(txt, l_else__body__str);
2411 ✗ txt := Tpl.popBlock(txt);
2412 ✗ txt := Tpl.nextIter(txt);
2413 then txt;
2414 end match;
2415 end for;
2416 end lm_77;
2417
2418 public function dumpWhenEquation
2419 input Tpl.Text in_txt;
2420 input SCode.Equation in_a_when__equation;
2421 input SCodeDump.SCodeDumpOptions in_a_options;
2422
2423 output Tpl.Text out_txt;
2424 algorithm
2425 out_txt :=
2426 match(in_txt, in_a_when__equation, in_a_options)
2427 local
2428 Tpl.Text txt;
2429 SCodeDump.SCodeDumpOptions a_options;
2430 SCode.Comment i_comment;
2431 list<tuple<Absyn.Exp, list<SCode.Equation>>> i_elseBranches;
2432 list<SCode.Equation> i_eEquationLst;
2433 Absyn.Exp i_condition;
2434 Tpl.Text l_cmt__str;
2435 Tpl.Text l_else__str;
2436 Tpl.Text l_body__str;
2437 Tpl.Text l_cond__str;
2438
2439 case ( txt,
2440 SCode.EQ_WHEN(condition = i_condition, eEquationLst = i_eEquationLst, elseBranches = i_elseBranches, comment = i_comment),
2441 a_options )
2442 algorithm
2443 ✗ l_cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_condition);
2444 ✗ l_body__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2445 ✗ l_body__str := lm_75(l_body__str, i_eEquationLst, a_options);
2446 ✗ l_body__str := Tpl.popIter(l_body__str);
2447 ✗ l_else__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2448 ✗ l_else__str := lm_77(l_else__str, i_elseBranches, a_options);
2449 ✗ l_else__str := Tpl.popIter(l_else__str);
2450 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2451 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("when "));
2452 ✗ txt := Tpl.writeText(txt, l_cond__str);
2453 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
2454 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2455 ✗ txt := Tpl.writeText(txt, l_body__str);
2456 ✗ txt := Tpl.softNewLine(txt);
2457 ✗ txt := Tpl.popBlock(txt);
2458 ✗ txt := Tpl.writeText(txt, l_else__str);
2459 ✗ txt := Tpl.softNewLine(txt);
2460 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("end when"));
2461 ✗ txt := Tpl.writeText(txt, l_cmt__str);
2462 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2463 then txt;
2464
2465 case ( txt,
2466 _,
2467 _ )
2468 then txt;
2469 end match;
2470 end dumpWhenEquation;
2471
2472 public function dumpAssertionLevel
2473 input Tpl.Text in_txt;
2474 input Absyn.Exp in_a_exp;
2475
2476 output Tpl.Text out_txt;
2477 algorithm
2478 out_txt :=
2479 match(in_txt, in_a_exp)
2480 local
2481 Tpl.Text txt;
2482 Absyn.Exp i_exp;
2483
2484 case ( txt,
2485 Absyn.CREF(componentRef = Absyn.CREF_FULLYQUALIFIED(componentRef = Absyn.CREF_QUAL(name = "AssertionLevel", componentRef = Absyn.CREF_IDENT(name = "error")))) )
2486 then txt;
2487
2488 case ( txt,
2489 Absyn.CREF(componentRef = Absyn.CREF_QUAL(name = "AssertionLevel", componentRef = Absyn.CREF_IDENT(name = "error"))) )
2490 then txt;
2491
2492 case ( txt,
2493 i_exp )
2494 algorithm
2495 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
2496 ✗ txt := AbsynDumpTpl.dumpExp(txt, i_exp);
2497 then txt;
2498 end match;
2499 end dumpAssertionLevel;
2500
2501 protected function lm_80
2502 input output Tpl.Text txt;
2503 input list<SCode.AlgorithmSection> items;
2504 input SCodeDump.SCodeDumpOptions a_options;
2505 algorithm
2506
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 70 times.
140 for lstElt_80 in items loop
2507 txt := match lstElt_80
2508 local
2509 SCode.AlgorithmSection i_al;
2510
2511 case i_al
2512 algorithm
2513 70 txt := dumpAlgorithmSection(txt, i_al, a_options);
2514 70 txt := Tpl.nextIter(txt);
2515 then txt;
2516 end match;
2517 end for;
2518 end lm_80;
2519
2520 public function dumpAlgorithmSections
2521 input Tpl.Text in_txt;
2522 input list<SCode.AlgorithmSection> in_a_algorithms;
2523 input String in_a_label;
2524 input SCodeDump.SCodeDumpOptions in_a_options;
2525
2526 output Tpl.Text out_txt;
2527 algorithm
2528 out_txt :=
2529 match(in_txt, in_a_algorithms, in_a_label, in_a_options)
2530 local
2531 Tpl.Text txt;
2532 String a_label;
2533 SCodeDump.SCodeDumpOptions a_options;
2534 list<SCode.AlgorithmSection> i_algorithms;
2535
2536 case ( txt,
2537 {},
2538 _,
2539 _ )
2540 then txt;
2541
2542 case ( txt,
2543 i_algorithms,
2544 a_label,
2545 a_options )
2546 algorithm
2547 70 txt := Tpl.writeStr(txt, a_label);
2548 70 txt := Tpl.softNewLine(txt);
2549 70 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2550 70 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2551 70 txt := lm_80(txt, i_algorithms, a_options);
2552 70 txt := Tpl.popIter(txt);
2553 70 txt := Tpl.popBlock(txt);
2554 then txt;
2555 end match;
2556 end dumpAlgorithmSections;
2557
2558 public function dumpAlgorithmSection
2559 input Tpl.Text in_txt;
2560 input SCode.AlgorithmSection in_a_algorithm;
2561 input SCodeDump.SCodeDumpOptions in_a_options;
2562
2563 output Tpl.Text out_txt;
2564 algorithm
2565 out_txt :=
2566 match(in_txt, in_a_algorithm, in_a_options)
2567 local
2568 Tpl.Text txt;
2569 SCodeDump.SCodeDumpOptions a_options;
2570 list<SCode.Statement> i_statements;
2571
2572 case ( txt,
2573 SCode.ALGORITHM(statements = i_statements),
2574 a_options )
2575 algorithm
2576 70 txt := dumpStatements(txt, i_statements, a_options);
2577 then txt;
2578
2579 case ( txt,
2580 _,
2581 _ )
2582 then txt;
2583 end match;
2584 end dumpAlgorithmSection;
2585
2586 protected function lm_83
2587 input output Tpl.Text txt;
2588 input list<SCode.Statement> items;
2589 input SCodeDump.SCodeDumpOptions a_options;
2590 algorithm
2591
2/2
✓ Branch 0 taken 302 times.
✓ Branch 1 taken 155 times.
457 for lstElt_83 in items loop
2592 txt := match lstElt_83
2593 local
2594 SCode.Statement i_s;
2595
2596 case i_s
2597 algorithm
2598 302 txt := dumpStatement(txt, i_s, a_options);
2599 302 txt := Tpl.nextIter(txt);
2600 then txt;
2601 end match;
2602 end for;
2603 end lm_83;
2604
2605 public function dumpStatements
2606 input Tpl.Text txt;
2607 input list<SCode.Statement> a_statements;
2608 input SCodeDump.SCodeDumpOptions a_options;
2609
2610 output Tpl.Text out_txt;
2611 algorithm
2612 155 out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2613 155 out_txt := lm_83(out_txt, a_statements, a_options);
2614 155 out_txt := Tpl.popIter(out_txt);
2615 end dumpStatements;
2616
2617 public function dumpStatement
2618 input Tpl.Text in_txt;
2619 input SCode.Statement in_a_statement;
2620 input SCodeDump.SCodeDumpOptions in_a_options;
2621
2622 output Tpl.Text out_txt;
2623 algorithm
2624 out_txt :=
2625 match(in_txt, in_a_statement, in_a_options)
2626 local
2627 Tpl.Text txt;
2628 SCodeDump.SCodeDumpOptions a_options;
2629 SCode.Statement i_stmt;
2630 Absyn.Exp i_exp;
2631 Absyn.Exp i_newValue;
2632 Absyn.Exp i_cref;
2633 Absyn.Exp i_level;
2634 Absyn.Exp i_message;
2635 Absyn.Exp i_condition;
2636 SCode.Statement i_statement;
2637 SCode.Comment i_comment;
2638 Absyn.Exp i_value;
2639 Absyn.Exp i_assignComponent;
2640 Tpl.Text l_exp__str;
2641 Tpl.Text l_cr__str;
2642 Tpl.Text l_lvl__str;
2643 Tpl.Text l_msg__str;
2644 Tpl.Text l_cond__str;
2645 Tpl.Text l_cmt__str;
2646 Tpl.Text l_rhs__str;
2647 Tpl.Text l_lhs__str;
2648
2649 case ( txt,
2650 SCode.ALG_ASSIGN(assignComponent = i_assignComponent, value = i_value, comment = i_comment),
2651 a_options )
2652 algorithm
2653 255 l_lhs__str := AbsynDumpTpl.dumpLhsExp(Tpl.emptyTxt, i_assignComponent);
2654 255 l_rhs__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_value);
2655 255 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2656 255 txt := Tpl.writeText(txt, l_lhs__str);
2657 255 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" := "));
2658 255 txt := Tpl.writeText(txt, l_rhs__str);
2659 255 txt := Tpl.writeText(txt, l_cmt__str);
2660 255 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2661 then txt;
2662
2663 case ( txt,
2664 (i_statement as SCode.ALG_IF(boolExpr = _)),
2665 a_options )
2666 algorithm
2667 35 txt := dumpIfStatement(txt, i_statement, a_options);
2668 then txt;
2669
2670 case ( txt,
2671 (i_statement as SCode.ALG_FOR(index = _)),
2672 a_options )
2673 algorithm
2674 4 txt := dumpForStatement(txt, i_statement, a_options);
2675 then txt;
2676
2677 case ( txt,
2678 (i_statement as SCode.ALG_WHILE(boolExpr = _)),
2679 a_options )
2680 algorithm
2681 1 txt := dumpWhileStatement(txt, i_statement, a_options);
2682 then txt;
2683
2684 case ( txt,
2685 (i_statement as SCode.ALG_WHEN_A(branches = _)),
2686 a_options )
2687 algorithm
2688 ✗ txt := dumpWhenStatement(txt, i_statement, a_options);
2689 then txt;
2690
2691 case ( txt,
2692 SCode.ALG_ASSERT(condition = i_condition, message = i_message, level = i_level),
2693 _ )
2694 algorithm
2695 5 l_cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_condition);
2696 5 l_msg__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_message);
2697 5 l_lvl__str := dumpAssertionLevel(Tpl.emptyTxt, i_level);
2698 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("assert("));
2699 5 txt := Tpl.writeText(txt, l_cond__str);
2700 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
2701 5 txt := Tpl.writeText(txt, l_msg__str);
2702 5 txt := Tpl.writeText(txt, l_lvl__str);
2703 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING(");"));
2704 then txt;
2705
2706 case ( txt,
2707 SCode.ALG_TERMINATE(message = i_message),
2708 _ )
2709 algorithm
2710 ✗ l_msg__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_message);
2711 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("terminate("));
2712 ✗ txt := Tpl.writeText(txt, l_msg__str);
2713 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(");"));
2714 then txt;
2715
2716 case ( txt,
2717 SCode.ALG_REINIT(cref = i_cref, newValue = i_newValue),
2718 _ )
2719 algorithm
2720 ✗ l_cr__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_cref);
2721 ✗ l_exp__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_newValue);
2722 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("reinit("));
2723 ✗ txt := Tpl.writeText(txt, l_cr__str);
2724 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
2725 ✗ txt := Tpl.writeText(txt, l_exp__str);
2726 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(");"));
2727 then txt;
2728
2729 case ( txt,
2730 SCode.ALG_NORETCALL(exp = i_exp, comment = i_comment),
2731 a_options )
2732 algorithm
2733 2 l_exp__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_exp);
2734 2 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2735 2 txt := Tpl.writeText(txt, l_exp__str);
2736 2 txt := Tpl.writeText(txt, l_cmt__str);
2737 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2738 then txt;
2739
2740 case ( txt,
2741 SCode.ALG_RETURN(comment = i_comment),
2742 a_options )
2743 algorithm
2744 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2745 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("return"));
2746 ✗ txt := Tpl.writeText(txt, l_cmt__str);
2747 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2748 then txt;
2749
2750 case ( txt,
2751 SCode.ALG_BREAK(comment = i_comment),
2752 a_options )
2753 algorithm
2754 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2755 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("break"));
2756 ✗ txt := Tpl.writeText(txt, l_cmt__str);
2757 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2758 then txt;
2759
2760 case ( txt,
2761 SCode.ALG_FAILURE(stmts = {i_stmt}, comment = i_comment),
2762 a_options )
2763 algorithm
2764 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2765 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("failure("));
2766 ✗ txt := dumpStatement(txt, i_stmt, a_options);
2767 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
2768 ✗ txt := Tpl.writeText(txt, l_cmt__str);
2769 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2770 then txt;
2771
2772 case ( txt,
2773 (i_statement as SCode.ALG_TRY(body = _)),
2774 a_options )
2775 algorithm
2776 ✗ txt := dumpTryStatement(txt, i_statement, a_options);
2777 then txt;
2778
2779 case ( txt,
2780 SCode.ALG_CONTINUE(comment = i_comment),
2781 a_options )
2782 algorithm
2783 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2784 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("continue"));
2785 ✗ txt := Tpl.writeText(txt, l_cmt__str);
2786 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2787 then txt;
2788
2789 case ( txt,
2790 _,
2791 _ )
2792 algorithm
2793 ✗ txt := errorMsg(txt, "SCodeDump.dumpStatement: Unknown statement.");
2794 then txt;
2795 end match;
2796 end dumpStatement;
2797
2798 public function dumpIfStatement
2799 input Tpl.Text in_txt;
2800 input SCode.Statement in_a_if__statement;
2801 input SCodeDump.SCodeDumpOptions in_a_options;
2802
2803 output Tpl.Text out_txt;
2804 algorithm
2805 out_txt :=
2806 match(in_txt, in_a_if__statement, in_a_options)
2807 local
2808 Tpl.Text txt;
2809 SCodeDump.SCodeDumpOptions a_options;
2810 SCode.Comment i_comment;
2811 list<SCode.Statement> i_elseBranch;
2812 list<tuple<Absyn.Exp, list<SCode.Statement>>> i_elseIfBranch;
2813 list<SCode.Statement> i_trueBranch;
2814 Absyn.Exp i_boolExpr;
2815 Tpl.Text l_cmt__str;
2816 Tpl.Text l_else__branch__str;
2817 Tpl.Text l_else__if__str;
2818 Tpl.Text l_true__branch__str;
2819 Tpl.Text l_cond__str;
2820
2821 case ( txt,
2822 SCode.ALG_IF(boolExpr = i_boolExpr, trueBranch = i_trueBranch, elseIfBranch = i_elseIfBranch, elseBranch = i_elseBranch, comment = i_comment),
2823 a_options )
2824 algorithm
2825 35 l_cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_boolExpr);
2826 35 l_true__branch__str := dumpStatements(Tpl.emptyTxt, i_trueBranch, a_options);
2827 35 l_else__if__str := dumpElseIfStatements(Tpl.emptyTxt, i_elseIfBranch, a_options);
2828 35 l_else__branch__str := dumpStatements(Tpl.emptyTxt, i_elseBranch, a_options);
2829 35 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2830 35 txt := Tpl.writeTok(txt, Tpl.ST_STRING("if "));
2831 35 txt := Tpl.writeText(txt, l_cond__str);
2832 35 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
2833 35 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2834 35 txt := Tpl.writeText(txt, l_true__branch__str);
2835 35 txt := Tpl.softNewLine(txt);
2836 35 txt := Tpl.popBlock(txt);
2837 35 txt := Tpl.writeText(txt, l_else__if__str);
2838 35 txt := Tpl.softNewLine(txt);
2839 35 txt := Tpl.writeTok(txt, Tpl.ST_LINE("else\n"));
2840 35 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2841 35 txt := Tpl.writeText(txt, l_else__branch__str);
2842 35 txt := Tpl.softNewLine(txt);
2843 35 txt := Tpl.popBlock(txt);
2844 35 txt := Tpl.writeTok(txt, Tpl.ST_STRING("end if"));
2845 35 txt := Tpl.writeText(txt, l_cmt__str);
2846 35 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2847 then txt;
2848
2849 case ( txt,
2850 _,
2851 _ )
2852 then txt;
2853 end match;
2854 end dumpIfStatement;
2855
2856 protected function lm_87
2857 input output Tpl.Text txt;
2858 input list<tuple<Absyn.Exp, list<SCode.Statement>>> items;
2859 input SCodeDump.SCodeDumpOptions a_options;
2860 algorithm
2861
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 35 times.
45 for lstElt_87 in items loop
2862 txt := match lstElt_87
2863 local
2864 list<SCode.Statement> i_body;
2865 Absyn.Exp i_cond;
2866 Tpl.Text l_body__str;
2867 Tpl.Text l_cond__str;
2868
2869 case (i_cond, i_body)
2870 algorithm
2871 10 l_cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_cond);
2872 10 l_body__str := dumpStatements(Tpl.emptyTxt, i_body, a_options);
2873 10 txt := Tpl.writeTok(txt, Tpl.ST_STRING("elseif "));
2874 10 txt := Tpl.writeText(txt, l_cond__str);
2875 10 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
2876 10 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2877 10 txt := Tpl.writeText(txt, l_body__str);
2878 10 txt := Tpl.popBlock(txt);
2879 10 txt := Tpl.nextIter(txt);
2880 then txt;
2881 end match;
2882 end for;
2883 end lm_87;
2884
2885 public function dumpElseIfStatements
2886 input Tpl.Text txt;
2887 input list<tuple<Absyn.Exp, list<SCode.Statement>>> a_else__if;
2888 input SCodeDump.SCodeDumpOptions a_options;
2889
2890 output Tpl.Text out_txt;
2891 algorithm
2892 35 out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2893 35 out_txt := lm_87(out_txt, a_else__if, a_options);
2894 35 out_txt := Tpl.popIter(out_txt);
2895 end dumpElseIfStatements;
2896
2897 public function dumpForStatement
2898 input Tpl.Text in_txt;
2899 input SCode.Statement in_a_for__statement;
2900 input SCodeDump.SCodeDumpOptions in_a_options;
2901
2902 output Tpl.Text out_txt;
2903 algorithm
2904 out_txt :=
2905 match(in_txt, in_a_for__statement, in_a_options)
2906 local
2907 Tpl.Text txt;
2908 SCodeDump.SCodeDumpOptions a_options;
2909 String i_index;
2910 SCode.Comment i_comment;
2911 list<SCode.Statement> i_forBody;
2912 Absyn.Exp i_e;
2913 Tpl.Text l_cmt__str;
2914 Tpl.Text l_body__str;
2915 Tpl.Text l_range__str;
2916
2917 case ( txt,
2918 SCode.ALG_FOR(range = SOME(i_e), forBody = i_forBody, comment = i_comment, index = i_index),
2919 a_options )
2920 algorithm
2921 4 l_range__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_e);
2922 4 l_body__str := dumpStatements(Tpl.emptyTxt, i_forBody, a_options);
2923 4 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2924 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("for "));
2925 4 txt := Tpl.writeStr(txt, i_index);
2926 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" in "));
2927 4 txt := Tpl.writeText(txt, l_range__str);
2928 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" loop\n"));
2929 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2930 4 txt := Tpl.writeText(txt, l_body__str);
2931 4 txt := Tpl.softNewLine(txt);
2932 4 txt := Tpl.popBlock(txt);
2933 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("end for"));
2934 4 txt := Tpl.writeText(txt, l_cmt__str);
2935 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2936 then txt;
2937
2938 case ( txt,
2939 SCode.ALG_FOR(forBody = i_forBody, comment = i_comment, index = i_index),
2940 a_options )
2941 algorithm
2942 ✗ l_body__str := dumpStatements(Tpl.emptyTxt, i_forBody, a_options);
2943 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2944 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("for "));
2945 ✗ txt := Tpl.writeStr(txt, i_index);
2946 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" loop\n"));
2947 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2948 ✗ txt := Tpl.writeText(txt, l_body__str);
2949 ✗ txt := Tpl.softNewLine(txt);
2950 ✗ txt := Tpl.popBlock(txt);
2951 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("end for"));
2952 ✗ txt := Tpl.writeText(txt, l_cmt__str);
2953 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2954 then txt;
2955
2956 case ( txt,
2957 _,
2958 _ )
2959 then txt;
2960 end match;
2961 end dumpForStatement;
2962
2963 public function dumpWhileStatement
2964 input Tpl.Text in_txt;
2965 input SCode.Statement in_a_while__statement;
2966 input SCodeDump.SCodeDumpOptions in_a_options;
2967
2968 output Tpl.Text out_txt;
2969 algorithm
2970 out_txt :=
2971 match(in_txt, in_a_while__statement, in_a_options)
2972 local
2973 Tpl.Text txt;
2974 SCodeDump.SCodeDumpOptions a_options;
2975 SCode.Comment i_comment;
2976 list<SCode.Statement> i_whileBody;
2977 Absyn.Exp i_boolExpr;
2978 Tpl.Text l_cmt__str;
2979 Tpl.Text l_body__str;
2980 Tpl.Text l_cond__str;
2981
2982 case ( txt,
2983 SCode.ALG_WHILE(boolExpr = i_boolExpr, whileBody = i_whileBody, comment = i_comment),
2984 a_options )
2985 algorithm
2986 1 l_cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_boolExpr);
2987 1 l_body__str := dumpStatements(Tpl.emptyTxt, i_whileBody, a_options);
2988 1 l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
2989 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("while "));
2990 1 txt := Tpl.writeText(txt, l_cond__str);
2991 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" loop\n"));
2992 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2993 1 txt := Tpl.writeText(txt, l_body__str);
2994 1 txt := Tpl.softNewLine(txt);
2995 1 txt := Tpl.popBlock(txt);
2996 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("end while"));
2997 1 txt := Tpl.writeText(txt, l_cmt__str);
2998 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
2999 then txt;
3000
3001 case ( txt,
3002 _,
3003 _ )
3004 then txt;
3005 end match;
3006 end dumpWhileStatement;
3007
3008 protected function lm_91
3009 input output Tpl.Text txt;
3010 input list<tuple<Absyn.Exp, list<SCode.Statement>>> items;
3011 input SCodeDump.SCodeDumpOptions a_options;
3012 algorithm
3013 ✗ for lstElt_91 in items loop
3014 txt := match lstElt_91
3015 local
3016 list<SCode.Statement> i_ew__body;
3017 Absyn.Exp i_ew__cond;
3018 Tpl.Text l_ew__body__str;
3019 Tpl.Text l_ew__cond__str;
3020
3021 case (i_ew__cond, i_ew__body)
3022 algorithm
3023 ✗ l_ew__cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_ew__cond);
3024 ✗ l_ew__body__str := dumpStatements(Tpl.emptyTxt, i_ew__body, a_options);
3025 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("elsewhen "));
3026 ✗ txt := Tpl.writeText(txt, l_ew__cond__str);
3027 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
3028 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
3029 ✗ txt := Tpl.writeText(txt, l_ew__body__str);
3030 ✗ txt := Tpl.popBlock(txt);
3031 ✗ txt := Tpl.nextIter(txt);
3032 then txt;
3033 end match;
3034 end for;
3035 end lm_91;
3036
3037 public function dumpWhenStatement
3038 input Tpl.Text in_txt;
3039 input SCode.Statement in_a_when__statement;
3040 input SCodeDump.SCodeDumpOptions in_a_options;
3041
3042 output Tpl.Text out_txt;
3043 algorithm
3044 out_txt :=
3045 match(in_txt, in_a_when__statement, in_a_options)
3046 local
3047 Tpl.Text txt;
3048 SCodeDump.SCodeDumpOptions a_options;
3049 SCode.Comment i_comment;
3050 list<tuple<Absyn.Exp, list<SCode.Statement>>> i_elsewhens;
3051 list<SCode.Statement> i_when__body;
3052 Absyn.Exp i_when__cond;
3053 Tpl.Text l_cmt__str;
3054 Tpl.Text l_elsewhen__str;
3055 Tpl.Text l_when__body__str;
3056 Tpl.Text l_when__cond__str;
3057
3058 case ( txt,
3059 SCode.ALG_WHEN_A(branches = (i_when__cond, i_when__body) :: i_elsewhens, comment = i_comment),
3060 a_options )
3061 algorithm
3062 ✗ l_when__cond__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_when__cond);
3063 ✗ l_when__body__str := dumpStatements(Tpl.emptyTxt, i_when__body, a_options);
3064 ✗ l_elsewhen__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3065 ✗ l_elsewhen__str := lm_91(l_elsewhen__str, i_elsewhens, a_options);
3066 ✗ l_elsewhen__str := Tpl.popIter(l_elsewhen__str);
3067 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
3068 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("when "));
3069 ✗ txt := Tpl.writeText(txt, l_when__cond__str);
3070 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" then\n"));
3071 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
3072 ✗ txt := Tpl.writeText(txt, l_when__body__str);
3073 ✗ txt := Tpl.softNewLine(txt);
3074 ✗ txt := Tpl.popBlock(txt);
3075 ✗ txt := Tpl.writeText(txt, l_elsewhen__str);
3076 ✗ txt := Tpl.softNewLine(txt);
3077 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("end when"));
3078 ✗ txt := Tpl.writeText(txt, l_cmt__str);
3079 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
3080 then txt;
3081
3082 case ( txt,
3083 _,
3084 _ )
3085 then txt;
3086 end match;
3087 end dumpWhenStatement;
3088
3089 public function dumpTryStatement
3090 input Tpl.Text in_txt;
3091 input SCode.Statement in_a_try__statement;
3092 input SCodeDump.SCodeDumpOptions in_a_options;
3093
3094 output Tpl.Text out_txt;
3095 algorithm
3096 out_txt :=
3097 match(in_txt, in_a_try__statement, in_a_options)
3098 local
3099 Tpl.Text txt;
3100 SCodeDump.SCodeDumpOptions a_options;
3101 list<SCode.Statement> i_elseBody;
3102 list<SCode.Statement> i_body;
3103 SCode.Comment i_comment;
3104 Tpl.Text l_algs2;
3105 Tpl.Text l_algs1;
3106 Tpl.Text l_cmt__str;
3107
3108 case ( txt,
3109 SCode.ALG_TRY(comment = i_comment, body = i_body, elseBody = i_elseBody),
3110 a_options )
3111 algorithm
3112 ✗ l_cmt__str := dumpComment(Tpl.emptyTxt, i_comment, a_options);
3113 ✗ l_algs1 := dumpStatements(Tpl.emptyTxt, i_body, a_options);
3114 ✗ l_algs2 := dumpStatements(Tpl.emptyTxt, i_elseBody, a_options);
3115 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("try\n"));
3116 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
3117 ✗ txt := Tpl.writeText(txt, l_algs1);
3118 ✗ txt := Tpl.softNewLine(txt);
3119 ✗ txt := Tpl.popBlock(txt);
3120 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("else\n"));
3121 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
3122 ✗ txt := Tpl.writeText(txt, l_algs2);
3123 ✗ txt := Tpl.softNewLine(txt);
3124 ✗ txt := Tpl.popBlock(txt);
3125 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("end try"));
3126 ✗ txt := Tpl.writeText(txt, l_cmt__str);
3127 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
3128 then txt;
3129
3130 case ( txt,
3131 _,
3132 _ )
3133 then txt;
3134 end match;
3135 end dumpTryStatement;
3136
3137 public function dumpPrefixes
3138 input Tpl.Text in_txt;
3139 input SCode.Prefixes in_a_prefixes;
3140 input String in_a_each;
3141
3142 output Tpl.Text out_txt;
3143 algorithm
3144 out_txt :=
3145 match(in_txt, in_a_prefixes, in_a_each)
3146 local
3147 Tpl.Text txt;
3148 String a_each;
3149 SCode.Replaceable i_replaceablePrefix;
3150 Absyn.InnerOuter i_innerOuter;
3151 SCode.Final i_finalPrefix;
3152 SCode.Redeclare i_redeclarePrefix;
3153 Tpl.Text l_replaceable__str;
3154 Tpl.Text l_io__str;
3155 Tpl.Text l_final__str;
3156 Tpl.Text l_redeclare__str;
3157
3158 case ( txt,
3159 SCode.PREFIXES(redeclarePrefix = i_redeclarePrefix, finalPrefix = i_finalPrefix, innerOuter = i_innerOuter, replaceablePrefix = i_replaceablePrefix),
3160 a_each )
3161 algorithm
3162 1485 l_redeclare__str := dumpRedeclare(Tpl.emptyTxt, i_redeclarePrefix);
3163 1485 l_final__str := dumpFinal(Tpl.emptyTxt, i_finalPrefix);
3164 1485 l_io__str := dumpInnerOuter(Tpl.emptyTxt, i_innerOuter);
3165 1485 l_replaceable__str := dumpReplaceable(Tpl.emptyTxt, i_replaceablePrefix);
3166 1485 txt := Tpl.writeText(txt, l_redeclare__str);
3167 1485 txt := Tpl.writeStr(txt, a_each);
3168 1485 txt := Tpl.writeText(txt, l_final__str);
3169 1485 txt := Tpl.writeText(txt, l_io__str);
3170 1485 txt := Tpl.writeText(txt, l_replaceable__str);
3171 then txt;
3172
3173 case ( txt,
3174 _,
3175 _ )
3176 then txt;
3177 end match;
3178 end dumpPrefixes;
3179
3180 public function dumpVisibility
3181 input Tpl.Text in_txt;
3182 input SCode.Visibility in_a_visibility;
3183
3184 output Tpl.Text out_txt;
3185 algorithm
3186 out_txt :=
3187 match(in_txt, in_a_visibility)
3188 local
3189 Tpl.Text txt;
3190
3191 case ( txt,
3192 SCode.PROTECTED() )
3193 algorithm
3194 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("protected "));
3195 then txt;
3196
3197 case ( txt,
3198 _ )
3199 then txt;
3200 end match;
3201 end dumpVisibility;
3202
3203 public function dumpRedeclare
3204 input Tpl.Text in_txt;
3205 input SCode.Redeclare in_a_redeclare;
3206
3207 output Tpl.Text out_txt;
3208 algorithm
3209 out_txt :=
3210 match(in_txt, in_a_redeclare)
3211 local
3212 Tpl.Text txt;
3213
3214 case ( txt,
3215 SCode.REDECLARE() )
3216 algorithm
3217 53 txt := Tpl.writeTok(txt, Tpl.ST_STRING("redeclare "));
3218 then txt;
3219
3220 case ( txt,
3221 _ )
3222 then txt;
3223 end match;
3224 end dumpRedeclare;
3225
3226 public function dumpFinal
3227 input Tpl.Text in_txt;
3228 input SCode.Final in_a_final;
3229
3230 output Tpl.Text out_txt;
3231 algorithm
3232 out_txt :=
3233 match(in_txt, in_a_final)
3234 local
3235 Tpl.Text txt;
3236
3237 case ( txt,
3238 SCode.FINAL() )
3239 algorithm
3240 154 txt := Tpl.writeTok(txt, Tpl.ST_STRING("final "));
3241 then txt;
3242
3243 case ( txt,
3244 _ )
3245 then txt;
3246 end match;
3247 end dumpFinal;
3248
3249 public function dumpInnerOuter
3250 input Tpl.Text in_txt;
3251 input Absyn.InnerOuter in_a_innerOuter;
3252
3253 output Tpl.Text out_txt;
3254 algorithm
3255 out_txt :=
3256 match(in_txt, in_a_innerOuter)
3257 local
3258 Tpl.Text txt;
3259
3260 case ( txt,
3261 Absyn.INNER() )
3262 algorithm
3263 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("inner "));
3264 then txt;
3265
3266 case ( txt,
3267 Absyn.OUTER() )
3268 algorithm
3269 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("outer "));
3270 then txt;
3271
3272 case ( txt,
3273 Absyn.INNER_OUTER() )
3274 algorithm
3275 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("inner outer "));
3276 then txt;
3277
3278 case ( txt,
3279 _ )
3280 then txt;
3281 end match;
3282 end dumpInnerOuter;
3283
3284 public function dumpReplaceable
3285 input Tpl.Text in_txt;
3286 input SCode.Replaceable in_a_replaceable;
3287
3288 output Tpl.Text out_txt;
3289 algorithm
3290 out_txt :=
3291 match(in_txt, in_a_replaceable)
3292 local
3293 Tpl.Text txt;
3294
3295 case ( txt,
3296 SCode.REPLACEABLE(cc = _) )
3297 algorithm
3298 44 txt := Tpl.writeTok(txt, Tpl.ST_STRING("replaceable "));
3299 then txt;
3300
3301 case ( txt,
3302 _ )
3303 then txt;
3304 end match;
3305 end dumpReplaceable;
3306
3307 public function dumpReplaceableConstrainClass
3308 input Tpl.Text in_txt;
3309 input SCode.Prefixes in_a_replaceable;
3310 input SCodeDump.SCodeDumpOptions in_a_options;
3311
3312 output Tpl.Text out_txt;
3313 algorithm
3314 out_txt :=
3315 match(in_txt, in_a_replaceable, in_a_options)
3316 local
3317 Tpl.Text txt;
3318 SCodeDump.SCodeDumpOptions a_options;
3319 SCode.Mod i_cc__mod;
3320 Absyn.Path i_cc__path;
3321 Tpl.Text l_mod__str;
3322 Tpl.Text l_path__str;
3323
3324 case ( txt,
3325 SCode.PREFIXES(replaceablePrefix = SCode.REPLACEABLE(cc = SOME(SCode.CONSTRAINCLASS(constrainingClass = i_cc__path, modifier = i_cc__mod)))),
3326 a_options )
3327 algorithm
3328 5 l_path__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_cc__path);
3329 5 l_mod__str := dumpModifier(Tpl.emptyTxt, i_cc__mod, a_options);
3330 5 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
3331 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("constrainedby "));
3332 5 txt := Tpl.writeText(txt, l_path__str);
3333 5 txt := Tpl.writeText(txt, l_mod__str);
3334 5 txt := Tpl.popBlock(txt);
3335 then txt;
3336
3337 case ( txt,
3338 _,
3339 _ )
3340 then txt;
3341 end match;
3342 end dumpReplaceableConstrainClass;
3343
3344 public function dumpEach
3345 input Tpl.Text in_txt;
3346 input SCode.Each in_a_each;
3347
3348 output Tpl.Text out_txt;
3349 algorithm
3350 out_txt :=
3351 match(in_txt, in_a_each)
3352 local
3353 Tpl.Text txt;
3354
3355 case ( txt,
3356 SCode.EACH() )
3357 algorithm
3358 21 txt := Tpl.writeTok(txt, Tpl.ST_STRING("each "));
3359 then txt;
3360
3361 case ( txt,
3362 _ )
3363 then txt;
3364 end match;
3365 end dumpEach;
3366
3367 public function dumpEncapsulated
3368 input Tpl.Text in_txt;
3369 input SCode.Encapsulated in_a_encapsulated;
3370
3371 output Tpl.Text out_txt;
3372 algorithm
3373 out_txt :=
3374 match(in_txt, in_a_encapsulated)
3375 local
3376 Tpl.Text txt;
3377
3378 case ( txt,
3379 SCode.ENCAPSULATED() )
3380 algorithm
3381 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("encapsulated "));
3382 then txt;
3383
3384 case ( txt,
3385 _ )
3386 then txt;
3387 end match;
3388 end dumpEncapsulated;
3389
3390 public function dumpPartial
3391 input Tpl.Text in_txt;
3392 input SCode.Partial in_a_partial;
3393
3394 output Tpl.Text out_txt;
3395 algorithm
3396 out_txt :=
3397 match(in_txt, in_a_partial)
3398 local
3399 Tpl.Text txt;
3400
3401 case ( txt,
3402 SCode.PARTIAL() )
3403 algorithm
3404 56 txt := Tpl.writeTok(txt, Tpl.ST_STRING("partial "));
3405 then txt;
3406
3407 case ( txt,
3408 _ )
3409 then txt;
3410 end match;
3411 end dumpPartial;
3412
3413 protected function fun_104
3414 input Tpl.Text in_txt;
3415 input Boolean in_a_isOperator;
3416
3417 output Tpl.Text out_txt;
3418 algorithm
3419 out_txt :=
3420 match(in_txt, in_a_isOperator)
3421 local
3422 Tpl.Text txt;
3423
3424 case ( txt,
3425 false )
3426 algorithm
3427 37 txt := Tpl.writeTok(txt, Tpl.ST_STRING("record"));
3428 then txt;
3429
3430 case ( txt,
3431 _ )
3432 algorithm
3433 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("operator record"));
3434 then txt;
3435 end match;
3436 end fun_104;
3437
3438 protected function fun_105
3439 input Tpl.Text in_txt;
3440 input Boolean in_a_isExpandable;
3441
3442 output Tpl.Text out_txt;
3443 algorithm
3444 out_txt :=
3445 match(in_txt, in_a_isExpandable)
3446 local
3447 Tpl.Text txt;
3448
3449 case ( txt,
3450 false )
3451 algorithm
3452 21 txt := Tpl.writeTok(txt, Tpl.ST_STRING("connector"));
3453 then txt;
3454
3455 case ( txt,
3456 _ )
3457 algorithm
3458 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("expandable connector"));
3459 then txt;
3460 end match;
3461 end fun_105;
3462
3463 public function dumpRestriction
3464 input Tpl.Text in_txt;
3465 input SCode.Restriction in_a_restriction;
3466
3467 output Tpl.Text out_txt;
3468 algorithm
3469 out_txt :=
3470 match(in_txt, in_a_restriction)
3471 local
3472 Tpl.Text txt;
3473 SCode.FunctionRestriction i_functionRestriction;
3474 Boolean i_isExpandable;
3475 Boolean i_isOperator;
3476
3477 case ( txt,
3478 SCode.R_CLASS() )
3479 algorithm
3480 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("class"));
3481 then txt;
3482
3483 case ( txt,
3484 SCode.R_OPTIMIZATION() )
3485 algorithm
3486 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("optimization"));
3487 then txt;
3488
3489 case ( txt,
3490 SCode.R_MODEL() )
3491 algorithm
3492 135 txt := Tpl.writeTok(txt, Tpl.ST_STRING("model"));
3493 then txt;
3494
3495 case ( txt,
3496 SCode.R_RECORD(isOperator = i_isOperator) )
3497 algorithm
3498 38 txt := fun_104(txt, i_isOperator);
3499 then txt;
3500
3501 case ( txt,
3502 SCode.R_OPERATOR() )
3503 algorithm
3504 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("operator"));
3505 then txt;
3506
3507 case ( txt,
3508 SCode.R_BLOCK() )
3509 algorithm
3510 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("block"));
3511 then txt;
3512
3513 case ( txt,
3514 SCode.R_CONNECTOR(isExpandable = i_isExpandable) )
3515 algorithm
3516 21 txt := fun_105(txt, i_isExpandable);
3517 then txt;
3518
3519 case ( txt,
3520 SCode.R_OPERATOR() )
3521 algorithm
3522 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("operator"));
3523 then txt;
3524
3525 case ( txt,
3526 SCode.R_TYPE() )
3527 algorithm
3528 90 txt := Tpl.writeTok(txt, Tpl.ST_STRING("type"));
3529 then txt;
3530
3531 case ( txt,
3532 SCode.R_PACKAGE() )
3533 algorithm
3534 219 txt := Tpl.writeTok(txt, Tpl.ST_STRING("package"));
3535 then txt;
3536
3537 case ( txt,
3538 SCode.R_FUNCTION(functionRestriction = i_functionRestriction) )
3539 algorithm
3540 126 txt := dumpFunctionRestriction(txt, i_functionRestriction);
3541 then txt;
3542
3543 case ( txt,
3544 SCode.R_ENUMERATION() )
3545 algorithm
3546 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("enumeration"));
3547 then txt;
3548
3549 case ( txt,
3550 SCode.R_PREDEFINED_INTEGER() )
3551 algorithm
3552 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("IntegerType"));
3553 then txt;
3554
3555 case ( txt,
3556 SCode.R_PREDEFINED_REAL() )
3557 algorithm
3558 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("RealType"));
3559 then txt;
3560
3561 case ( txt,
3562 SCode.R_PREDEFINED_STRING() )
3563 algorithm
3564 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("StringType"));
3565 then txt;
3566
3567 case ( txt,
3568 SCode.R_PREDEFINED_BOOLEAN() )
3569 algorithm
3570 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("BooleanType"));
3571 then txt;
3572
3573 case ( txt,
3574 SCode.R_PREDEFINED_ENUMERATION() )
3575 algorithm
3576 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("EnumType"));
3577 then txt;
3578
3579 case ( txt,
3580 SCode.R_METARECORD(name = _) )
3581 algorithm
3582 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("record"));
3583 then txt;
3584
3585 case ( txt,
3586 SCode.R_UNIONTYPE(typeVars = _) )
3587 algorithm
3588 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("uniontype"));
3589 then txt;
3590
3591 case ( txt,
3592 _ )
3593 algorithm
3594 ✗ txt := errorMsg(txt, "SCodeDump.dumpRestriction: Unknown restriction.");
3595 then txt;
3596 end match;
3597 end dumpRestriction;
3598
3599 protected function lm_107
3600 input output Tpl.Text txt;
3601 input list<String> items;
3602 algorithm
3603 ✗ for lstElt_107 in items loop
3604 txt := match lstElt_107
3605 local
3606 String i_tv;
3607
3608 case i_tv
3609 algorithm
3610 ✗ txt := Tpl.writeStr(txt, i_tv);
3611 ✗ txt := Tpl.nextIter(txt);
3612 then txt;
3613 end match;
3614 end for;
3615 end lm_107;
3616
3617 protected function fun_108
3618 input Tpl.Text in_txt;
3619 input list<String> in_a_typeVars;
3620
3621 output Tpl.Text out_txt;
3622 algorithm
3623 out_txt :=
3624 match(in_txt, in_a_typeVars)
3625 local
3626 Tpl.Text txt;
3627 list<String> i_typeVars;
3628
3629 case ( txt,
3630 {} )
3631 then txt;
3632
3633 case ( txt,
3634 i_typeVars )
3635 algorithm
3636 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<"));
3637 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(",")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3638 ✗ txt := lm_107(txt, i_typeVars);
3639 ✗ txt := Tpl.popIter(txt);
3640 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(">"));
3641 then txt;
3642 end match;
3643 end fun_108;
3644
3645 public function dumpRestrictionTypeVars
3646 input Tpl.Text in_txt;
3647 input SCode.Restriction in_a_restriction;
3648
3649 output Tpl.Text out_txt;
3650 algorithm
3651 out_txt :=
3652 match(in_txt, in_a_restriction)
3653 local
3654 Tpl.Text txt;
3655 list<String> i_typeVars;
3656
3657 case ( txt,
3658 SCode.R_UNIONTYPE(typeVars = i_typeVars) )
3659 algorithm
3660 ✗ txt := fun_108(txt, i_typeVars);
3661 then txt;
3662
3663 case ( txt,
3664 _ )
3665 then txt;
3666 end match;
3667 end dumpRestrictionTypeVars;
3668
3669 public function dumpFunctionRestriction
3670 input Tpl.Text in_txt;
3671 input SCode.FunctionRestriction in_a_funcRest;
3672
3673 output Tpl.Text out_txt;
3674 algorithm
3675 out_txt :=
3676 match(in_txt, in_a_funcRest)
3677 local
3678 Tpl.Text txt;
3679 Absyn.FunctionPurity i_purity;
3680
3681 case ( txt,
3682 SCode.FR_NORMAL_FUNCTION(purity = i_purity) )
3683 algorithm
3684 119 txt := AbsynDumpTpl.dumpPurity(txt, i_purity);
3685 119 txt := Tpl.writeTok(txt, Tpl.ST_STRING("function"));
3686 then txt;
3687
3688 case ( txt,
3689 SCode.FR_EXTERNAL_FUNCTION(purity = i_purity) )
3690 algorithm
3691 7 txt := AbsynDumpTpl.dumpPurity(txt, i_purity);
3692 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("function"));
3693 then txt;
3694
3695 case ( txt,
3696 SCode.FR_OPERATOR_FUNCTION() )
3697 algorithm
3698 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("operator function"));
3699 then txt;
3700
3701 case ( txt,
3702 SCode.FR_RECORD_CONSTRUCTOR() )
3703 algorithm
3704 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("function"));
3705 then txt;
3706
3707 case ( txt,
3708 _ )
3709 algorithm
3710 ✗ txt := errorMsg(txt, "SCodeDump.dumpFunctionRestriction: Unknown Function restriction.");
3711 then txt;
3712 end match;
3713 end dumpFunctionRestriction;
3714
3715 protected function lm_111
3716 input output Tpl.Text txt;
3717 input list<SCode.SubMod> items;
3718 input SCodeDump.SCodeDumpOptions a_options;
3719 algorithm
3720
2/2
✓ Branch 0 taken 482 times.
✓ Branch 1 taken 195 times.
677 for lstElt_111 in items loop
3721 txt := match lstElt_111
3722 local
3723 SCode.SubMod i_submod;
3724
3725 case i_submod
3726 algorithm
3727 482 txt := dumpSubModifier(txt, i_submod, a_options);
3728 482 txt := Tpl.nextIter(txt);
3729 then txt;
3730 end match;
3731 end for;
3732 end lm_111;
3733
3734 protected function fun_112
3735 input Tpl.Text in_txt;
3736 input list<SCode.SubMod> in_a_subModLst;
3737 input SCodeDump.SCodeDumpOptions in_a_options;
3738
3739 output Tpl.Text out_txt;
3740 algorithm
3741 out_txt :=
3742 match(in_txt, in_a_subModLst, in_a_options)
3743 local
3744 Tpl.Text txt;
3745 SCodeDump.SCodeDumpOptions a_options;
3746 list<SCode.SubMod> i_subModLst;
3747
3748 case ( txt,
3749 {},
3750 _ )
3751 then txt;
3752
3753 case ( txt,
3754 i_subModLst,
3755 a_options )
3756 algorithm
3757 195 txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
3758 195 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3759 195 txt := lm_111(txt, i_subModLst, a_options);
3760 195 txt := Tpl.popIter(txt);
3761 195 txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
3762 then txt;
3763 end match;
3764 end fun_112;
3765
3766 public function dumpModifier
3767 input Tpl.Text in_txt;
3768 input SCode.Mod in_a_modifier;
3769 input SCodeDump.SCodeDumpOptions in_a_options;
3770
3771 output Tpl.Text out_txt;
3772 algorithm
3773 out_txt :=
3774 match(in_txt, in_a_modifier, in_a_options)
3775 local
3776 Tpl.Text txt;
3777 SCodeDump.SCodeDumpOptions a_options;
3778 list<SCode.SubMod> i_subModLst;
3779 Option<Absyn.Exp> i_binding;
3780 Tpl.Text l_submod__str;
3781 Tpl.Text l_binding__str;
3782
3783 case ( txt,
3784 SCode.MOD(binding = i_binding, subModLst = i_subModLst),
3785 a_options )
3786 algorithm
3787 1054 l_binding__str := dumpModifierBinding(Tpl.emptyTxt, i_binding);
3788 1054 l_submod__str := fun_112(Tpl.emptyTxt, i_subModLst, a_options);
3789 1054 txt := Tpl.writeText(txt, l_submod__str);
3790 1054 txt := Tpl.writeText(txt, l_binding__str);
3791 then txt;
3792
3793 case ( txt,
3794 _,
3795 _ )
3796 then txt;
3797 end match;
3798 end dumpModifier;
3799
3800 protected function lm_114
3801 input output Tpl.Text txt;
3802 input list<SCode.SubMod> items;
3803 input SCodeDump.SCodeDumpOptions a_options;
3804 algorithm
3805
2/2
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 446 times.
958 for lstElt_114 in items loop
3806 txt := match lstElt_114
3807 local
3808 SCode.SubMod i_submod;
3809
3810 case i_submod
3811 algorithm
3812 512 txt := dumpAnnotationSubModifier(txt, i_submod, a_options);
3813 512 txt := Tpl.nextIter(txt);
3814 then txt;
3815 end match;
3816 end for;
3817 end lm_114;
3818
3819 protected function fun_115
3820 input Tpl.Text in_txt;
3821 input Boolean in_mArg;
3822 input Tpl.Text in_a_text;
3823
3824 output Tpl.Text out_txt;
3825 algorithm
3826 out_txt :=
3827 match(in_txt, in_mArg, in_a_text)
3828 local
3829 Tpl.Text txt;
3830 Tpl.Text a_text;
3831
3832 case ( txt,
3833 true,
3834 _ )
3835 then txt;
3836
3837 case ( txt,
3838 _,
3839 a_text )
3840 algorithm
3841 115 txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
3842 115 txt := Tpl.writeText(txt, a_text);
3843 115 txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
3844 then txt;
3845 end match;
3846 end fun_115;
3847
3848 public function dumpAnnotationModifier
3849 input Tpl.Text in_txt;
3850 input SCode.Mod in_a_modifier;
3851 input SCodeDump.SCodeDumpOptions in_a_options;
3852
3853 output Tpl.Text out_txt;
3854 algorithm
3855 out_txt :=
3856 match(in_txt, in_a_modifier, in_a_options)
3857 local
3858 Tpl.Text txt;
3859 SCodeDump.SCodeDumpOptions a_options;
3860 list<SCode.SubMod> i_subModLst;
3861 Option<Absyn.Exp> i_binding;
3862 Boolean ret_3;
3863 Tpl.Text l_submod__str;
3864 Tpl.Text l_text;
3865 Tpl.Text l_binding__str;
3866
3867 case ( txt,
3868 SCode.MOD(binding = i_binding, subModLst = i_subModLst),
3869 a_options )
3870 algorithm
3871 446 l_binding__str := dumpModifierBinding(Tpl.emptyTxt, i_binding);
3872 446 l_text := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3873 446 l_text := lm_114(l_text, i_subModLst, a_options);
3874 446 l_text := Tpl.popIter(l_text);
3875 446 ret_3 := Tpl.isEmpty(l_text);
3876 446 l_submod__str := fun_115(Tpl.emptyTxt, ret_3, l_text);
3877 446 txt := Tpl.writeText(txt, l_submod__str);
3878 446 txt := Tpl.writeText(txt, l_binding__str);
3879 then txt;
3880
3881 case ( txt,
3882 _,
3883 _ )
3884 then txt;
3885 end match;
3886 end dumpAnnotationModifier;
3887
3888 public function dumpModifierPrefix
3889 input Tpl.Text in_txt;
3890 input SCode.Mod in_a_modifier;
3891
3892 output Tpl.Text out_txt;
3893 algorithm
3894 out_txt :=
3895 match(in_txt, in_a_modifier)
3896 local
3897 Tpl.Text txt;
3898 SCode.Each i_eachPrefix;
3899 SCode.Final i_finalPrefix;
3900 Tpl.Text l_each__str;
3901 Tpl.Text l_final__str;
3902
3903 case ( txt,
3904 SCode.MOD(finalPrefix = i_finalPrefix, eachPrefix = i_eachPrefix) )
3905 algorithm
3906 609 l_final__str := dumpFinal(Tpl.emptyTxt, i_finalPrefix);
3907 609 l_each__str := dumpEach(Tpl.emptyTxt, i_eachPrefix);
3908 609 txt := Tpl.writeText(txt, l_each__str);
3909 609 txt := Tpl.writeText(txt, l_final__str);
3910 then txt;
3911
3912 case ( txt,
3913 SCode.REDECL(finalPrefix = i_finalPrefix, eachPrefix = i_eachPrefix) )
3914 algorithm
3915 ✗ l_final__str := dumpFinal(Tpl.emptyTxt, i_finalPrefix);
3916 ✗ l_each__str := dumpEach(Tpl.emptyTxt, i_eachPrefix);
3917 ✗ txt := Tpl.writeText(txt, l_each__str);
3918 ✗ txt := Tpl.writeText(txt, l_final__str);
3919 then txt;
3920
3921 case ( txt,
3922 _ )
3923 then txt;
3924 end match;
3925 end dumpModifierPrefix;
3926
3927 public function dumpRedeclModifier
3928 input Tpl.Text in_txt;
3929 input SCode.Mod in_a_modifier;
3930 input SCodeDump.SCodeDumpOptions in_a_options;
3931
3932 output Tpl.Text out_txt;
3933 algorithm
3934 out_txt :=
3935 match(in_txt, in_a_modifier, in_a_options)
3936 local
3937 Tpl.Text txt;
3938 SCodeDump.SCodeDumpOptions a_options;
3939 SCode.Element i_element;
3940 SCode.Each i_eachPrefix;
3941 Tpl.Text l_each__str;
3942
3943 case ( txt,
3944 SCode.REDECL(eachPrefix = i_eachPrefix, element = i_element),
3945 a_options )
3946 algorithm
3947 18 l_each__str := dumpEach(Tpl.emptyTxt, i_eachPrefix);
3948 18 txt := dumpElement(txt, i_element, Tpl.textString(l_each__str), a_options);
3949 then txt;
3950
3951 case ( txt,
3952 _,
3953 _ )
3954 then txt;
3955 end match;
3956 end dumpRedeclModifier;
3957
3958 public function dumpModifierBinding
3959 input Tpl.Text in_txt;
3960 input Option<Absyn.Exp> in_a_binding;
3961
3962 output Tpl.Text out_txt;
3963 algorithm
3964 out_txt :=
3965 match(in_txt, in_a_binding)
3966 local
3967 Tpl.Text txt;
3968 Absyn.Exp i_exp;
3969
3970 case ( txt,
3971 SOME(i_exp) )
3972 algorithm
3973 1018 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
3974 1018 txt := Tpl.writeTok(txt, Tpl.ST_STRING("= "));
3975 1018 txt := AbsynDumpTpl.dumpExp(txt, i_exp);
3976 then txt;
3977
3978 case ( txt,
3979 _ )
3980 then txt;
3981 end match;
3982 end dumpModifierBinding;
3983
3984 public function dumpSubModifier
3985 input Tpl.Text in_txt;
3986 input SCode.SubMod in_a_submod;
3987 input SCodeDump.SCodeDumpOptions in_a_options;
3988
3989 output Tpl.Text out_txt;
3990 algorithm
3991 out_txt :=
3992 match(in_txt, in_a_submod, in_a_options)
3993 local
3994 Tpl.Text txt;
3995 SCodeDump.SCodeDumpOptions a_options;
3996 SCode.Ident i_ident;
3997 SCode.Mod i_mod;
3998
3999 case ( txt,
4000 SCode.NAMEMOD(mod = (i_mod as SCode.MOD(finalPrefix = _)), ident = i_ident),
4001 a_options )
4002 algorithm
4003 464 txt := dumpModifierPrefix(txt, i_mod);
4004 464 txt := Tpl.writeStr(txt, i_ident);
4005 464 txt := dumpModifier(txt, i_mod, a_options);
4006 then txt;
4007
4008 case ( txt,
4009 SCode.NAMEMOD(mod = (i_mod as SCode.REDECL(finalPrefix = _))),
4010 a_options )
4011 algorithm
4012 18 txt := dumpRedeclModifier(txt, i_mod, a_options);
4013 then txt;
4014
4015 case ( txt,
4016 _,
4017 _ )
4018 then txt;
4019 end match;
4020 end dumpSubModifier;
4021
4022 protected function fun_121
4023 input Tpl.Text in_txt;
4024 input SCode.Ident in_a_ident;
4025 input SCodeDump.SCodeDumpOptions in_a_options;
4026 input SCode.Mod in_a_nameMod;
4027
4028 output Tpl.Text out_txt;
4029 algorithm
4030 out_txt :=
4031 match(in_txt, in_a_ident, in_a_options, in_a_nameMod)
4032 local
4033 Tpl.Text txt;
4034 SCodeDump.SCodeDumpOptions a_options;
4035 SCode.Mod a_nameMod;
4036 SCode.Ident i_ident;
4037
4038 case ( txt,
4039 "choices",
4040 _,
4041 _ )
4042 then txt;
4043
4044 case ( txt,
4045 "Documentation",
4046 _,
4047 _ )
4048 then txt;
4049
4050 case ( txt,
4051 "Dialog",
4052 _,
4053 _ )
4054 then txt;
4055
4056 case ( txt,
4057 "Diagram",
4058 _,
4059 _ )
4060 then txt;
4061
4062 case ( txt,
4063 "Icon",
4064 _,
4065 _ )
4066 then txt;
4067
4068 case ( txt,
4069 "Line",
4070 _,
4071 _ )
4072 then txt;
4073
4074 case ( txt,
4075 "Placement",
4076 _,
4077 _ )
4078 then txt;
4079
4080 case ( txt,
4081 "preferredView",
4082 _,
4083 _ )
4084 then txt;
4085
4086 case ( txt,
4087 "conversion",
4088 _,
4089 _ )
4090 then txt;
4091
4092 case ( txt,
4093 "defaultComponentName",
4094 _,
4095 _ )
4096 then txt;
4097
4098 case ( txt,
4099 "revisionId",
4100 _,
4101 _ )
4102 then txt;
4103
4104 case ( txt,
4105 "uses",
4106 _,
4107 _ )
4108 then txt;
4109
4110 case ( txt,
4111 i_ident,
4112 a_options,
4113 a_nameMod )
4114 algorithm
4115 145 txt := dumpModifierPrefix(txt, a_nameMod);
4116 145 txt := Tpl.writeStr(txt, i_ident);
4117 145 txt := dumpAnnotationModifier(txt, a_nameMod, a_options);
4118 then txt;
4119 end match;
4120 end fun_121;
4121
4122 protected function fun_122
4123 input Tpl.Text in_txt;
4124 input Boolean in_mArg;
4125 input SCode.Mod in_a_mod;
4126 input SCodeDump.SCodeDumpOptions in_a_options;
4127 input SCode.Mod in_a_nameMod;
4128 input SCode.Ident in_a_ident;
4129
4130 output Tpl.Text out_txt;
4131 algorithm
4132 out_txt :=
4133 match(in_txt, in_mArg, in_a_mod, in_a_options, in_a_nameMod, in_a_ident)
4134 local
4135 Tpl.Text txt;
4136 SCode.Mod a_mod;
4137 SCodeDump.SCodeDumpOptions a_options;
4138 SCode.Mod a_nameMod;
4139 SCode.Ident a_ident;
4140
4141 case ( txt,
4142 false,
4143 _,
4144 a_options,
4145 a_nameMod,
4146 a_ident )
4147 algorithm
4148 512 txt := fun_121(txt, a_ident, a_options, a_nameMod);
4149 then txt;
4150
4151 case ( txt,
4152 _,
4153 a_mod,
4154 a_options,
4155 a_nameMod,
4156 a_ident )
4157 algorithm
4158 ✗ txt := dumpModifierPrefix(txt, a_mod);
4159 ✗ txt := Tpl.writeStr(txt, a_ident);
4160 ✗ txt := dumpAnnotationModifier(txt, a_nameMod, a_options);
4161 then txt;
4162 end match;
4163 end fun_122;
4164
4165 public function dumpAnnotationSubModifier
4166 input Tpl.Text in_txt;
4167 input SCode.SubMod in_a_submod;
4168 input SCodeDump.SCodeDumpOptions in_a_options;
4169
4170 output Tpl.Text out_txt;
4171 algorithm
4172 out_txt :=
4173 match(in_txt, in_a_submod, in_a_options)
4174 local
4175 Tpl.Text txt;
4176 SCodeDump.SCodeDumpOptions a_options;
4177 SCode.Mod i_mod;
4178 SCode.Mod i_nameMod;
4179 SCode.Ident i_ident;
4180 Boolean ret_0;
4181
4182 case ( txt,
4183 SCode.NAMEMOD(mod = (i_nameMod as (i_mod as SCode.MOD(finalPrefix = _))), ident = i_ident),
4184 a_options )
4185 algorithm
4186 512 ret_0 := Config.showAnnotations();
4187 512 txt := fun_122(txt, ret_0, i_mod, a_options, i_nameMod, i_ident);
4188 then txt;
4189
4190 case ( txt,
4191 SCode.NAMEMOD(mod = (i_mod as SCode.REDECL(finalPrefix = _))),
4192 a_options )
4193 algorithm
4194 ✗ txt := dumpRedeclModifier(txt, i_mod, a_options);
4195 then txt;
4196
4197 case ( txt,
4198 _,
4199 _ )
4200 then txt;
4201 end match;
4202 end dumpAnnotationSubModifier;
4203
4204 public function dumpAttributes
4205 input Tpl.Text in_txt;
4206 input SCode.Attributes in_a_attributes;
4207
4208 output Tpl.Text out_txt;
4209 algorithm
4210 out_txt :=
4211 match(in_txt, in_a_attributes)
4212 local
4213 Tpl.Text txt;
4214 Absyn.Direction i_direction;
4215 SCode.Variability i_variability;
4216 SCode.Parallelism i_parallelism;
4217 SCode.ConnectorType i_connectorType;
4218 Tpl.Text l_dir__str;
4219 Tpl.Text l_var__str;
4220 Tpl.Text l_prl__str;
4221 Tpl.Text l_ct__str;
4222
4223 case ( txt,
4224 SCode.ATTR(connectorType = i_connectorType, parallelism = i_parallelism, variability = i_variability, direction = i_direction) )
4225 algorithm
4226 1231 l_ct__str := dumpConnectorType(Tpl.emptyTxt, i_connectorType);
4227 1231 l_prl__str := dumpParallelism(Tpl.emptyTxt, i_parallelism);
4228 1231 l_var__str := dumpVariability(Tpl.emptyTxt, i_variability);
4229 1231 l_dir__str := dumpDirection(Tpl.emptyTxt, i_direction);
4230 1231 txt := Tpl.writeText(txt, l_prl__str);
4231 1231 txt := Tpl.writeText(txt, l_var__str);
4232 1231 txt := Tpl.writeText(txt, l_dir__str);
4233 1231 txt := Tpl.writeText(txt, l_ct__str);
4234 then txt;
4235
4236 case ( txt,
4237 _ )
4238 then txt;
4239 end match;
4240 end dumpAttributes;
4241
4242 public function dumpConnectorType
4243 input Tpl.Text in_txt;
4244 input SCode.ConnectorType in_a_connectorType;
4245
4246 output Tpl.Text out_txt;
4247 algorithm
4248 out_txt :=
4249 match(in_txt, in_a_connectorType)
4250 local
4251 Tpl.Text txt;
4252
4253 case ( txt,
4254 SCode.FLOW() )
4255 algorithm
4256 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("flow "));
4257 then txt;
4258
4259 case ( txt,
4260 SCode.STREAM() )
4261 algorithm
4262 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("stream "));
4263 then txt;
4264
4265 case ( txt,
4266 _ )
4267 then txt;
4268 end match;
4269 end dumpConnectorType;
4270
4271 public function dumpParallelism
4272 input Tpl.Text in_txt;
4273 input SCode.Parallelism in_a_parallelism;
4274
4275 output Tpl.Text out_txt;
4276 algorithm
4277 out_txt :=
4278 match(in_txt, in_a_parallelism)
4279 local
4280 Tpl.Text txt;
4281
4282 case ( txt,
4283 SCode.PARGLOBAL() )
4284 algorithm
4285 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("parglobal "));
4286 then txt;
4287
4288 case ( txt,
4289 SCode.PARLOCAL() )
4290 algorithm
4291 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("parlocal "));
4292 then txt;
4293
4294 case ( txt,
4295 _ )
4296 then txt;
4297 end match;
4298 end dumpParallelism;
4299
4300 public function dumpVariability
4301 input Tpl.Text in_txt;
4302 input SCode.Variability in_a_variability;
4303
4304 output Tpl.Text out_txt;
4305 algorithm
4306 out_txt :=
4307 match(in_txt, in_a_variability)
4308 local
4309 Tpl.Text txt;
4310
4311 case ( txt,
4312 SCode.DISCRETE() )
4313 algorithm
4314 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete "));
4315 then txt;
4316
4317 case ( txt,
4318 SCode.PARAM() )
4319 algorithm
4320 121 txt := Tpl.writeTok(txt, Tpl.ST_STRING("parameter "));
4321 then txt;
4322
4323 case ( txt,
4324 SCode.CONST() )
4325 algorithm
4326 60 txt := Tpl.writeTok(txt, Tpl.ST_STRING("constant "));
4327 then txt;
4328
4329 case ( txt,
4330 _ )
4331 then txt;
4332 end match;
4333 end dumpVariability;
4334
4335 public function dumpDirection
4336 input Tpl.Text in_txt;
4337 input Absyn.Direction in_a_direction;
4338
4339 output Tpl.Text out_txt;
4340 algorithm
4341 out_txt :=
4342 match(in_txt, in_a_direction)
4343 local
4344 Tpl.Text txt;
4345
4346 case ( txt,
4347 Absyn.INPUT() )
4348 algorithm
4349 374 txt := Tpl.writeTok(txt, Tpl.ST_STRING("input "));
4350 then txt;
4351
4352 case ( txt,
4353 Absyn.OUTPUT() )
4354 algorithm
4355 88 txt := Tpl.writeTok(txt, Tpl.ST_STRING("output "));
4356 then txt;
4357
4358 case ( txt,
4359 Absyn.INPUT_OUTPUT() )
4360 algorithm
4361 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("input output "));
4362 then txt;
4363
4364 case ( txt,
4365 _ )
4366 then txt;
4367 end match;
4368 end dumpDirection;
4369
4370 public function dumpAttributeDim
4371 input Tpl.Text in_txt;
4372 input SCode.Attributes in_a_attributes;
4373
4374 output Tpl.Text out_txt;
4375 algorithm
4376 out_txt :=
4377 match(in_txt, in_a_attributes)
4378 local
4379 Tpl.Text txt;
4380 Absyn.ArrayDim i_arrayDims;
4381
4382 case ( txt,
4383 SCode.ATTR(arrayDims = i_arrayDims) )
4384 algorithm
4385 1125 txt := AbsynDumpTpl.dumpSubscripts(txt, i_arrayDims);
4386 then txt;
4387
4388 case ( txt,
4389 _ )
4390 then txt;
4391 end match;
4392 end dumpAttributeDim;
4393
4394 public function dumpAnnotationOpt
4395 input Tpl.Text in_txt;
4396 input Option<SCode.Annotation> in_a_annotation;
4397 input SCodeDump.SCodeDumpOptions in_a_options;
4398
4399 output Tpl.Text out_txt;
4400 algorithm
4401 out_txt :=
4402 match(in_txt, in_a_annotation, in_a_options)
4403 local
4404 Tpl.Text txt;
4405 SCodeDump.SCodeDumpOptions a_options;
4406 SCode.Annotation i_ann;
4407
4408 case ( txt,
4409 SOME(i_ann),
4410 a_options )
4411 algorithm
4412 301 txt := dumpAnnotation(txt, i_ann, a_options);
4413 then txt;
4414
4415 case ( txt,
4416 _,
4417 _ )
4418 then txt;
4419 end match;
4420 end dumpAnnotationOpt;
4421
4422 protected function fun_131
4423 input Tpl.Text in_txt;
4424 input Boolean in_mArg;
4425 input Tpl.Text in_a_modifStr;
4426
4427 output Tpl.Text out_txt;
4428 algorithm
4429 out_txt :=
4430 match(in_txt, in_mArg, in_a_modifStr)
4431 local
4432 Tpl.Text txt;
4433 Tpl.Text a_modifStr;
4434
4435 case ( txt,
4436 true,
4437 _ )
4438 then txt;
4439
4440 case ( txt,
4441 _,
4442 a_modifStr )
4443 algorithm
4444 105 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
4445 105 txt := Tpl.writeTok(txt, Tpl.ST_STRING("annotation"));
4446 105 txt := Tpl.writeText(txt, a_modifStr);
4447 then txt;
4448 end match;
4449 end fun_131;
4450
4451 public function dumpAnnotation
4452 input Tpl.Text in_txt;
4453 input SCode.Annotation in_a_annotation;
4454 input SCodeDump.SCodeDumpOptions in_a_options;
4455
4456 output Tpl.Text out_txt;
4457 algorithm
4458 out_txt :=
4459 match(in_txt, in_a_annotation, in_a_options)
4460 local
4461 Tpl.Text txt;
4462 SCodeDump.SCodeDumpOptions a_options;
4463 SCode.Mod i_modification;
4464 Boolean ret_1;
4465 Tpl.Text l_modifStr;
4466
4467 case ( txt,
4468 SCode.ANNOTATION(modification = i_modification),
4469 a_options )
4470 algorithm
4471 301 l_modifStr := dumpAnnotationModifier(Tpl.emptyTxt, i_modification, a_options);
4472 301 ret_1 := Tpl.isEmpty(l_modifStr);
4473 301 txt := fun_131(txt, ret_1, l_modifStr);
4474 then txt;
4475
4476 case ( txt,
4477 _,
4478 _ )
4479 then txt;
4480 end match;
4481 end dumpAnnotation;
4482
4483 protected function fun_133
4484 input Tpl.Text in_txt;
4485 input Boolean in_mArg;
4486 input Tpl.Text in_a_annstr;
4487
4488 output Tpl.Text out_txt;
4489 algorithm
4490 out_txt :=
4491 match(in_txt, in_mArg, in_a_annstr)
4492 local
4493 Tpl.Text txt;
4494 Tpl.Text a_annstr;
4495
4496 case ( txt,
4497 true,
4498 _ )
4499 then txt;
4500
4501 case ( txt,
4502 _,
4503 a_annstr )
4504 algorithm
4505 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
4506 ✗ txt := Tpl.writeText(txt, a_annstr);
4507 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
4508 then txt;
4509 end match;
4510 end fun_133;
4511
4512 public function dumpAnnotationElement
4513 input Tpl.Text txt;
4514 input SCode.Annotation a_annotation;
4515 input SCodeDump.SCodeDumpOptions a_options;
4516
4517 output Tpl.Text out_txt;
4518 protected
4519 Boolean ret_1;
4520 Tpl.Text l_annstr;
4521 algorithm
4522 ✗ l_annstr := dumpAnnotation(Tpl.emptyTxt, a_annotation, a_options);
4523 ✗ ret_1 := Tpl.isEmpty(l_annstr);
4524 ✗ out_txt := fun_133(txt, ret_1, l_annstr);
4525 end dumpAnnotationElement;
4526
4527 public function dumpExternalDeclOpt
4528 input Tpl.Text in_txt;
4529 input Option<SCode.ExternalDecl> in_a_externalDecl;
4530 input SCodeDump.SCodeDumpOptions in_a_options;
4531
4532 output Tpl.Text out_txt;
4533 algorithm
4534 out_txt :=
4535 match(in_txt, in_a_externalDecl, in_a_options)
4536 local
4537 Tpl.Text txt;
4538 SCodeDump.SCodeDumpOptions a_options;
4539 SCode.ExternalDecl i_extdecl;
4540
4541 case ( txt,
4542 SOME(i_extdecl),
4543 a_options )
4544 algorithm
4545 7 txt := dumpExternalDecl(txt, i_extdecl, a_options);
4546 then txt;
4547
4548 case ( txt,
4549 _,
4550 _ )
4551 then txt;
4552 end match;
4553 end dumpExternalDeclOpt;
4554
4555 protected function fun_136
4556 input Tpl.Text in_txt;
4557 input Option<SCode.Ident> in_a_funcName;
4558
4559 output Tpl.Text out_txt;
4560 algorithm
4561 out_txt :=
4562 match(in_txt, in_a_funcName)
4563 local
4564 Tpl.Text txt;
4565 SCode.Ident i_name;
4566
4567 case ( txt,
4568 SOME(i_name) )
4569 algorithm
4570 ✗ txt := Tpl.writeStr(txt, i_name);
4571 then txt;
4572
4573 case ( txt,
4574 _ )
4575 then txt;
4576 end match;
4577 end fun_136;
4578
4579 protected function lm_137
4580 input output Tpl.Text txt;
4581 input list<Absyn.Exp> items;
4582 algorithm
4583
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 for lstElt_137 in items loop
4584 txt := match lstElt_137
4585 local
4586 Absyn.Exp i_arg;
4587
4588 case i_arg
4589 algorithm
4590 ✗ txt := AbsynDumpTpl.dumpExp(txt, i_arg);
4591 ✗ txt := Tpl.nextIter(txt);
4592 then txt;
4593 end match;
4594 end for;
4595 end lm_137;
4596
4597 protected function fun_138
4598 input Tpl.Text in_txt;
4599 input Boolean in_mArg;
4600 input Tpl.Text in_a_func__args__str;
4601 input Tpl.Text in_a_func__name__str;
4602
4603 output Tpl.Text out_txt;
4604 algorithm
4605 out_txt :=
4606 match(in_txt, in_mArg, in_a_func__args__str, in_a_func__name__str)
4607 local
4608 Tpl.Text txt;
4609 Tpl.Text a_func__args__str;
4610 Tpl.Text a_func__name__str;
4611
4612 case ( txt,
4613 true,
4614 _,
4615 _ )
4616 then txt;
4617
4618 case ( txt,
4619 _,
4620 a_func__args__str,
4621 a_func__name__str )
4622 algorithm
4623 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
4624 ✗ txt := Tpl.writeText(txt, a_func__name__str);
4625 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
4626 ✗ txt := Tpl.writeText(txt, a_func__args__str);
4627 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
4628 ✗ txt := Tpl.popBlock(txt);
4629 then txt;
4630 end match;
4631 end fun_138;
4632
4633 protected function fun_139
4634 input Tpl.Text in_txt;
4635 input Option<String> in_a_lang;
4636
4637 output Tpl.Text out_txt;
4638 algorithm
4639 out_txt :=
4640 match(in_txt, in_a_lang)
4641 local
4642 Tpl.Text txt;
4643 String i_l;
4644
4645 case ( txt,
4646 SOME(i_l) )
4647 algorithm
4648 7 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
4649 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
4650 7 txt := Tpl.writeStr(txt, i_l);
4651 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
4652 7 txt := Tpl.popBlock(txt);
4653 then txt;
4654
4655 case ( txt,
4656 _ )
4657 then txt;
4658 end match;
4659 end fun_139;
4660
4661 protected function fun_140
4662 input Tpl.Text in_txt;
4663 input Option<Absyn.ComponentRef> in_a_output__;
4664
4665 output Tpl.Text out_txt;
4666 algorithm
4667 out_txt :=
4668 match(in_txt, in_a_output__)
4669 local
4670 Tpl.Text txt;
4671 Absyn.ComponentRef i_name;
4672
4673 case ( txt,
4674 SOME(i_name) )
4675 algorithm
4676 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
4677 ✗ txt := AbsynDumpTpl.dumpCref(txt, i_name);
4678 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ="));
4679 ✗ txt := Tpl.popBlock(txt);
4680 then txt;
4681
4682 case ( txt,
4683 _ )
4684 then txt;
4685 end match;
4686 end fun_140;
4687
4688 protected function fun_141
4689 input Tpl.Text in_txt;
4690 input SCode.ExternalDecl in_a_externalDecl;
4691 input SCodeDump.SCodeDumpOptions in_a_options;
4692
4693 output Tpl.Text out_txt;
4694 algorithm
4695 out_txt :=
4696 match(in_txt, in_a_externalDecl, in_a_options)
4697 local
4698 Tpl.Text txt;
4699 SCodeDump.SCodeDumpOptions a_options;
4700 Option<Absyn.ComponentRef> i_output__;
4701 Option<SCode.Annotation> i_annotation__;
4702 Option<String> i_lang;
4703 list<Absyn.Exp> i_args;
4704 Option<SCode.Ident> i_funcName;
4705 Tpl.Text l_output__str;
4706 Tpl.Text l_ann__str;
4707 Tpl.Text l_lang__str;
4708 Boolean ret_3;
4709 Tpl.Text l_func__str;
4710 Tpl.Text l_func__args__str;
4711 Tpl.Text l_func__name__str;
4712
4713 case ( txt,
4714 SCode.EXTERNALDECL(funcName = i_funcName, args = i_args, lang = i_lang, annotation_ = i_annotation__, output_ = i_output__),
4715 a_options )
4716 algorithm
4717 7 l_func__name__str := fun_136(Tpl.emptyTxt, i_funcName);
4718 7 l_func__args__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4719 7 l_func__args__str := lm_137(l_func__args__str, i_args);
4720 7 l_func__args__str := Tpl.popIter(l_func__args__str);
4721 7 ret_3 := Tpl.isEmpty(l_func__name__str);
4722 7 l_func__str := fun_138(Tpl.emptyTxt, ret_3, l_func__args__str, l_func__name__str);
4723 7 l_lang__str := fun_139(Tpl.emptyTxt, i_lang);
4724 7 l_ann__str := dumpAnnotationOpt(Tpl.emptyTxt, i_annotation__, a_options);
4725 7 l_output__str := fun_140(Tpl.emptyTxt, i_output__);
4726 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("external"));
4727 7 txt := Tpl.writeText(txt, l_lang__str);
4728 7 txt := Tpl.writeText(txt, l_output__str);
4729 7 txt := Tpl.writeText(txt, l_func__str);
4730 7 txt := Tpl.writeText(txt, l_ann__str);
4731 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
4732 then txt;
4733
4734 case ( txt,
4735 _,
4736 _ )
4737 then txt;
4738 end match;
4739 end fun_141;
4740
4741 protected function fun_142
4742 input Tpl.Text in_txt;
4743 input SCodeDump.SCodeDumpOptions in_a_options;
4744 input Tpl.Text in_a_res;
4745
4746 output Tpl.Text out_txt;
4747 algorithm
4748 out_txt :=
4749 match(in_txt, in_a_options, in_a_res)
4750 local
4751 Tpl.Text txt;
4752 Tpl.Text a_res;
4753
4754 case ( txt,
4755 SCodeDump.OPTIONS(stripExternalDecl = false),
4756 a_res )
4757 algorithm
4758 ✗ txt := Tpl.writeText(txt, a_res);
4759 then txt;
4760
4761 case ( txt,
4762 _,
4763 _ )
4764 then txt;
4765 end match;
4766 end fun_142;
4767
4768 protected function fun_143
4769 input Tpl.Text in_txt;
4770 input SCode.ExternalDecl in_a_externalDecl;
4771 input SCodeDump.SCodeDumpOptions in_a_options;
4772 input Tpl.Text in_a_res;
4773
4774 output Tpl.Text out_txt;
4775 algorithm
4776 out_txt :=
4777 match(in_txt, in_a_externalDecl, in_a_options, in_a_res)
4778 local
4779 Tpl.Text txt;
4780 SCodeDump.SCodeDumpOptions a_options;
4781 Tpl.Text a_res;
4782
4783 case ( txt,
4784 SCode.EXTERNALDECL(lang = SOME("builtin")),
4785 _,
4786 a_res )
4787 algorithm
4788 7 txt := Tpl.writeText(txt, a_res);
4789 then txt;
4790
4791 case ( txt,
4792 _,
4793 a_options,
4794 a_res )
4795 algorithm
4796 ✗ txt := fun_142(txt, a_options, a_res);
4797 then txt;
4798 end match;
4799 end fun_143;
4800
4801 public function dumpExternalDecl
4802 input Tpl.Text txt;
4803 input SCode.ExternalDecl a_externalDecl;
4804 input SCodeDump.SCodeDumpOptions a_options;
4805
4806 output Tpl.Text out_txt;
4807 protected
4808 Tpl.Text l_res;
4809 algorithm
4810 7 l_res := fun_141(Tpl.emptyTxt, a_externalDecl, a_options);
4811 7 out_txt := fun_143(txt, a_externalDecl, a_options, l_res);
4812 end dumpExternalDecl;
4813
4814 public function dumpCommentOpt
4815 input Tpl.Text in_txt;
4816 input Option<SCode.Comment> in_a_comment;
4817 input SCodeDump.SCodeDumpOptions in_a_options;
4818
4819 output Tpl.Text out_txt;
4820 algorithm
4821 out_txt :=
4822 match(in_txt, in_a_comment, in_a_options)
4823 local
4824 Tpl.Text txt;
4825 SCodeDump.SCodeDumpOptions a_options;
4826 SCode.Comment i_cmt;
4827
4828 case ( txt,
4829 SOME(i_cmt),
4830 a_options )
4831 algorithm
4832 ✗ txt := dumpComment(txt, i_cmt, a_options);
4833 then txt;
4834
4835 case ( txt,
4836 _,
4837 _ )
4838 then txt;
4839 end match;
4840 end dumpCommentOpt;
4841
4842 public function dumpComment
4843 input Tpl.Text in_txt;
4844 input SCode.Comment in_a_comment;
4845 input SCodeDump.SCodeDumpOptions in_a_options;
4846
4847 output Tpl.Text out_txt;
4848 algorithm
4849 out_txt :=
4850 match(in_txt, in_a_comment, in_a_options)
4851 local
4852 Tpl.Text txt;
4853 SCodeDump.SCodeDumpOptions a_options;
4854 Option<String> i_comment;
4855 Option<SCode.Annotation> i_annotation__;
4856 Tpl.Text l_cmt__str;
4857 Tpl.Text l_ann__str;
4858
4859 case ( txt,
4860 SCode.COMMENT(annotation_ = i_annotation__, comment = i_comment),
4861 a_options )
4862 algorithm
4863 1795 l_ann__str := dumpAnnotationOpt(Tpl.emptyTxt, i_annotation__, a_options);
4864 1795 l_cmt__str := dumpCommentStr(Tpl.emptyTxt, i_comment, a_options);
4865 1795 txt := Tpl.writeText(txt, l_cmt__str);
4866 1795 txt := Tpl.writeText(txt, l_ann__str);
4867 then txt;
4868
4869 case ( txt,
4870 _,
4871 _ )
4872 then txt;
4873 end match;
4874 end dumpComment;
4875
4876 protected function fun_147
4877 input Tpl.Text in_txt;
4878 input Option<String> in_a_comment;
4879
4880 output Tpl.Text out_txt;
4881 algorithm
4882 out_txt :=
4883 match(in_txt, in_a_comment)
4884 local
4885 Tpl.Text txt;
4886 String i_cmt;
4887 String ret_0;
4888
4889 case ( txt,
4890 SOME(i_cmt) )
4891 algorithm
4892 1133 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
4893 1133 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
4894 1133 ret_0 := System.escapedString(i_cmt, false);
4895 1133 txt := Tpl.writeStr(txt, ret_0);
4896 1133 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
4897 then txt;
4898
4899 case ( txt,
4900 _ )
4901 then txt;
4902 end match;
4903 end fun_147;
4904
4905 protected function fun_148
4906 input Tpl.Text in_txt;
4907 input SCodeDump.SCodeDumpOptions in_a_options;
4908 input Option<String> in_a_comment;
4909
4910 output Tpl.Text out_txt;
4911 algorithm
4912 out_txt :=
4913 match(in_txt, in_a_options, in_a_comment)
4914 local
4915 Tpl.Text txt;
4916 Option<String> a_comment;
4917
4918 case ( txt,
4919 SCodeDump.OPTIONS(stripStringComments = false),
4920 a_comment )
4921 algorithm
4922 2136 txt := fun_147(txt, a_comment);
4923 then txt;
4924
4925 case ( txt,
4926 _,
4927 _ )
4928 then txt;
4929 end match;
4930 end fun_148;
4931
4932 public function dumpCommentStr
4933 input Tpl.Text txt;
4934 input Option<String> a_comment;
4935 input SCodeDump.SCodeDumpOptions a_options;
4936
4937 output Tpl.Text out_txt;
4938 algorithm
4939 2160 out_txt := fun_148(txt, a_options, a_comment);
4940 end dumpCommentStr;
4941
4942 public function errorMsg
4943 input Tpl.Text txt;
4944 input String a_errMessage;
4945
4946 output Tpl.Text out_txt;
4947 algorithm
4948 ✗ Tpl.addTemplateError(a_errMessage);
4949 ✗ out_txt := Tpl.writeStr(txt, a_errMessage);
4950 end errorMsg;
4951
4952 annotation(__OpenModelica_Interface="frontend_dump");
4953 end SCodeDumpTpl;
4954