Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 70
Functions: -% 0 / 0 / 0
Branches: -% 0 / 0 / 0

OMCompiler/Compiler/Template/AbsynJLDumpTpl.tpl
Line Branch Exec Source
1 /*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC),
5 * c/o Linköpings universitet, Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF AGPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8.
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13 * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GNU AGPL
14 * VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the OSMC (Open Source Modelica Consortium)
17 * Public License (OSMC-PL) are obtained from OSMC, either from the above
18 * address, from the URLs:
19 * http://www.openmodelica.org or
20 * https://github.com/OpenModelica/ or
21 * http://www.ida.liu.se/projects/OpenModelica,
22 * and in the OpenModelica distribution.
23 *
24 * GNU AGPL version 3 is obtained from:
25 * https://www.gnu.org/licenses/licenses.html#GPL
26 *
27 * This program is distributed WITHOUT ANY WARRANTY; without
28 * even the implied warranty of MERCHANTABILITY or FITNESS
29 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
30 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
31 *
32 * See the full OSMC Public License conditions for more details.
33 *
34 */
35
36 package AbsynJLDumpTpl
37 "
38 This program dumps the AST into a Julia representation
39 "
40 import interface AbsynDumpTV;
41
42 ✗ template dump(Absyn.Program program)
43 ::=
44 let() = tmpTickReset(0)
45 let &preText = buffer ""
46 let res = dump2(&preText, program, defaultDumpOptions)
47 <<
48 using Absyn
49 using MetaModelica
50
51 <%preText%>
52 <%res%>
53 >>
54 end dump;
55
56 ✗ template dump2(Text &preText, Absyn.Program program, DumpOptions options)
57 ::=
58 match program
59 case PROGRAM(classes = {}) then <<PROGRAM(list(), <%dumpWithin(within_)%>)>>
60 case PROGRAM(__) then
61 let within_str = dumpWithin(within_)
62 let cls_str = (classes |> cls =>
63 let ix = tmpTick()
64 let res = dumpClass(&preText, cls, options)
65 let &preText += 'tmp<%ix%> = <%res%><%\n%>'
66 'tmp<%ix%>' ; separator = ", ")
67 <<
68 PROGRAM(list(<%cls_str%>), <%within_str%>)<%\n%>
69 >>
70 end dump2;
71
72 ✗ template dumpClass(Text &preText, Absyn.Class cls, DumpOptions options)
73 ::= match cls
74 case CLASS(__) then
75 let n = name
76 let pp = dumpFinal(partialPrefix)
77 let fp = dumpFinal(finalPrefix)
78 let ep = dumpFinal(encapsulatedPrefix)
79 let r = dumpRestriction(restriction)
80 let cd = dumpClassDef(&preText, body, options)
81 let i = dumpInfo(info)
82 let ix = tmpTick()
83 let &preText += 'tmp<%ix%> = <%cd%><%\n%>'
84 <<
85 CLASS("<%n%>", <%pp%>, <%fp%> ,<%ep%>, <%r%>, tmp<%ix%>, <%i%>)
86 >>
87 end dumpClass;
88
89 ✗ template dumpClassDef(Text &preText, Absyn.ClassDef cdef, DumpOptions options)
90 ::=
91 match cdef
92 case PARTS(__) then
93 let tvs_str = (typeVars |> typevar => typevar ;separator=", ")
94 let ann_str = (listReverse(ann) |> a =>
95 let ix = tmpTick()
96 let res = dumpAnnotation(&preText, a)
97 let &preText += 'tmp<%ix%> = <%res%><%\n%>'
98 'tmp<%ix%>' ; separator=", ")
99 let cmt_str = dumpStringCommentOption(comment)
100 let body_str = (classParts |> class_part hasindex idx =>
101 let ix = tmpTick()
102 let res = dumpClassPart(&preText, class_part, options)
103 let &preText += 'tmp<%ix%> = <%res%><%\n%>'
104 'tmp<%ix%>' ; separator=", ")
105 let attr_str = (classAttrs |> e => dumpNamedArg(&preText, e) ;separator=", ")
106 'PARTS(list(<%tvs_str%>), list(<%attr_str%>), list(<%body_str%>), list(<%ann_str%>), <%cmt_str%>)'
107 case DERIVED(__) then
108 let attr_str = dumpElementAttr(&preText, attributes)
109 let ty_str = dumpTypeSpec(&preText, typeSpec)
110 let arg_str = '<%(arguments |> arg => dumpElementArg(&preText, arg) ;separator=", ")%>'
111 let cmt_str = dumpCommentOpt(&preText, comment)
112 'DERIVED(<%ty_str%>, <%attr_str%>, list(<%arg_str%>), <%cmt_str%>)'
113 case CLASS_EXTENDS(__) then
114 let body_str = (parts |> class_part hasindex idx =>
115 dumpClassPart(&preText, class_part, options) ;separator=", ")
116 let mod_str = if modifications then
117 '<%(modifications |> mod => dumpElementArg(&preText, mod) ;separator=", ")%>'
118 let cmt_str = dumpStringCommentOption(comment)
119 let ann_str = (listReverse(ann) |> a => dumpAnnotation(&preText, a) ;separator=", ")
120 'CLASS_EXTENDS("<%baseClassName%>", list(<%mod_str%>), <%cmt_str%>, list(<%body_str%>), list(<%ann_str%>))'
121 case ENUMERATION(__) then
122 let enum_str = dumpEnumDef(&preText, enumLiterals)
123 let cmt_str = dumpCommentOpt(&preText, comment)
124 'ENUMERATION(<%enum_str%>, <%cmt_str%>)'
125 case OVERLOAD(__) then
126 let funcs_str = (functionNames |> fn => dumpPath(fn) ;separator=", ")
127 let cmt_str = dumpCommentOpt(&preText, comment)
128 'OVERLOAD(list(<%funcs_str%>), <%cmt_str%>)'
129 case PDER(__) then "NOT SUPPORTED???"
130 end dumpClassDef;
131
132 ✗ template dumpEnumDef(Text &preText, Absyn.EnumDef enum_def)
133 ::=
134 match enum_def
135 case ENUMLITERALS(__) then
136 let els = (enumLiterals |> lit => dumpEnumLiteral(&preText, lit) ;separator=", ")
137 'ENUMLITERALS(list(<%els%>))'
138 case ENUM_COLON() then 'ENUM_COLON()'
139 end dumpEnumDef;
140
141 ✗ template dumpEnumLiteral(Text &preText, Absyn.EnumLiteral lit)
142 ::=
143 match lit
144 case ENUMLITERAL(__) then
145 let cmt_str = dumpCommentOpt(&preText, comment)
146 'ENUMLITERAL("<%literal%>", <%cmt_str%>)'
147 end dumpEnumLiteral;
148
149
150 ✗ template dumpRestriction(Absyn.Restriction restriction)
151 ::=
152 match restriction
153 case R_CLASS(__) then 'R_CLASS()'
154 case R_OPTIMIZATION(__) then 'R_OPTIMIZATION()'
155 case R_MODEL(__) then 'R_MODEL()'
156 case R_RECORD(__) then 'R_RECORD()'
157 case R_BLOCK(__) then 'R_BLOCK()'
158 case R_CONNECTOR(__) then 'R_CONNECTOR()'
159 case R_EXP_CONNECTOR(__) then 'R_EXP_CONNECTOR()'
160 case R_TYPE(__) then 'R_TYPE()'
161 case R_PACKAGE(__) then 'R_PACKAGE()'
162 case R_FUNCTION(__) then
163 let prefix_str = match functionRestriction
164 case FR_NORMAL_FUNCTION(purity = IMPURE()) then 'FR_NORMAL_FUNCTION(IMPURE())'
165 case FR_NORMAL_FUNCTION(purity = PURE()) then 'FR_NORMAL_FUNCTION(PURE())'
166 case FR_NORMAL_FUNCTION(purity = NO_PURITY()) then 'FR_NORMAL_FUNCTION(NO_PURITY())'
167 case FR_OPERATOR_FUNCTION() then 'FR_OPERATOR_FUNCTION()'
168 case FR_PARALLEL_FUNCTION() then 'FR_PARALLEL_FUNCTION()'
169 case FR_KERNEL_FUNCTION() then 'FR_KERNEL_FUNCTION()'
170 'R_FUNCTION(<%prefix_str%>)'
171 case R_OPERATOR(__) then 'R_OPERATOR()'
172 case R_OPERATOR_RECORD(__) then 'R_OPERATOR_RECORD()'
173 case R_ENUMERATION(__) then 'R_ENUMERATION()'
174 case R_PREDEFINED_INTEGER(__) then 'R_PREDEFINED_INTEGER()'
175 case R_PREDEFINED_REAL(__) then 'R_PREDEFINED_REAL()'
176 case R_PREDEFINED_STRING(__) then 'R_PREDEFINED_STRING()'
177 case R_PREDEFINED_BOOLEAN(__) then 'R_PREDEFINED_BOOLEAN()'
178 case R_PREDEFINED_ENUMERATION(__) then 'R_PREDEFINED_ENUMERATION()'
179 case R_UNIONTYPE(__) then 'R_UNIONTYPE()'
180 case R_METARECORD(__) then "MR: Does not work"
181 case R_UNKNOWN(__) then 'R_UNKNOWN()'
182 end dumpRestriction;
183
184
185 ✗ template dumpClassPart(Text &preText, Absyn.ClassPart class_part, DumpOptions options)
186 ::=
187 match class_part
188 case PUBLIC(__) then
189 let el_str = (contents |> c => dumpElementItem(&preText, c, options);separator=", ")
190 'PUBLIC(list(<%el_str%>))'
191 case PROTECTED(__) then
192 let el_str = (contents |> c => dumpElementItem(&preText, c, options);separator=", ")
193 'PROTECTED(list(<%el_str%>))'
194 case CONSTRAINTS(__) then
195 let el_str = (contents |> exp => dumpExp(&preText, exp) ;separator=", ")
196 'CONSTRAINTS(<%el_str%>)'
197 case EQUATIONS(__) then
198 let el_str = (contents |> eq => dumpEquationItem(&preText, eq) ;separator=", ")
199 'EQUATIONS(list(<%el_str%>))'
200 case INITIALEQUATIONS(__) then
201 let el_str = (contents |> eq => dumpEquationItem(&preText, eq) ;separator=", ")
202 'INITIALEQUATIONS(list(<%el_str%>))'
203 case ALGORITHMS(__) then
204 let el_str = (contents |> eq => dumpAlgorithmItem(&preText, eq) ;separator=", ")
205 'ALGORITHMS(list(<%el_str%>))'
206 case INITIALALGORITHMS(__) then
207 let el_str = (contents |> eq => dumpAlgorithmItem(&preText, eq) ;separator=", ")
208 'INITIALALGORITHMS(list(<%el_str%>))'
209 case EXTERNAL(__) then
210 let ann_str = match annotation_ case SOME(ann) then 'SOME(<%dumpAnnotation(&preText, ann)%>)' else 'NONE()'
211 match externalDecl
212 case EXTERNALDECL(__) then
213 let fn_str = match funcName case SOME(fn) then 'SOME("<%fn%>")' else 'NONE()'
214 let lang_str = match lang case SOME(l) then 'SOME("<%l%>")' else 'NONE()'
215 let output_str = match output_ case SOME(o) then 'SOME(<%dumpCref(&preText, o)%>)' else 'NONE()'
216 let args_str = (args |> arg => dumpExp(&preText, arg) ;separator=", ")
217 let ann2_str = dumpAnnotationOptSpace(&preText, annotation_)
218 'EXTERNAL(EXTERNALDECL(<%fn_str%>, <%lang_str%>, <%output_str%>, list(<%args_str%>), <%ann2_str%>), <%ann_str%>)'
219 end dumpClassPart;
220
221 ✗ template dumpWithin(Absyn.Within within)
222 ::=
223 match within
224 case TOP(__) then 'TOP()'
225 case WITHIN(__) then 'WITHIN(<%dumpPath(path)%>)'
226 end dumpWithin;
227
228 ✗ template dumpInfo(builtin.SourceInfo info)
229 ::=
230 match info
231 case SOURCEINFO(__) then
232 let rm_str = if isReadOnly then "true" else "false"
233 'SOURCEINFO("<%fileName%>", <%rm_str%>, <%lineNumberStart%>, <%columnNumberStart%>, <%lineNumberEnd%>, <%columnNumberEnd%>)'
234 end dumpInfo;
235
236 ✗ template dumpAnnotation(Text &preText, Absyn.Annotation ann)
237 ::=
238 match ann
239 case ANNOTATION(elementArgs={}) then "ANNOTATION(list())"
240 case ANNOTATION(__) then 'ANNOTATION(list(<%(elementArgs |> earg => dumpElementArg(&preText, earg) ;separator=', ')%>))'
241 end dumpAnnotation;
242
243 ✗ template dumpAnnotationOpt(Text &preText, Option<Absyn.Annotation> oann)
244 ::= match oann case SOME(ann) then 'SOME(<%dumpAnnotation(&preText, ann)%>)' else 'NONE()'
245 end dumpAnnotationOpt;
246
247 ✗ template dumpAnnotationOptSpace(Text &preText, Option<Absyn.Annotation> oann)
248 ::= match oann case SOME(ann) then 'SOME(<%dumpAnnotation(&preText, ann)%>)' else 'NONE()'
249 end dumpAnnotationOptSpace;
250
251 ✗ template dumpComment(Text &preText, Absyn.Comment cmt)
252 ::=
253 match cmt
254 case COMMENT(__) then 'COMMENT(<%dumpStringCommentOption(comment)%>, <%dumpAnnotationOptSpace(&preText, annotation_)%>)'
255 end dumpComment;
256
257 ✗ template dumpCommentOpt(Text &preText, Option<Absyn.Comment> ocmt)
258 ::= match ocmt case SOME(cmt) then 'SOME(<%dumpComment(&preText, cmt)%>)' else 'NONE()'
259 end dumpCommentOpt;
260
261 ✗ template dumpElementArg(Text &preText, Absyn.ElementArg earg)
262 ::=
263 match earg
264 case MODIFICATION(__) then
265 let each_str = dumpEach(eachPrefix)
266 let final_str = dumpFinal(finalPrefix)
267 let path_str = dumpPath(path)
268 let mod_str = match modification case SOME(mod) then 'SOME(<%dumpModification(&preText, mod)%>)' else 'NONE()'
269 let cmt_str = dumpStringCommentOption(comment)
270 let info_str = dumpInfo(info)
271 'MODIFICATION(<%final_str%>, <%each_str%>, <%path_str%>, <%mod_str%>, <%cmt_str%>, <%info_str%>)'
272 case REDECLARATION(__) then
273 let each_str = dumpEach(eachPrefix)
274 let final_str = dumpFinal(finalPrefix)
275 let redecl_str = dumpRedeclare(redeclareKeywords)
276 let elem_str = dumpElementSpec(&preText, elementSpec, defaultDumpOptions)
277 let cc_str = match constrainClass case SOME(cc) then 'SOME(<%dumpConstrainClass(&preText, cc)%>)' else 'NONE()'
278 let info_str = dumpInfo(info)
279 'REDECLARATION(<%final_str%>, <%redecl_str%>, <%each_str%>, <%elem_str%>, <%cc_str%>, <%info_str%>)'
280 end dumpElementArg;
281
282 ✗ template dumpEach(Absyn.Each each)
283 ::= match each case EACH() then "EACH()" else "NON_EACH()"
284 end dumpEach;
285
286 ✗ template dumpFinal(Boolean final)
287 ::= if final then "true" else "false"
288 end dumpFinal;
289
290 ✗ template dumpRedeclare(Absyn.RedeclareKeywords redecl)
291 ::=
292 match redecl
293 case REDECLARE() then "REDECLARE()"
294 case REPLACEABLE then "REPLACEABLE()"
295 case REDECLARE_REPLACEABLE() then "REDECLARE_REPLACEABLE()"
296 end dumpRedeclare;
297
298 ✗ template dumpReplaceable(Absyn.RedeclareKeywords repl)
299 ::=
300 match repl
301 case REPLACEABLE() then "REPLACEABLE()"
302 case REDECLARE_REPLACEABLE() then "REDECLARE_REPLACEABLE()"
303 end dumpReplaceable;
304
305 ✗ template dumpInnerOuter(Absyn.InnerOuter io)
306 ::=
307 match io
308 case INNER() then "INNER()"
309 case OUTER() then "OUTER()"
310 case INNER_OUTER() then "INNER_OUTER()"
311 case NOT_INNER_OUTER() then "NOT_INNER_OUTER()"
312 end dumpInnerOuter;
313
314 ✗ template dumpModification(Text &preText, Absyn.Modification mod)
315 ::=
316 match mod
317 case CLASSMOD(__) then
318 let arg_str = (elementArgLst |> earg => dumpElementArg(&preText, earg) ;separator=", ")
319 let eq_str = dumpEqMod(&preText, eqMod)
320 'CLASSMOD(list(<%arg_str%>), <%eq_str%>)'
321 end dumpModification;
322
323 ✗ template dumpEqMod(Text &preText, Absyn.EqMod eqmod)
324 ::= match eqmod
325 case EQMOD(__) then
326 let exp_str = dumpExp(&preText, exp)
327 let info_str = dumpInfo(info)
328 'EQMOD(<%exp_str%>, <%info_str%>)'
329 case NOMOD(__) then
330 "NOMOD()"
331 end dumpEqMod;
332
333 ✗ template dumpElementSpec(Text &preText, Absyn.ElementSpec elem, DumpOptions options)
334 ::=
335 match elem
336 case CLASSDEF(__) then
337 'CLASSDEF(<%replaceable_%>, <%dumpClass(&preText, class_, options)%>)'
338 case EXTENDS(__) then
339 let bc_str = dumpPath(path)
340 let args_str = (elementArg |> earg => dumpElementArg(&preText, earg) ;separator=", ")
341 let ann_str = dumpAnnotationOptSpace(&preText, annotationOpt)
342 'EXTENDS(<%bc_str%>, list(<%args_str%>), <%ann_str%>)'
343 case COMPONENTS(__) then
344 let ty_str = dumpTypeSpec(&preText, typeSpec)
345 let attr_str = dumpElementAttr(&preText, attributes)
346 let comps_str = (components |> comp => dumpComponentItem(&preText, comp) ;separator=", ")
347 'COMPONENTS(<%attr_str%>, <%ty_str%>, list(<%comps_str%>))'
348 case IMPORT(__) then
349 let cmt_str = dumpCommentOpt(&preText, comment)
350 let info_str = dumpInfo(info)
351 'IMPORT(<%dumpImport(import_)%>, <%cmt_str%>, <%info_str%>)'
352 end dumpElementSpec;
353
354 ✗ template dumpElementAttr(Text &preText, Absyn.ElementAttributes attr)
355 ::=
356 match attr
357 case ATTR(__) then
358 let flow_str = if flowPrefix then "true" else "false"
359 let stream_str = if streamPrefix then "true" else "false"
360 let par_str = dumpParallelism(parallelism)
361 let field_str = dumpIsField(isField)
362 let var_str = dumpVariability(variability)
363 let dir_str = dumpDirection(direction)
364 let array_dim = dumpArrayDim(&preText, arrayDim)
365 'ATTR(<%flow_str%>, <%stream_str%>, <%par_str%>, <%var_str%>, <%dir_str%>, <%field_str%>, <%array_dim%>)'
366 end dumpElementAttr;
367
368 ✗ template dumpParallelism(Absyn.Parallelism par)
369 ::=
370 match par
371 case PARGLOBAL() then "PARGLOBAL()"
372 case PARLOCAL() then "PARGLOBAL()"
373 case NON_PARALLEL() then "NON_PARALLEL()"
374 end dumpParallelism;
375
376 ✗ template dumpIsField(Absyn.IsField isField)
377 ::=
378 match isField
379 case NONFIELD() then "NONFIELD()"
380 case FIELD() then "FIELD()"
381 end dumpIsField;
382
383 ✗ template dumpVariability(Absyn.Variability var)
384 ::=
385 match var
386 case VAR() then "VAR()"
387 case DISCRETE() then "DISCRETE()"
388 case PARAM() then "PARAM()"
389 case CONST() then "CONST()"
390 end dumpVariability;
391
392 ✗ template dumpDirection(Absyn.Direction dir)
393 ::=
394 match dir
395 case BIDIR() then "BIDIR()"
396 case INPUT() then "INPUT()"
397 case OUTPUT() then "OUTPUT()"
398 case INPUT_OUTPUT() then "INPUT_OUTPUT()"
399 end dumpDirection;
400
401 ✗ template dumpElementAttrDim(Text &preText, Absyn.ElementAttributes attr)
402 ::= match attr case ATTR(__) then dumpSubscripts(&preText, arrayDim)
403 end dumpElementAttrDim;
404
405 ✗ template dumpConstrainClass(Text &preText, Absyn.ConstrainClass cc)
406 ::=
407 match cc
408 case CONSTRAINCLASS(__) then
409 let cmt_str = dumpCommentOpt(&preText, comment)
410 'CONSTRAINCLASS(<%dumpElementSpec(&preText, elementSpec, defaultDumpOptions)%>, <%cmt_str%>)'
411 end dumpConstrainClass;
412
413 ✗ template dumpComponentItem(Text &preText, Absyn.ComponentItem comp)
414 ::=
415 match comp
416 case COMPONENTITEM(__) then
417 let comp_str = dumpComponent(&preText, component)
418 let cond_str = dumpComponentCondition(&preText, condition)
419 let cmt = dumpCommentOpt(&preText, comment)
420 let ix = tmpTick()
421 let &preText += 'tmp<%ix%> = <%comp_str%><%\n%>'
422 'COMPONENTITEM(tmp<%ix%>, <%cond_str%>, <%cmt%>)'
423 end dumpComponentItem;
424
425 ✗ template dumpComponent(Text &preText, Absyn.Component comp)
426 ::=
427 match comp
428 case COMPONENT(__) then
429 let dim_str = dumpSubscripts(&preText, arrayDim)
430 let mod_str = match modification case SOME(mod) then 'SOME(<%dumpModification(&preText, mod)%>)' else 'NONE()'
431 'COMPONENT("<%Util.escapeModelicaStringToJLString(name)%>", <%dim_str%>, <%mod_str%>)'
432 end dumpComponent;
433
434 ✗ template dumpComponentCondition(Text &preText, Option<Absyn.ComponentCondition> cond)
435 ::= match cond case SOME(cexp) then 'SOME(<%dumpExp(&preText, cexp)%>)' else 'NONE()'
436 end dumpComponentCondition;
437
438 ✗ template dumpImport(Absyn.Import imp)
439 ::=
440 match imp
441 case NAMED_IMPORT(__) then 'NAMED_IMPORT("<%Util.escapeModelicaStringToJLString(name)%>", <%dumpPath(path)%>)'
442 case QUAL_IMPORT(__) then 'QUAL_IMPORT(<%dumpPath(path)%>)'
443 case UNQUAL_IMPORT(__) then 'UNQUAL_IMPORT(<%dumpPath(path)%>)'
444 case GROUP_IMPORT(__) then
445 let prefix_str = dumpPath(prefix)
446 let groups_str = (groups |> group => dumpGroupImport(group) ;separator=",")
447 'GROUP_IMPORT(<%prefix_str%>, list(<%groups_str%>))'
448 end dumpImport;
449
450 ✗ template dumpGroupImport(Absyn.GroupImport gimp)
451 ::=
452 match gimp
453 case GROUP_IMPORT_NAME(__) then 'GROUP_IMPORT_NAME("<%Util.escapeModelicaStringToJLString(name)%>")'
454 case GROUP_IMPORT_RENAME(__) then 'GROUP_IMPORT_RENAME("<%Util.escapeModelicaStringToJLString(rename)%>", "<%Util.escapeModelicaStringToJLString(name)%>")'
455 end dumpGroupImport;
456
457 ✗ template dumpElementItem(Text &preText, Absyn.ElementItem eitem, DumpOptions options)
458 ::=
459 match eitem
460 case ELEMENTITEM(__) then 'ELEMENTITEM(<%dumpElement(&preText, element, options)%>)'
461 case LEXER_COMMENT(__) then 'LEXER_COMMENT("<%Util.escapeModelicaStringToJLString(System.trimWhitespace(comment))%>")'
462 end dumpElementItem;
463
464 ✗ template dumpElement(Text &preText, Absyn.Element elem, DumpOptions options)
465 ::=
466 match elem
467 case ELEMENT(__) then
468 if boolOr(boolUnparseFileFromInfo(info, options), boolNot(isClassdef(elem))) then
469 let final_str = dumpFinal(finalPrefix)
470 let redecl_str = match redeclareKeywords case SOME(re) then 'SOME(<%dumpRedeclare(re)%>)' else 'NONE()'
471 let repl_str = match redeclareKeywords case SOME(re) then 'SOME(<%dumpReplaceable(re)%>)' else 'NONE()'
472 let io_str = dumpInnerOuter(innerOuter)
473 let ec_str = dumpElementSpec(&preText, specification, options)
474 let cc_str = match constrainClass case SOME(cc) then 'SOME(<%dumpConstrainClass(&preText, cc)%>)' else 'NONE()'
475 let info_str = dumpInfo(info)
476 'ELEMENT(<%finalPrefix%>, <%redecl_str%>, <%io_str%>, <%ec_str%>, <%info_str%>, <%cc_str%>)'
477 case DEFINEUNIT(__) then
478 let args_str = if args then '<%(args |> arg => dumpNamedArg(&preText, arg))%>'
479 'DEFINEUNIT("<%Util.escapeModelicaStringToJLString(name)%>", list(<%args_str%>))'
480 case TEXT(__) then
481 if boolUnparseFileFromInfo(info, options) then
482 let name_str = match optName case SOME(name) then 'SOME(name)' else 'NONE()'
483 let info_str = dumpInfo(info)
484 let string_str = string
485 'TEXT("<%name_str%>","<%string_str%>",<%info_str%>)'
486 end dumpElement;
487
488 ✗ template dumpEquationItem(Text &preText, Absyn.EquationItem eq)
489 ::=
490 match eq
491 case EQUATIONITEM(__) then
492 let eq_str = dumpEquation(&preText, equation_)
493 let cmt_str = dumpCommentOpt(&preText, comment)
494 let info_str = dumpInfo(info)
495 'EQUATIONITEM(<%eq_str%>, <%cmt_str%>, <%info_str%>)'
496 case EQUATIONITEMCOMMENT(__) then 'EQUATIONITEMCOMMENT("<%Util.escapeModelicaStringToJLString(System.trimWhitespace(comment))%>")'
497 end dumpEquationItem;
498
499 ✗ template dumpEquationItems(Text &preText, list<Absyn.EquationItem> eql)
500 ::= (eql |> eq => dumpEquationItem(&preText, eq) ;separator=", ")
501 end dumpEquationItems;
502
503 ✗ template dumpEquation(Text &preText, Absyn.Equation eq)
504 ::=
505 match eq
506 case EQ_IF(__) then
507 let if_str = dumpExp(&preText, ifExp)
508 let eq_true_str = dumpEquationItems(&preText, equationTrueItems)
509 let elseif_str = (elseIfBranches |> (c, b) =>
510 'tuple(<%dumpExp(&preText, c)%>, list(<%dumpEquationItems(&preText, b)%>))' ;separator=", ")
511 let else_branch_str = dumpEquationItems(&preText, equationElseItems)
512 'EQ_IF(<%if_str%>, list(<%eq_true_str%>), list(<%elseif_str%>), list(<%else_branch_str%>))'
513 case EQ_EQUALS(__) then
514 let lhs = dumpLhsExp(&preText, leftSide)
515 let rhs = dumpExp(&preText, rightSide)
516 'EQ_EQUALS(<%lhs%>, <%rhs%>)'
517 case EQ_PDE(__) then
518 let lhs = dumpLhsExp(&preText, leftSide)
519 let rhs = dumpExp(&preText, rightSide)
520 let domain_str = dumpCref(&preText, domain)
521 'EQ_PDE(<%lhs%>, <%rhs%>, <%domain_str%>)'
522 case EQ_CONNECT(__) then
523 let c1_str = dumpCref(&preText, connector1)
524 let c2_str = dumpCref(&preText, connector2)
525 'EQ_CONNECT(<%c1_str%>, <%c2_str%>)'
526 case EQ_FOR(__) then
527 let iter_str = dumpForIterators(&preText, iterators)
528 let body_str = dumpEquationItems(&preText, forEquations)
529 'EQ_FOR(list(<%iter_str%>), list(<%body_str%>))'
530 case EQ_WHEN_E(__) then
531 let when_str = dumpExp(&preText, whenExp)
532 let elsewhen_eqs_str = (elseWhenEquations |> (c, b) =>
533 'tuple(<%dumpExp(&preText, c)%>, list(<%dumpEquationItems(&preText, b)%>))' ;separator=", ")
534 let when_eqs = dumpEquationItems(&preText, whenEquations)
535 'EQ_WHEN_E(<%when_str%>, list(<%when_eqs%>),list(<%elsewhen_eqs_str%>))'
536 case EQ_NORETCALL(__) then
537 let name_str = dumpCref(&preText, functionName)
538 let args_str = dumpFunctionArgs(&preText, functionArgs)
539 'EQ_NORETCALL(<%name_str%>, <%args_str%>)'
540 case EQ_FAILURE(__) then
541 let eq_str = dumpEquationItem(&preText, equ)
542 'EQ_FAILURE(<%eq_str%>)'
543 end dumpEquation;
544
545 ✗ template dumpAlgorithmItems(Text &preText, list<Absyn.AlgorithmItem> algs)
546 ::=
547 let items = (algs |> alg => dumpAlgorithmItem(&preText, alg) ;separator=", ")
548 'list(<%items%>)'
549 end dumpAlgorithmItems;
550
551 ✗ template dumpAlgorithmItem(Text &preText, Absyn.AlgorithmItem alg)
552 ::=
553 match alg
554 case ALGORITHMITEM(__) then
555 let alg_str = dumpAlgorithm(&preText, algorithm_)
556 let cmt_str = dumpCommentOpt(&preText, comment)
557 let info_str = dumpInfo(info)
558 let ix = tmpTick()
559 let &preText += 'tmp<%ix%> = <%alg_str%><%\n%>'
560 'ALGORITHMITEM(tmp<%ix%>, <%cmt_str%>, <%info_str%>)'
561 case ALGORITHMITEMCOMMENT(__) then 'ALGORITHMITEMCOMMENT("I am useless. I am a comment")'
562 end dumpAlgorithmItem;
563
564 ✗ template dumpAlgorithm(Text &preText, Absyn.Algorithm alg)
565 ::=
566 match alg
567 case ALG_ASSIGN(__) then
568 let lhs_str = dumpLhsExp(&preText, assignComponent)
569 let rhs_str = dumpExp(&preText, value)
570 'ALG_ASSIGN(<%lhs_str%>, <%rhs_str%>)'
571 case ALG_IF(__) then
572 let if_str = dumpExp(&preText, ifExp)
573 let true_branch = dumpAlgorithmItems(&preText, trueBranch)
574 let else_if_alg_branch = (elseIfAlgorithmBranch |> (c, b) =>
575 '(<%dumpExp(&preText, c)%>, <%dumpAlgorithmItems(&preText, b)%>)' ;separator=", ")
576 let else_branch_str = dumpAlgorithmItems(&preText, elseBranch)
577 let else_branch = dumpAlgorithmItems(&preText, elseBranch)
578 'ALG_IF(<%if_str%>, <%true_branch%>, list(<%else_if_alg_branch%>), <%else_branch%>)'
579 case ALG_FOR(__) then
580 let iter_str = dumpForIterators(&preText, iterators)
581 let body_str = dumpAlgorithmItems(&preText, forBody)
582 'ALG_FOR(list(<%iter_str%>), <%body_str%>)'
583 case ALG_PARFOR(__) then
584 let iter_str = dumpForIterators(&preText, iterators)
585 let body_str = dumpAlgorithmItems(&preText, parforBody)
586 'ALG_PARFOR(list(<%iter_str%>), <%body_str%>)'
587 case ALG_WHILE(__) then
588 'ALG_WHILE(<%dumpExp(&preText, boolExpr)%>, <%dumpAlgorithmItems(&preText, whileBody)%>)'
589 case ALG_WHEN_A(__) then
590 let ewab = (elseWhenAlgorithmBranch |> (c, b) =>
591 '(<%dumpExp(&preText, c)%>, <%dumpAlgorithmItems(&preText, b)%>)' ;separator=", ")
592 'ALG_WHEN_A(<%dumpExp(&preText, boolExpr)%>, <%dumpAlgorithmItems(&preText, whenBody)%>, list(<%ewab%>))'
593 case ALG_NORETCALL(__) then
594 let name_str = dumpCref(&preText, functionCall)
595 let args_str = dumpFunctionArgs(&preText, functionArgs)
596 'ALG_NORETCALL(<%name_str%>, <%args_str%>)'
597 case ALG_RETURN(__) then 'ALG_RETURN()'
598 case ALG_BREAK(__) then 'ALG_BREAK()'
599 case ALG_FAILURE(__) then
600 let arg_str = if equ then dumpAlgorithmItems(&preText, equ)
601 'ALG_FAILURE(<%arg_str%>)'
602 case ALG_TRY(__) then 'ALG_TRY(<%dumpAlgorithmItems(&preText, body)%>, <%dumpAlgorithmItems(&preText, elseBody)%>)'
603 case ALG_CONTINUE(__) then 'ALG_CONTINUE()'
604 end dumpAlgorithm;
605
606 ✗ template dumpPath(Absyn.Path path)
607 ::=
608 match path
609 case FULLYQUALIFIED(__) then
610 'FULLYQUALIFIED(<%dumpPath(path)%>)'
611 case QUALIFIED(__) then
612 if (Flags.getConfigBool(Flags.MODELICA_OUTPUT)) then
613 'QUALIFIED("<%Util.escapeModelicaStringToJLString(name)%>", <%dumpPath(path)%>)'
614 else
615 'IDENT("<%Util.escapeModelicaStringToJLString(name)%>")'
616 case IDENT(__) then
617 'IDENT("<%Util.escapeModelicaStringToJLString(name)%>")'
618 else
619 errorMsg("SCodeDump.dumpPath: Unknown path.")
620 end dumpPath;
621
622 ✗ template dumpPathNoQual(Absyn.Path path)
623 ::=
624 match path
625 case FULLYQUALIFIED(__) then 'FULLYQUALIFIED(<%dumpPath(path)%>)'
626 else dumpPath(path)
627 end dumpPathNoQual;
628
629 ✗ template dumpStringCommentOption(Option<String> cmt)
630 ::= match cmt case SOME(str) then 'SOME("<%str%>")' else 'NONE()'
631 end dumpStringCommentOption;
632
633 ✗ template dumpTypeSpec(Text &preText, Absyn.TypeSpec typeSpec)
634 ::=
635 match typeSpec
636 case TPATH(__) then
637 let path_str = dumpPath(path)
638 let arraydim_str = dumpArrayDimOpt(&preText, arrayDim)
639 'TPATH(<%path_str%>, <%arraydim_str%>)'
640 case TCOMPLEX(__) then
641 let path_str = dumpPath(path)
642 let ty_str = (typeSpecs |> ty => dumpTypeSpec(&preText, ty) ;separator=", ")
643 let arraydim_str = dumpArrayDimOpt(&preText, arrayDim)
644 'TCOMPLEX(<%path_str%>, list(<%ty_str%>), <%arraydim_str%>)'
645 end dumpTypeSpec;
646
647 ✗ template dumpArrayDimOpt(Text &preText, Option<Absyn.ArrayDim> arraydim)
648 ::= match arraydim case SOME(ad) then 'SOME(<%dumpSubscripts(&preText, ad)%>)' else 'NONE()'
649 end dumpArrayDimOpt;
650
651 ✗ template dumpArrayDim(Text &preText, Absyn.ArrayDim arraydim)
652 ::= dumpSubscripts(&preText, arraydim)
653 end dumpArrayDim;
654
655 ✗ template dumpSubscripts(Text &preText, list<Subscript> subscripts)
656 ::= let sub_str = (subscripts |> s => dumpSubscript(&preText, s) ;separator=", ")
657 'list(<%sub_str%>)'
658 end dumpSubscripts;
659
660 ✗ template dumpSubscript(Text &preText, Absyn.Subscript subscript)
661 ::=
662 match subscript
663 case NOSUB(__) then 'NOSUB()'
664 case SUBSCRIPT(__) then 'SUBSCRIPT(<%dumpExp(&preText, subscript)%>)'
665 end dumpSubscript;
666
667 ✗ template dumpExp(Text &preText, Absyn.Exp exp)
668 ::=
669 match exp
670 case INTEGER(__) then 'INTEGER(<%value%>)'
671 case REAL(__) then 'REAL("<%value%>")'
672 case CREF(__) then 'CREF(<%dumpCref(&preText, componentRef)%>)'
673 case STRING(__) then 'STRING("<%Util.escapeModelicaStringToJLString(value)%>")'
674 case BOOL(__) then 'BOOL(<%value%>)'
675 case e as BINARY(__) then
676 let lhs_str = dumpOperand(&preText, exp1, e, true)
677 let rhs_str = dumpOperand(&preText, exp2, e, false)
678 let op_str = dumpOperator(op)
679 'BINARY(<%lhs_str%>, <%op_str%>, <%rhs_str%>)'
680 case e as UNARY(__) then
681 let exp_str = dumpOperand(&preText, exp, e, false)
682 let op_str = dumpOperator(op)
683 'UNARY(<%op_str%>, <%exp_str%>)'
684 case e as LBINARY(__) then
685 let lhs_str = dumpOperand(&preText, exp1, e, true)
686 let rhs_str = dumpOperand(&preText, exp2, e, false)
687 let op_str = dumpOperator(op)
688 'LBINARY(<%lhs_str%>, <%op_str%>, <%rhs_str%>)'
689 case e as LUNARY(__) then
690 let exp_str = dumpOperand(&preText, exp, e, false)
691 let op_str = dumpOperator(op)
692 'LUNARY(<%op_str%>, <%exp_str%>)'
693 case e as RELATION(__) then
694 let lhs_str = dumpOperand(&preText, exp1, e, true)
695 let rhs_str = dumpOperand(&preText, exp2, e, false)
696 let op_str = dumpOperator(op)
697 'RELATION(<%lhs_str%>, <%op_str%>, <%rhs_str%>)'
698 case IFEXP(__) then dumpIfExp(&preText, exp)
699 case CALL(function_=Absyn.CREF_IDENT(name="$array")) then
700 let args_str = dumpFunctionArgs(&preText, functionArgs)
701 'CALL(CREF_IDENT("<%Util.escapeModelicaStringToJLString("array")%>", list()) ,<%args_str%>)'
702 case CALL(__) then
703 let func_str = dumpCref(&preText, function_)
704 let args_str = dumpFunctionArgs(&preText, functionArgs)
705 'CALL(<%func_str%>, <%args_str%>)'
706 case PARTEVALFUNCTION(__) then
707 let func_str = dumpCref(&preText, function_)
708 let args_str = dumpFunctionArgs(&preText, functionArgs)
709 'PARTEVALFUNCTION(<%func_str%>, <%args_str%>)'
710 case ARRAY(__) then
711 let array_str = (arrayExp |> e => dumpExp(&preText, e) ;separator=", ")
712 'ARRAY(list(<%array_str%>))'
713 case MATRIX(__) then
714 let matrix_str = (matrix |> row =>
715 'list(<%(row |> e => dumpExp(&preText, e) ;separator=", ")%>)' ;separator=", ")
716 'MATRIX(list(<%matrix_str%>))'
717 case e as RANGE(step = SOME(step)) then
718 let start_str = dumpOperand(&preText, start, e, false)
719 let step_str = dumpOperand(&preText, step, e, false)
720 let stop_str = dumpOperand(&preText, stop, e, false)
721 'RANGE(<%start_str%>, SOME(<%step_str%>), <%stop_str%>)'
722 case e as RANGE(step = NONE()) then
723 let start_str = dumpOperand(&preText, start, e, false)
724 let stop_str = dumpOperand(&preText, stop, e, false)
725 'RANGE(<%start_str%>, NONE(), <%stop_str%>)'
726 case TUPLE(__) then
727 let tuple_str = (expressions |> e => dumpExp(&preText, e); separator=", " ;empty)
728 'TUPLE(list(<%tuple_str%>))'
729 case END(__) then 'END()'
730 case CODE(__) then 'CODE(<%dumpCodeNode(&preText, code)%>)'
731 case AS(__) then
732 let exp_str = dumpExp(&preText, exp)
733 'AS(<%id%>, <%exp_str%>)'
734 case CONS(__) then
735 let head_str = dumpExp(&preText, head)
736 let rest_str = dumpExp(&preText, rest)
737 'CONS(<%head_str%>, <%rest_str%>)'
738 case MATCHEXP(__) then dumpMatchExp(&preText, exp)
739 case LIST(__) then
740 let list_str = (exps |> e => dumpExp(&preText, e) ;separator=", ")
741 'LIST(list(<%list_str%>))'
742 case DOT(__) then
743 'DOT(<%dumpExp(&preText, exp)%>, <%dumpExp(&preText, index)%>)'
744 case _ then '/* AbsynDumpTpl.dumpExp: UNHANDLED Abyn.Exp */'
745 end dumpExp;
746
747 ✗ template dumpLhsExp(Text &preText, Absyn.Exp lhs)
748 ::=
749 match lhs
750 case IFEXP(__) then '(<%dumpExp(&preText, lhs)%>)'
751 else dumpExp(&preText, lhs)
752 end dumpLhsExp;
753
754 ✗ template dumpOperand(Text &preText, Absyn.Exp operand, Absyn.Exp operation, Boolean lhs)
755 ::= dumpExp(&preText, operand)
756 end dumpOperand;
757
758 ✗ template dumpIfExp(Text &preText, Absyn.Exp if_exp)
759 ::=
760 match if_exp
761 case IFEXP(__) then
762 let cond_str = dumpExp(&preText, ifExp)
763 let true_branch_str = dumpExp(&preText, trueBranch)
764 let else_branch_str = dumpExp(&preText, elseBranch)
765 let else_if_str = dumpElseIfExp(&preText, elseIfBranch)
766 'IFEXP(<%cond_str%>, <%true_branch_str%>, <%else_branch_str%>, <%else_if_str%>)'
767 end dumpIfExp;
768
769 ✗ template dumpElseIfExp(Text &preText, list<tuple<Absyn.Exp, Absyn.Exp>> else_if)
770 ::=
771 let lst = else_if |> eib as (cond, branch) =>
772 let cond_str = dumpExp(&preText, cond)
773 let branch_str = dumpExp(&preText, branch)
774 '(<%cond_str%>, <%branch_str%>)' ;separator=", "
775 'list(<%lst%>)'
776 end dumpElseIfExp;
777
778 ✗ template dumpCodeNode(Text &preText, Absyn.CodeNode code)
779 ::=
780 match code
781 case C_TYPENAME(__) then 'C_TYPENAME(<%dumpPath(path)%>)'
782 case C_VARIABLENAME(__) then 'C_VARIABLENAME(dumpCref(componentRef))'
783 case C_CONSTRAINTSECTION(__) then
784 let initial_str = if boolean then "true" else "false"
785 let equation_is_str = dumpEquationItems(&preText, equationItemLst)
786 'C_CONSTRAINTSECTION(<%initial_str%>, list(<%equation_is_str%>))'
787 case C_EQUATIONSECTION(__) then
788 let initial_str = if boolean then "true" else "false"
789 let eql_str = dumpEquationItems(&preText, equationItemLst)
790 'C_EQUATIONSECTION(<%initial_str%>, list(<%eql_str%>))'
791 case C_ALGORITHMSECTION(__) then
792 let initial_str = if boolean then "true" else "false"
793 let algs_str = dumpAlgorithmItems(&preText, algorithmItemLst)
794 'C_ALGORITHMSECTION(<%initial_str%>, list(<%algs_str%>))'
795 case C_EXPRESSION(__) then 'C_EXPRESSION(<%dumpExp(&preText, exp)%>)'
796 case C_MODIFICATION(__) then 'C_MODIFICATION(<%dumpModification(&preText, modification)%>'
797 case C_ELEMENT(__) then 'C_ELEMENT(<%dumpElement(&preText, element, Dump.defaultDumpOptions)%>)'
798 end dumpCodeNode;
799
800 ✗ template dumpMatchExp(Text &preText, Absyn.Exp match_exp)
801 ::=
802 match match_exp
803 case MATCHEXP(__) then
804 let ty_str = dumpMatchType(matchTy)
805 let input_str = dumpExp(&preText, inputExp)
806 let locals_str = dumpMatchLocals(&preText, localDecls)
807 let cases_str = (cases |> c => dumpMatchCase(&preText, c) ;separator=", ")
808 let cmt_str = dumpStringCommentOption(comment)
809 'MATCHEXP(<%ty_str%>, <%input_str%>, <%locals_str%>, <%cases_str%>, <%cmt_str%>)'
810 end dumpMatchExp;
811
812 ✗ template dumpMatchType(Absyn.MatchType match_type)
813 ::=
814 match match_type
815 case MATCH() then "MATCH()"
816 case MATCHCONTINUE() then "MATCHCONTINUE()"
817 end dumpMatchType;
818
819 ✗ template dumpMatchLocals(Text &preText, list<ElementItem> locals)
820 ::= if locals then
821 'list(<%(locals |> decl => dumpElementItem(&preText, decl, defaultDumpOptions) ;separator=", ")%>)'
822 end dumpMatchLocals;
823
824 ✗ template dumpMatchEquations(Text &preText, ClassPart cp)
825 ::=
826 match cp
827 case EQUATIONS(contents={}) then "EQUATIONS(list())"
828 case EQUATIONS(contents=eql) then
829 'EQUATIONS(<%(eql |> eq => dumpEquationItem(&preText, eq) ;separator=", ")%>)'
830 case ALGORITHMS(contents={}) then "ALGORITHMS(list())"
831 case ALGORITHMS(contents=algs) then
832 'ALGORITHMS(<%(algs |> alg => dumpAlgorithmItem(&preText, alg) ;separator=", ")%>)'
833 end dumpMatchEquations;
834
835 ✗ template dumpMatchCase(Text &preText, Absyn.Case c)
836 ::=
837 match c
838 case CASE(__) then
839 let pattern_str = dumpExp(&preText, pattern)
840 let guard_str = match patternGuard case SOME(g) then 'SOME(<%dumpExp(&preText, g)%>)' else 'NONE()'
841 let p_info_str = dumpInfo(patternInfo)
842 let local_decls_str = (localDecls |> d => dumpElementItem(&preText, d, defaultDumpOptions);separator=", ")
843 let eql_str = dumpMatchEquations(&preText, classPart)
844 let result_str = dumpExp(&preText, result)
845 let r_i_str = dumpInfo(resultInfo)
846 let cmt_str = dumpStringCommentOption(comment)
847 let i_str = dumpInfo(info)
848 'CASE(<%pattern_str%>, <%guard_str%>, <%p_info_str%>, list(<%local_decls_str%>), <%eql_str%>, <%result_str%>, <%r_i_str%>, <%cmt_str%>, <%i_str%>)'
849 case ELSE(__) then
850 let local_decls_str = (localDecls |> d => dumpElementItem(&preText, d, defaultDumpOptions);separator=", ")
851 let eql_str = dumpMatchEquations(&preText, classPart)
852 let result_str = dumpExp(&preText, result)
853 let cmt_str = dumpStringCommentOption(comment)
854 let r_i_str = dumpInfo(resultInfo)
855 let info_str = dumpInfo(info)
856 'ELSE(<%local_decls_str%>, <%eql_str%>, <%result_str%>, <%r_i_str%>, <%cmt_str%>, <%info_str%>)'
857 end dumpMatchCase;
858
859 ✗ template dumpOperator(Absyn.Operator op)
860 ::=
861 match op
862 case ADD(__) then 'ADD()'
863 case ADD_EW(__) then 'ADD_EW()'
864 case AND(__) then 'AND()'
865 case DIV(__) then 'DIV()'
866 case DIV_EW(__) then 'DIV_EW()'
867 case EQUAL(__) then 'EQUAL()'
868 case GREATER(__) then 'GREATER()'
869 case GREATEREQ(__) then 'GREATEREQ()'
870 case LESS(__) then 'LESS()'
871 case LESSEQ(__) then 'LESSEQ()'
872 case MUL(__) then 'MUL()'
873 case MUL_EW(__) then 'MUL_EW()'
874 case NEQUAL(__) then 'NEQUAL()'
875 case NOT(__) then 'NOT()'
876 case OR(__) then 'OR()'
877 case POW(__) then 'POW()'
878 case POW_EW(__) then 'POW_EW()'
879 case SUB(__) then 'SUB()'
880 case SUB_EW(__) then 'SUB_EW()'
881 case UMINUS(__) then 'UMINUS()'
882 case UMINUS_EW(__) then 'UMINUS_EW()'
883 case UPLUS(__) then 'UPLUS()'
884 case UPLUS_EW(__) then 'UPLUS_EW()'
885 end dumpOperator;
886
887 ✗ template dumpCref(Text &preText, Absyn.ComponentRef cref)
888 ::=
889 match cref
890 case CREF_QUAL(__) then 'CREF_QUAL("<%Util.escapeModelicaStringToJLString(name)%>", <%dumpSubscripts(&preText, subscripts)%>, <%dumpCref(&preText, componentRef)%>)'
891 case CREF_IDENT(__) then 'CREF_IDENT("<%Util.escapeModelicaStringToJLString(name)%>", <%dumpSubscripts(&preText, subscripts)%>)'
892 case CREF_FULLYQUALIFIED(__) then 'CREF_FULLYQUALIFIED(<%dumpCref(&preText, componentRef)%>)'
893 case WILD(__) then if Config.acceptMetaModelicaGrammar() then "WILD()" else "WILD()"
894 case ALLWILD(__) then 'ALLWILD()'
895 end dumpCref;
896
897 ✗ template dumpFunctionArgs(Text &preText, Absyn.FunctionArgs args)
898 ::=
899 match args
900 case FUNCTIONARGS(__) then
901 let args_str = (args |> arg => dumpExp(&preText, arg) ;separator=", ")
902 let namedargs_str = (argNames |> narg => dumpNamedArg(&preText, narg) ;separator=", ")
903 'FUNCTIONARGS(list(<%args_str%>), list(<%namedargs_str%>))'
904 case FOR_ITER_FARG(__) then
905 let exp_str = dumpExp(&preText, exp)
906 let iter_str = (iterators |> i => dumpForIterator(&preText, i) ;separator=", ")
907 let iter_type_str = match iterType case THREAD() then "THREAD()" else "COMBINE()"
908 'FOR_ITER_FARG(<%exp_str%>, <%iter_type_str%>, list(<%iter_str%>))'
909 end dumpFunctionArgs;
910
911 ✗ template dumpNamedArg(Text &preText, Absyn.NamedArg narg)
912 ::= match narg case NAMEDARG(__) then 'NAMEDARG("<%argName%>", <%dumpExp(&preText, argValue)%>)'
913 end dumpNamedArg;
914
915 ✗ template dumpForIterators(Text &preText, Absyn.ForIterators iters)
916 ::= (iters |> i => dumpForIterator(&preText, i) ;separator=", ")
917 end dumpForIterators;
918
919 ✗ template dumpForIterator(Text &preText, Absyn.ForIterator iterator)
920 ::=
921 match iterator case ITERATOR(__) then
922 let ge = match guardExp case SOME(x) then 'SOME(<%dumpExp(&preText, x)%>)' else 'NONE()'
923 let re = match range case SOME(x) then 'SOME(<%dumpExp(&preText, x)%>)' else 'NONE()'
924 'ITERATOR("<%Util.escapeModelicaStringToJLString(name)%>", <%ge%>, <%re%>)'
925 end dumpForIterator;
926
927 ✗ template errorMsg(String errMessage)
928 ::=
929 let() = Tpl.addTemplateError(errMessage)
930 <<
931 <%errMessage%>
932 >>
933 end errorMsg;
934
935 annotation(__OpenModelica_Interface="frontend");
936
937 end AbsynJLDumpTpl;
938