build_cmake/OMCompiler/Compiler/generated-mo/Template/AbsynToJulia.mo
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | encapsulated package AbsynToJulia | ||
| 2 | " | ||
| 3 | file: AbsynToJulia.mo | ||
| 4 | package: AbsynToJulia | ||
| 5 | description: Generated by Susan. | ||
| 6 | " | ||
| 7 | |||
| 8 | public import Tpl; | ||
| 9 | |||
| 10 | public import Static; | ||
| 11 | public import Absyn; | ||
| 12 | public import Config; | ||
| 13 | public import Dump; | ||
| 14 | public import System; | ||
| 15 | public import Flags; | ||
| 16 | public import MMToJuliaUtil; | ||
| 17 | public import AbsynUtil; | ||
| 18 | public import Util; | ||
| 19 | public import AbsynToSCode; | ||
| 20 | public import SCode; | ||
| 21 | public import SCodeDump; | ||
| 22 | public import DAE; | ||
| 23 | public import Expression; | ||
| 24 | protected import AbsynDumpTpl; | ||
| 25 | |||
| 26 | protected function lm_17 | ||
| 27 | input output Tpl.Text txt; | ||
| 28 | input list<Absyn.Class> items; | ||
| 29 | algorithm | ||
| 30 | ✗ | for lstElt_17 in items loop | |
| 31 | txt := match lstElt_17 | ||
| 32 | local | ||
| 33 | Absyn.Class i_cls; | ||
| 34 | |||
| 35 | case i_cls | ||
| 36 | algorithm | ||
| 37 | ✗ | txt := dumpClass(txt, i_cls, Dump.defaultDumpOptions); | |
| 38 | ✗ | txt := Tpl.nextIter(txt); | |
| 39 | then txt; | ||
| 40 | end match; | ||
| 41 | end for; | ||
| 42 | end lm_17; | ||
| 43 | |||
| 44 | public function dumpProgram | ||
| 45 | input Tpl.Text in_txt; | ||
| 46 | input Absyn.Program in_a_program; | ||
| 47 | |||
| 48 | output Tpl.Text out_txt; | ||
| 49 | algorithm | ||
| 50 | out_txt := | ||
| 51 | match(in_txt, in_a_program) | ||
| 52 | local | ||
| 53 | Tpl.Text txt; | ||
| 54 | list<Absyn.Class> i_classes; | ||
| 55 | Tpl.Text l_cls__str; | ||
| 56 | |||
| 57 | case ( txt, | ||
| 58 | Absyn.PROGRAM(classes = {}) ) | ||
| 59 | then txt; | ||
| 60 | |||
| 61 | case ( txt, | ||
| 62 | Absyn.PROGRAM(classes = i_classes) ) | ||
| 63 | algorithm | ||
| 64 | ✗ | l_cls__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING_LIST({ | |
| 65 | "\n", | ||
| 66 | "\n" | ||
| 67 | }, true)), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | ||
| 68 | ✗ | l_cls__str := lm_17(l_cls__str, i_classes); | |
| 69 | ✗ | l_cls__str := Tpl.popIter(l_cls__str); | |
| 70 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 71 | ✗ | txt := Tpl.writeText(txt, l_cls__str); | |
| 72 | ✗ | txt := Tpl.popBlock(txt); | |
| 73 | then txt; | ||
| 74 | |||
| 75 | case ( txt, | ||
| 76 | _ ) | ||
| 77 | then txt; | ||
| 78 | end match; | ||
| 79 | end dumpProgram; | ||
| 80 | |||
| 81 | public function dumpSCodeElements | ||
| 82 | input Tpl.Text txt; | ||
| 83 | input list<SCode.Element> a_elements; | ||
| 84 | |||
| 85 | output Tpl.Text out_txt; | ||
| 86 | protected | ||
| 87 | list<SCode.Element> ret_0; | ||
| 88 | algorithm | ||
| 89 | ✗ | ret_0 := SCodeDump.filterElements(a_elements, SCodeDump.defaultOptions); | |
| 90 | ✗ | out_txt := dumpSCodeElements2(txt, ret_0); | |
| 91 | end dumpSCodeElements; | ||
| 92 | |||
| 93 | protected function fun_20 | ||
| 94 | input Tpl.Text in_txt; | ||
| 95 | input SCode.Element in_a_el; | ||
| 96 | |||
| 97 | output Tpl.Text out_txt; | ||
| 98 | algorithm | ||
| 99 | out_txt := | ||
| 100 | match(in_txt, in_a_el) | ||
| 101 | local | ||
| 102 | Tpl.Text txt; | ||
| 103 | list<SCode.Element> i_parts_elementLst; | ||
| 104 | SCode.Ident i_name; | ||
| 105 | |||
| 106 | case ( txt, | ||
| 107 | SCode.CLASS(restriction = SCode.R_UNIONTYPE(), name = i_name) ) | ||
| 108 | algorithm | ||
| 109 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@UniontypeDecl ")); | |
| 110 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 111 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 112 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 113 | then txt; | ||
| 114 | |||
| 115 | case ( txt, | ||
| 116 | SCode.CLASS(classDef = SCode.PARTS(elementLst = i_parts_elementLst), partialPrefix = SCode.NOT_PARTIAL(), restriction = SCode.R_FUNCTION()) ) | ||
| 117 | algorithm | ||
| 118 | ✗ | txt := dumpSCodeElements2(txt, i_parts_elementLst); | |
| 119 | then txt; | ||
| 120 | |||
| 121 | case ( txt, | ||
| 122 | SCode.CLASS(partialPrefix = SCode.PARTIAL(), restriction = SCode.R_FUNCTION(), name = i_name) ) | ||
| 123 | algorithm | ||
| 124 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 125 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = Function")); | |
| 126 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 127 | then txt; | ||
| 128 | |||
| 129 | case ( txt, | ||
| 130 | _ ) | ||
| 131 | then txt; | ||
| 132 | end match; | ||
| 133 | end fun_20; | ||
| 134 | |||
| 135 | protected function lm_21 | ||
| 136 | input output Tpl.Text txt; | ||
| 137 | input list<SCode.Element> items; | ||
| 138 | algorithm | ||
| 139 | ✗ | for lstElt_21 in items loop | |
| 140 | txt := match lstElt_21 | ||
| 141 | local | ||
| 142 | SCode.Element i_el; | ||
| 143 | |||
| 144 | case i_el | ||
| 145 | algorithm | ||
| 146 | ✗ | txt := fun_20(txt, i_el); | |
| 147 | then txt; | ||
| 148 | end match; | ||
| 149 | end for; | ||
| 150 | end lm_21; | ||
| 151 | |||
| 152 | protected function fun_22 | ||
| 153 | input Tpl.Text in_txt; | ||
| 154 | input Boolean in_mArg; | ||
| 155 | input Tpl.Text in_a_str; | ||
| 156 | |||
| 157 | output Tpl.Text out_txt; | ||
| 158 | algorithm | ||
| 159 | out_txt := | ||
| 160 | match(in_txt, in_mArg, in_a_str) | ||
| 161 | local | ||
| 162 | Tpl.Text txt; | ||
| 163 | Tpl.Text a_str; | ||
| 164 | |||
| 165 | case ( txt, | ||
| 166 | true, | ||
| 167 | _ ) | ||
| 168 | then txt; | ||
| 169 | |||
| 170 | case ( txt, | ||
| 171 | _, | ||
| 172 | a_str ) | ||
| 173 | algorithm | ||
| 174 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 175 | ✗ | txt := Tpl.writeText(txt, a_str); | |
| 176 | then txt; | ||
| 177 | end match; | ||
| 178 | end fun_22; | ||
| 179 | |||
| 180 | public function dumpSCodeElements2 | ||
| 181 | input Tpl.Text txt; | ||
| 182 | input list<SCode.Element> a_elements; | ||
| 183 | |||
| 184 | output Tpl.Text out_txt; | ||
| 185 | protected | ||
| 186 | Boolean ret_1; | ||
| 187 | Tpl.Text l_str; | ||
| 188 | algorithm | ||
| 189 | ✗ | l_str := lm_21(Tpl.emptyTxt, a_elements); | |
| 190 | ✗ | ret_1 := Tpl.isEmpty(l_str); | |
| 191 | ✗ | out_txt := fun_22(txt, ret_1, l_str); | |
| 192 | end dumpSCodeElements2; | ||
| 193 | |||
| 194 | public function dumpClass | ||
| 195 | input Tpl.Text txt; | ||
| 196 | input Absyn.Class a_cls; | ||
| 197 | input Dump.DumpOptions a_options; | ||
| 198 | |||
| 199 | output Tpl.Text out_txt; | ||
| 200 | algorithm | ||
| 201 | ✗ | out_txt := dumpClassElement(txt, a_cls, a_options, MMToJuliaUtil.noContext); | |
| 202 | end dumpClass; | ||
| 203 | |||
| 204 | protected function lm_25 | ||
| 205 | input output Tpl.Text txt; | ||
| 206 | input list<Absyn.ClassPart> items; | ||
| 207 | algorithm | ||
| 208 | ✗ | for lstElt_25 in items loop | |
| 209 | txt := match lstElt_25 | ||
| 210 | local | ||
| 211 | Absyn.ClassPart i_cp; | ||
| 212 | list<Absyn.ElementItem> ret_0; | ||
| 213 | |||
| 214 | case i_cp | ||
| 215 | algorithm | ||
| 216 | ✗ | ret_0 := AbsynUtil.getElementItemsInClassPart(i_cp); | |
| 217 | ✗ | txt := dumpReturnTypeJL(txt, ret_0); | |
| 218 | then txt; | ||
| 219 | end match; | ||
| 220 | end for; | ||
| 221 | end lm_25; | ||
| 222 | |||
| 223 | protected function lm_26 | ||
| 224 | input output Tpl.Text txt; | ||
| 225 | input list<Absyn.ClassPart> items; | ||
| 226 | algorithm | ||
| 227 | ✗ | for lstElt_26 in items loop | |
| 228 | txt := match lstElt_26 | ||
| 229 | local | ||
| 230 | Absyn.ClassPart i_cp; | ||
| 231 | list<Absyn.ElementItem> ret_0; | ||
| 232 | |||
| 233 | case i_cp | ||
| 234 | algorithm | ||
| 235 | ✗ | ret_0 := AbsynUtil.getElementItemsInClassPart(i_cp); | |
| 236 | ✗ | txt := dumpReturnStrJL(txt, ret_0, MMToJuliaUtil.functionContext); | |
| 237 | then txt; | ||
| 238 | end match; | ||
| 239 | end for; | ||
| 240 | end lm_26; | ||
| 241 | |||
| 242 | protected function lm_27 | ||
| 243 | input output Tpl.Text txt; | ||
| 244 | input list<Absyn.ClassPart> items; | ||
| 245 | algorithm | ||
| 246 | ✗ | for lstElt_27 in items loop | |
| 247 | txt := match lstElt_27 | ||
| 248 | local | ||
| 249 | Absyn.ClassPart i_cp; | ||
| 250 | list<Absyn.ElementItem> ret_0; | ||
| 251 | |||
| 252 | case i_cp | ||
| 253 | algorithm | ||
| 254 | ✗ | ret_0 := AbsynUtil.getElementItemsInClassPart(i_cp); | |
| 255 | ✗ | txt := dumpInputsJL(txt, ret_0, MMToJuliaUtil.inputContext); | |
| 256 | then txt; | ||
| 257 | end match; | ||
| 258 | end for; | ||
| 259 | end lm_27; | ||
| 260 | |||
| 261 | protected function fun_28 | ||
| 262 | input Tpl.Text in_txt; | ||
| 263 | input Boolean in_mArg; | ||
| 264 | input Tpl.Text in_a_typevar__inputs; | ||
| 265 | input Tpl.Text in_a_inputs__str; | ||
| 266 | |||
| 267 | output Tpl.Text out_txt; | ||
| 268 | algorithm | ||
| 269 | out_txt := | ||
| 270 | match(in_txt, in_mArg, in_a_typevar__inputs, in_a_inputs__str) | ||
| 271 | local | ||
| 272 | Tpl.Text txt; | ||
| 273 | Tpl.Text a_typevar__inputs; | ||
| 274 | Tpl.Text a_inputs__str; | ||
| 275 | |||
| 276 | case ( txt, | ||
| 277 | true, | ||
| 278 | _, | ||
| 279 | a_inputs__str ) | ||
| 280 | algorithm | ||
| 281 | ✗ | txt := Tpl.writeText(txt, a_inputs__str); | |
| 282 | then txt; | ||
| 283 | |||
| 284 | case ( txt, | ||
| 285 | _, | ||
| 286 | a_typevar__inputs, | ||
| 287 | _ ) | ||
| 288 | algorithm | ||
| 289 | ✗ | txt := Tpl.writeText(txt, a_typevar__inputs); | |
| 290 | then txt; | ||
| 291 | end match; | ||
| 292 | end fun_28; | ||
| 293 | |||
| 294 | protected function fun_29 | ||
| 295 | input Tpl.Text in_txt; | ||
| 296 | input Boolean in_mArg; | ||
| 297 | input Tpl.Text in_a_returnType; | ||
| 298 | |||
| 299 | output Tpl.Text out_txt; | ||
| 300 | algorithm | ||
| 301 | out_txt := | ||
| 302 | match(in_txt, in_mArg, in_a_returnType) | ||
| 303 | local | ||
| 304 | Tpl.Text txt; | ||
| 305 | Tpl.Text a_returnType; | ||
| 306 | |||
| 307 | case ( txt, | ||
| 308 | true, | ||
| 309 | a_returnType ) | ||
| 310 | algorithm | ||
| 311 | ✗ | txt := Tpl.writeText(txt, a_returnType); | |
| 312 | then txt; | ||
| 313 | |||
| 314 | case ( txt, | ||
| 315 | _, | ||
| 316 | _ ) | ||
| 317 | then txt; | ||
| 318 | end match; | ||
| 319 | end fun_29; | ||
| 320 | |||
| 321 | protected function fun_30 | ||
| 322 | input Tpl.Text in_txt; | ||
| 323 | input Boolean in_a_encapsulatedPrefix; | ||
| 324 | |||
| 325 | output Tpl.Text out_txt; | ||
| 326 | algorithm | ||
| 327 | out_txt := | ||
| 328 | match(in_txt, in_a_encapsulatedPrefix) | ||
| 329 | local | ||
| 330 | Tpl.Text txt; | ||
| 331 | |||
| 332 | case ( txt, | ||
| 333 | false ) | ||
| 334 | then txt; | ||
| 335 | |||
| 336 | case ( txt, | ||
| 337 | _ ) | ||
| 338 | then txt; | ||
| 339 | end match; | ||
| 340 | end fun_30; | ||
| 341 | |||
| 342 | protected function fun_31 | ||
| 343 | input Tpl.Text in_txt; | ||
| 344 | input Boolean in_a_partialPrefix; | ||
| 345 | |||
| 346 | output Tpl.Text out_txt; | ||
| 347 | algorithm | ||
| 348 | out_txt := | ||
| 349 | match(in_txt, in_a_partialPrefix) | ||
| 350 | local | ||
| 351 | Tpl.Text txt; | ||
| 352 | |||
| 353 | case ( txt, | ||
| 354 | false ) | ||
| 355 | then txt; | ||
| 356 | |||
| 357 | case ( txt, | ||
| 358 | _ ) | ||
| 359 | algorithm | ||
| 360 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("#=TODO: Originally partial =# ")); | |
| 361 | then txt; | ||
| 362 | end match; | ||
| 363 | end fun_31; | ||
| 364 | |||
| 365 | protected function fun_32 | ||
| 366 | input Tpl.Text in_txt; | ||
| 367 | input Absyn.Restriction in_a_restriction; | ||
| 368 | input MMToJuliaUtil.Context in_a_context; | ||
| 369 | input Dump.DumpOptions in_a_options; | ||
| 370 | input Absyn.ClassDef in_a_parts; | ||
| 371 | |||
| 372 | output Tpl.Text out_txt; | ||
| 373 | algorithm | ||
| 374 | out_txt := | ||
| 375 | match(in_txt, in_a_restriction, in_a_context, in_a_options, in_a_parts) | ||
| 376 | local | ||
| 377 | Tpl.Text txt; | ||
| 378 | MMToJuliaUtil.Context a_context; | ||
| 379 | Dump.DumpOptions a_options; | ||
| 380 | Absyn.ClassDef a_parts; | ||
| 381 | MMToJuliaUtil.Context ret_0; | ||
| 382 | |||
| 383 | case ( txt, | ||
| 384 | Absyn.R_PACKAGE(), | ||
| 385 | _, | ||
| 386 | a_options, | ||
| 387 | a_parts ) | ||
| 388 | algorithm | ||
| 389 | ✗ | txt := dumpClassDef(txt, a_parts, MMToJuliaUtil.packageContext, a_options); | |
| 390 | then txt; | ||
| 391 | |||
| 392 | case ( txt, | ||
| 393 | Absyn.R_RECORD(), | ||
| 394 | _, | ||
| 395 | a_options, | ||
| 396 | a_parts ) | ||
| 397 | algorithm | ||
| 398 | ✗ | ret_0 := MMToJuliaUtil.makeUniontypeContext(""); | |
| 399 | ✗ | txt := dumpClassDef(txt, a_parts, ret_0, a_options); | |
| 400 | then txt; | ||
| 401 | |||
| 402 | case ( txt, | ||
| 403 | _, | ||
| 404 | a_context, | ||
| 405 | a_options, | ||
| 406 | a_parts ) | ||
| 407 | algorithm | ||
| 408 | ✗ | txt := dumpClassDef(txt, a_parts, a_context, a_options); | |
| 409 | then txt; | ||
| 410 | end match; | ||
| 411 | end fun_32; | ||
| 412 | |||
| 413 | protected function fun_33 | ||
| 414 | input Tpl.Text in_txt; | ||
| 415 | input Boolean in_mArg; | ||
| 416 | |||
| 417 | output Tpl.Text out_txt; | ||
| 418 | algorithm | ||
| 419 | out_txt := | ||
| 420 | match(in_txt, in_mArg) | ||
| 421 | local | ||
| 422 | Tpl.Text txt; | ||
| 423 | |||
| 424 | case ( txt, | ||
| 425 | true ) | ||
| 426 | then txt; | ||
| 427 | |||
| 428 | case ( txt, | ||
| 429 | _ ) | ||
| 430 | algorithm | ||
| 431 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("#= Necessary to write declarations for your uniontypes until Julia adds support for mutually recursive types =#")); | |
| 432 | then txt; | ||
| 433 | end match; | ||
| 434 | end fun_33; | ||
| 435 | |||
| 436 | protected function fun_34 | ||
| 437 | input Tpl.Text in_txt; | ||
| 438 | input Absyn.Restriction in_a_restriction; | ||
| 439 | input Tpl.Text in_a_cdef__str1; | ||
| 440 | input Tpl.Text in_a_forwardDeclarations; | ||
| 441 | input Tpl.Text in_a_inform; | ||
| 442 | |||
| 443 | output Tpl.Text out_txt; | ||
| 444 | algorithm | ||
| 445 | out_txt := | ||
| 446 | match(in_txt, in_a_restriction, in_a_cdef__str1, in_a_forwardDeclarations, in_a_inform) | ||
| 447 | local | ||
| 448 | Tpl.Text txt; | ||
| 449 | Tpl.Text a_cdef__str1; | ||
| 450 | Tpl.Text a_forwardDeclarations; | ||
| 451 | Tpl.Text a_inform; | ||
| 452 | |||
| 453 | case ( txt, | ||
| 454 | Absyn.R_PACKAGE(), | ||
| 455 | a_cdef__str1, | ||
| 456 | a_forwardDeclarations, | ||
| 457 | a_inform ) | ||
| 458 | algorithm | ||
| 459 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 460 | "\n", | ||
| 461 | "using MetaModelica\n", | ||
| 462 | "#= ExportAll is not good practice but it makes it so that we do not have to write export after each function :( =#\n", | ||
| 463 | "using ExportAll\n" | ||
| 464 | }, true)); | ||
| 465 | ✗ | txt := Tpl.writeText(txt, a_inform); | |
| 466 | ✗ | txt := Tpl.softNewLine(txt); | |
| 467 | ✗ | txt := Tpl.writeText(txt, a_forwardDeclarations); | |
| 468 | ✗ | txt := Tpl.softNewLine(txt); | |
| 469 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 470 | ✗ | txt := Tpl.writeText(txt, a_cdef__str1); | |
| 471 | ✗ | txt := Tpl.softNewLine(txt); | |
| 472 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 473 | "\n", | ||
| 474 | "#= So that we can use wildcard imports and named imports when they do occur. Not good Julia practice =#\n", | ||
| 475 | "@exportAll()" | ||
| 476 | }, false)); | ||
| 477 | then txt; | ||
| 478 | |||
| 479 | case ( txt, | ||
| 480 | _, | ||
| 481 | a_cdef__str1, | ||
| 482 | _, | ||
| 483 | _ ) | ||
| 484 | algorithm | ||
| 485 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 486 | ✗ | txt := Tpl.writeText(txt, a_cdef__str1); | |
| 487 | ✗ | txt := Tpl.popBlock(txt); | |
| 488 | then txt; | ||
| 489 | end match; | ||
| 490 | end fun_34; | ||
| 491 | |||
| 492 | protected function fun_35 | ||
| 493 | input Tpl.Text in_txt; | ||
| 494 | input Absyn.Restriction in_a_restriction; | ||
| 495 | |||
| 496 | output Tpl.Text out_txt; | ||
| 497 | algorithm | ||
| 498 | out_txt := | ||
| 499 | match(in_txt, in_a_restriction) | ||
| 500 | local | ||
| 501 | Tpl.Text txt; | ||
| 502 | |||
| 503 | case ( txt, | ||
| 504 | Absyn.R_RECORD() ) | ||
| 505 | algorithm | ||
| 506 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("begin")); | |
| 507 | then txt; | ||
| 508 | |||
| 509 | case ( txt, | ||
| 510 | _ ) | ||
| 511 | then txt; | ||
| 512 | end match; | ||
| 513 | end fun_35; | ||
| 514 | |||
| 515 | protected function lm_36 | ||
| 516 | input output Tpl.Text txt; | ||
| 517 | input list<Absyn.ElementArg> items; | ||
| 518 | input MMToJuliaUtil.Context a_context; | ||
| 519 | algorithm | ||
| 520 | ✗ | for lstElt_36 in items loop | |
| 521 | txt := match lstElt_36 | ||
| 522 | local | ||
| 523 | Absyn.ElementArg i_earg; | ||
| 524 | |||
| 525 | case i_earg | ||
| 526 | algorithm | ||
| 527 | ✗ | txt := dumpElementArg(txt, i_earg, a_context); | |
| 528 | ✗ | txt := Tpl.nextIter(txt); | |
| 529 | then txt; | ||
| 530 | end match; | ||
| 531 | end for; | ||
| 532 | end lm_36; | ||
| 533 | |||
| 534 | protected function lm_37 | ||
| 535 | input output Tpl.Text txt; | ||
| 536 | input list<Absyn.ElementArg> items; | ||
| 537 | input MMToJuliaUtil.Context a_context; | ||
| 538 | algorithm | ||
| 539 | ✗ | for lstElt_37 in items loop | |
| 540 | txt := match lstElt_37 | ||
| 541 | local | ||
| 542 | Absyn.ElementArg i_earg; | ||
| 543 | |||
| 544 | case i_earg | ||
| 545 | algorithm | ||
| 546 | ✗ | txt := dumpElementArg(txt, i_earg, a_context); | |
| 547 | ✗ | txt := Tpl.nextIter(txt); | |
| 548 | then txt; | ||
| 549 | end match; | ||
| 550 | end for; | ||
| 551 | end lm_37; | ||
| 552 | |||
| 553 | public function dumpClassElement | ||
| 554 | input Tpl.Text in_txt; | ||
| 555 | input Absyn.Class in_a_class; | ||
| 556 | input Dump.DumpOptions in_a_options; | ||
| 557 | input MMToJuliaUtil.Context in_a_context; | ||
| 558 | |||
| 559 | output Tpl.Text out_txt; | ||
| 560 | algorithm | ||
| 561 | out_txt := | ||
| 562 | match(in_txt, in_a_class, in_a_options, in_a_context) | ||
| 563 | local | ||
| 564 | Tpl.Text txt; | ||
| 565 | Dump.DumpOptions a_options; | ||
| 566 | MMToJuliaUtil.Context a_context; | ||
| 567 | Absyn.ElementAttributes i_parts_attributes; | ||
| 568 | list<Absyn.ElementArg> i_parts_arguments; | ||
| 569 | Absyn.TypeSpec i_parts_typeSpec; | ||
| 570 | Option<Absyn.Comment> i_parts_comment_1; | ||
| 571 | Boolean i_partialPrefix; | ||
| 572 | Boolean i_encapsulatedPrefix; | ||
| 573 | Absyn.Restriction i_restriction; | ||
| 574 | list<Absyn.ClassPart> i_parts_classParts; | ||
| 575 | Absyn.Ident i_name; | ||
| 576 | Absyn.ClassDef i_parts; | ||
| 577 | Option<String> i_parts_comment; | ||
| 578 | Tpl.Text l_name__of__new__function; | ||
| 579 | Tpl.Text l_attr; | ||
| 580 | Tpl.Text l_args; | ||
| 581 | Tpl.Text l_spec; | ||
| 582 | Tpl.Text l_comment; | ||
| 583 | Tpl.Text l_partial__str__and__class__type; | ||
| 584 | Tpl.Text l_footer__str; | ||
| 585 | Tpl.Text l_header__str; | ||
| 586 | Tpl.Text l_cmt__str; | ||
| 587 | Tpl.Text l_cdef__str; | ||
| 588 | Tpl.Text l_begin__str; | ||
| 589 | Tpl.Text l_cdef__str2; | ||
| 590 | Boolean ret_20; | ||
| 591 | Tpl.Text l_inform; | ||
| 592 | list<SCode.Element> ret_18; | ||
| 593 | Tpl.Text l_forwardDeclarations; | ||
| 594 | Tpl.Text l_cdef__str1; | ||
| 595 | Tpl.Text l_class__type__str; | ||
| 596 | Tpl.Text l_partial__str; | ||
| 597 | Tpl.Text l_enc__str; | ||
| 598 | Boolean ret_12; | ||
| 599 | Boolean ret_11; | ||
| 600 | MMToJuliaUtil.Context ret_10; | ||
| 601 | Tpl.Text l_functionBodyStr; | ||
| 602 | Tpl.Text l_header; | ||
| 603 | String ret_7; | ||
| 604 | Tpl.Text l_typevar__inputs; | ||
| 605 | Tpl.Text l_inputs__str; | ||
| 606 | Tpl.Text l_return__str; | ||
| 607 | Tpl.Text l_returnType; | ||
| 608 | MMToJuliaUtil.Context ret_2; | ||
| 609 | Tpl.Text l_class__def__str; | ||
| 610 | Tpl.Text l_commentStr; | ||
| 611 | |||
| 612 | case ( txt, | ||
| 613 | Absyn.CLASS(body = (i_parts as Absyn.PARTS(comment = i_parts_comment)), restriction = Absyn.R_UNIONTYPE(), name = i_name), | ||
| 614 | a_options, | ||
| 615 | _ ) | ||
| 616 | algorithm | ||
| 617 | ✗ | l_commentStr := dumpCommentStrOpt(Tpl.emptyTxt, i_parts_comment); | |
| 618 | ✗ | ret_2 := MMToJuliaUtil.makeUniontypeContext(i_name); | |
| 619 | ✗ | l_class__def__str := dumpClassDef(Tpl.emptyTxt, i_parts, ret_2, a_options); | |
| 620 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 621 | ✗ | txt := Tpl.writeText(txt, l_commentStr); | |
| 622 | ✗ | txt := Tpl.softNewLine(txt); | |
| 623 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@Uniontype ")); | |
| 624 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 625 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE(" begin\n")); | |
| 626 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 627 | ✗ | txt := Tpl.writeText(txt, l_class__def__str); | |
| 628 | ✗ | txt := Tpl.softNewLine(txt); | |
| 629 | ✗ | txt := Tpl.popBlock(txt); | |
| 630 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 631 | ✗ | txt := Tpl.popBlock(txt); | |
| 632 | then txt; | ||
| 633 | |||
| 634 | case ( txt, | ||
| 635 | Absyn.CLASS(partialPrefix = true, restriction = Absyn.R_FUNCTION(functionRestriction = _)), | ||
| 636 | _, | ||
| 637 | _ ) | ||
| 638 | then txt; | ||
| 639 | |||
| 640 | case ( txt, | ||
| 641 | Absyn.CLASS(partialPrefix = false, body = (i_parts as Absyn.PARTS(comment = i_parts_comment, classParts = i_parts_classParts)), restriction = (i_restriction as Absyn.R_FUNCTION(functionRestriction = _)), name = i_name), | ||
| 642 | a_options, | ||
| 643 | _ ) | ||
| 644 | algorithm | ||
| 645 | ✗ | l_commentStr := dumpCommentStrOpt(Tpl.emptyTxt, i_parts_comment); | |
| 646 | ✗ | l_returnType := lm_25(Tpl.emptyTxt, i_parts_classParts); | |
| 647 | ✗ | l_return__str := lm_26(Tpl.emptyTxt, i_parts_classParts); | |
| 648 | ✗ | l_inputs__str := lm_27(Tpl.emptyTxt, i_parts_classParts); | |
| 649 | ✗ | ret_7 := System.stringReplace(Tpl.textString(l_inputs__str), "<:", ""); | |
| 650 | ✗ | l_typevar__inputs := Tpl.writeStr(Tpl.emptyTxt, ret_7); | |
| 651 | ✗ | l_header := dumpClassHeader(Tpl.emptyTxt, i_parts, i_restriction); | |
| 652 | ✗ | ret_10 := MMToJuliaUtil.makeFunctionContext(Tpl.textString(l_return__str)); | |
| 653 | ✗ | l_functionBodyStr := dumpClassDef(Tpl.emptyTxt, i_parts, ret_10, a_options); | |
| 654 | ✗ | txt := Tpl.writeText(txt, l_commentStr); | |
| 655 | ✗ | txt := Tpl.softNewLine(txt); | |
| 656 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("function ")); | |
| 657 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 658 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 659 | ✗ | ret_11 := Tpl.isEmpty(l_header); | |
| 660 | ✗ | txt := fun_28(txt, ret_11, l_typevar__inputs, l_inputs__str); | |
| 661 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(") ")); | |
| 662 | ✗ | ret_12 := Tpl.isEmpty(l_header); | |
| 663 | ✗ | txt := fun_29(txt, ret_12, l_returnType); | |
| 664 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 665 | ✗ | txt := Tpl.writeText(txt, l_header); | |
| 666 | ✗ | txt := Tpl.softNewLine(txt); | |
| 667 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 668 | ✗ | txt := Tpl.writeText(txt, l_functionBodyStr); | |
| 669 | ✗ | txt := Tpl.softNewLine(txt); | |
| 670 | ✗ | txt := Tpl.writeText(txt, l_return__str); | |
| 671 | ✗ | txt := Tpl.softNewLine(txt); | |
| 672 | ✗ | txt := Tpl.popBlock(txt); | |
| 673 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 674 | then txt; | ||
| 675 | |||
| 676 | case ( txt, | ||
| 677 | Absyn.CLASS(body = (i_parts as Absyn.PARTS(classParts = i_parts_classParts, comment = i_parts_comment)), encapsulatedPrefix = i_encapsulatedPrefix, partialPrefix = i_partialPrefix, restriction = i_restriction, name = i_name), | ||
| 678 | a_options, | ||
| 679 | a_context ) | ||
| 680 | algorithm | ||
| 681 | ✗ | l_enc__str := fun_30(Tpl.emptyTxt, i_encapsulatedPrefix); | |
| 682 | ✗ | l_partial__str := fun_31(Tpl.emptyTxt, i_partialPrefix); | |
| 683 | ✗ | l_class__type__str := dumpClassType(Tpl.emptyTxt, i_restriction); | |
| 684 | ✗ | l_cdef__str1 := fun_32(Tpl.emptyTxt, i_restriction, a_context, a_options, i_parts); | |
| 685 | ✗ | ret_18 := AbsynToSCode.translateClassdefElements(i_parts_classParts); | |
| 686 | ✗ | l_forwardDeclarations := dumpSCodeElements(Tpl.emptyTxt, ret_18); | |
| 687 | ✗ | ret_20 := Tpl.isEmpty(l_forwardDeclarations); | |
| 688 | ✗ | l_inform := fun_33(Tpl.emptyTxt, ret_20); | |
| 689 | ✗ | l_cdef__str2 := fun_34(Tpl.emptyTxt, i_restriction, l_cdef__str1, l_forwardDeclarations, l_inform); | |
| 690 | ✗ | l_begin__str := fun_35(Tpl.emptyTxt, i_restriction); | |
| 691 | ✗ | l_cdef__str := Tpl.writeText(Tpl.emptyTxt, l_cdef__str2); | |
| 692 | ✗ | l_cmt__str := dumpCommentStrOpt(Tpl.emptyTxt, i_parts_comment); | |
| 693 | ✗ | l_header__str := dumpClassHeader(Tpl.emptyTxt, i_parts, i_restriction); | |
| 694 | ✗ | l_footer__str := dumpClassFooter(Tpl.emptyTxt, i_parts, Tpl.textString(l_cdef__str), i_name, Tpl.textString(l_cmt__str), ""); | |
| 695 | ✗ | l_partial__str__and__class__type := Tpl.writeText(Tpl.emptyTxt, l_partial__str); | |
| 696 | ✗ | l_partial__str__and__class__type := Tpl.writeText(l_partial__str__and__class__type, l_class__type__str); | |
| 697 | ✗ | txt := Tpl.writeText(txt, l_partial__str__and__class__type); | |
| 698 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 699 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 700 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 701 | ✗ | txt := Tpl.writeText(txt, l_begin__str); | |
| 702 | ✗ | txt := Tpl.softNewLine(txt); | |
| 703 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 704 | ✗ | txt := Tpl.writeText(txt, l_header__str); | |
| 705 | ✗ | txt := Tpl.softNewLine(txt); | |
| 706 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 707 | ✗ | txt := Tpl.popBlock(txt); | |
| 708 | ✗ | txt := Tpl.writeText(txt, l_footer__str); | |
| 709 | then txt; | ||
| 710 | |||
| 711 | case ( txt, | ||
| 712 | Absyn.CLASS(body = Absyn.DERIVED(comment = i_parts_comment_1, typeSpec = i_parts_typeSpec, arguments = i_parts_arguments, attributes = i_parts_attributes), restriction = Absyn.R_TYPE(), name = i_name), | ||
| 713 | _, | ||
| 714 | a_context ) | ||
| 715 | algorithm | ||
| 716 | ✗ | l_comment := dumpCommentOpt(Tpl.emptyTxt, i_parts_comment_1, a_context); | |
| 717 | ✗ | l_spec := dumpTypeSpec(Tpl.emptyTxt, i_parts_typeSpec, a_context); | |
| 718 | ✗ | l_args := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 719 | ✗ | l_args := lm_36(l_args, i_parts_arguments, a_context); | |
| 720 | ✗ | l_args := Tpl.popIter(l_args); | |
| 721 | ✗ | l_attr := dumpElementAttr(Tpl.emptyTxt, i_parts_attributes); | |
| 722 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 723 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 724 | ✗ | txt := Tpl.writeText(txt, l_spec); | |
| 725 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 726 | ✗ | txt := Tpl.writeText(txt, l_attr); | |
| 727 | ✗ | txt := Tpl.writeText(txt, l_comment); | |
| 728 | then txt; | ||
| 729 | |||
| 730 | case ( txt, | ||
| 731 | Absyn.CLASS(body = Absyn.DERIVED(comment = i_parts_comment_1, typeSpec = i_parts_typeSpec, arguments = i_parts_arguments, attributes = i_parts_attributes), restriction = Absyn.R_FUNCTION(functionRestriction = _), name = i_name), | ||
| 732 | _, | ||
| 733 | a_context ) | ||
| 734 | algorithm | ||
| 735 | ✗ | l_comment := dumpCommentOpt(Tpl.emptyTxt, i_parts_comment_1, a_context); | |
| 736 | ✗ | l_spec := dumpTypeSpec(Tpl.emptyTxt, i_parts_typeSpec, a_context); | |
| 737 | ✗ | l_args := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 738 | ✗ | l_args := lm_37(l_args, i_parts_arguments, a_context); | |
| 739 | ✗ | l_args := Tpl.popIter(l_args); | |
| 740 | ✗ | l_attr := dumpElementAttr(Tpl.emptyTxt, i_parts_attributes); | |
| 741 | ✗ | l_name__of__new__function := Tpl.writeStr(Tpl.emptyTxt, i_name); | |
| 742 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 743 | ✗ | txt := Tpl.writeText(txt, l_comment); | |
| 744 | ✗ | txt := Tpl.softNewLine(txt); | |
| 745 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@ExtendedFunction ")); | |
| 746 | ✗ | txt := Tpl.writeText(txt, l_name__of__new__function); | |
| 747 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 748 | ✗ | txt := Tpl.writeText(txt, l_spec); | |
| 749 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 750 | ✗ | txt := Tpl.writeText(txt, l_args); | |
| 751 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 752 | ✗ | txt := Tpl.popBlock(txt); | |
| 753 | then txt; | ||
| 754 | |||
| 755 | case ( txt, | ||
| 756 | _, | ||
| 757 | _, | ||
| 758 | _ ) | ||
| 759 | then txt; | ||
| 760 | end match; | ||
| 761 | end dumpClassElement; | ||
| 762 | |||
| 763 | public function dumpClassHeader | ||
| 764 | input Tpl.Text in_txt; | ||
| 765 | input Absyn.ClassDef in_a_classDef; | ||
| 766 | input Absyn.Restriction in_a_restriction; | ||
| 767 | |||
| 768 | output Tpl.Text out_txt; | ||
| 769 | algorithm | ||
| 770 | out_txt := | ||
| 771 | match(in_txt, in_a_classDef, in_a_restriction) | ||
| 772 | local | ||
| 773 | Tpl.Text txt; | ||
| 774 | Absyn.Restriction a_restriction; | ||
| 775 | list<String> i_typeVars; | ||
| 776 | |||
| 777 | case ( txt, | ||
| 778 | Absyn.CLASS_EXTENDS(baseClassName = _), | ||
| 779 | _ ) | ||
| 780 | algorithm | ||
| 781 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "Extend not supported"); | |
| 782 | then txt; | ||
| 783 | |||
| 784 | case ( txt, | ||
| 785 | Absyn.PARTS(typeVars = i_typeVars), | ||
| 786 | a_restriction ) | ||
| 787 | algorithm | ||
| 788 | ✗ | txt := dumpClassTypeTypeVars(txt, a_restriction, i_typeVars); | |
| 789 | ✗ | txt := dumpClassTypeSuperType(txt, a_restriction); | |
| 790 | then txt; | ||
| 791 | |||
| 792 | case ( txt, | ||
| 793 | _, | ||
| 794 | _ ) | ||
| 795 | algorithm | ||
| 796 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassHeader: <%dumpClassTypeSuperType(classDef)%>"); | |
| 797 | then txt; | ||
| 798 | end match; | ||
| 799 | end dumpClassHeader; | ||
| 800 | |||
| 801 | public function dumpClassTypeSuperType | ||
| 802 | input Tpl.Text in_txt; | ||
| 803 | input Absyn.Restriction in_a_r; | ||
| 804 | |||
| 805 | output Tpl.Text out_txt; | ||
| 806 | algorithm | ||
| 807 | out_txt := | ||
| 808 | match(in_txt, in_a_r) | ||
| 809 | local | ||
| 810 | Tpl.Text txt; | ||
| 811 | Absyn.Path i_name; | ||
| 812 | |||
| 813 | case ( txt, | ||
| 814 | Absyn.R_METARECORD(name = i_name) ) | ||
| 815 | algorithm | ||
| 816 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<: ")); | |
| 817 | ✗ | txt := dumpPathJL(txt, i_name); | |
| 818 | then txt; | ||
| 819 | |||
| 820 | case ( txt, | ||
| 821 | Absyn.R_FUNCTION(functionRestriction = _) ) | ||
| 822 | then txt; | ||
| 823 | |||
| 824 | case ( txt, | ||
| 825 | _ ) | ||
| 826 | then txt; | ||
| 827 | end match; | ||
| 828 | end dumpClassTypeSuperType; | ||
| 829 | |||
| 830 | protected function lm_41 | ||
| 831 | input output Tpl.Text txt; | ||
| 832 | input list<String> items; | ||
| 833 | algorithm | ||
| 834 | ✗ | for lstElt_41 in items loop | |
| 835 | txt := match lstElt_41 | ||
| 836 | local | ||
| 837 | String i_tv; | ||
| 838 | |||
| 839 | case i_tv | ||
| 840 | algorithm | ||
| 841 | ✗ | txt := Tpl.writeStr(txt, i_tv); | |
| 842 | ✗ | txt := Tpl.nextIter(txt); | |
| 843 | then txt; | ||
| 844 | end match; | ||
| 845 | end for; | ||
| 846 | end lm_41; | ||
| 847 | |||
| 848 | protected function fun_42 | ||
| 849 | input Tpl.Text in_txt; | ||
| 850 | input list<String> in_a_typeVars; | ||
| 851 | |||
| 852 | output Tpl.Text out_txt; | ||
| 853 | algorithm | ||
| 854 | out_txt := | ||
| 855 | match(in_txt, in_a_typeVars) | ||
| 856 | local | ||
| 857 | Tpl.Text txt; | ||
| 858 | list<String> i_typeVars; | ||
| 859 | |||
| 860 | case ( txt, | ||
| 861 | {} ) | ||
| 862 | then txt; | ||
| 863 | |||
| 864 | case ( txt, | ||
| 865 | i_typeVars ) | ||
| 866 | algorithm | ||
| 867 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("{")); | |
| 868 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(",")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 869 | ✗ | txt := lm_41(txt, i_typeVars); | |
| 870 | ✗ | txt := Tpl.popIter(txt); | |
| 871 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("}")); | |
| 872 | then txt; | ||
| 873 | end match; | ||
| 874 | end fun_42; | ||
| 875 | |||
| 876 | protected function lm_43 | ||
| 877 | input output Tpl.Text txt; | ||
| 878 | input list<String> items; | ||
| 879 | algorithm | ||
| 880 | ✗ | for lstElt_43 in items loop | |
| 881 | txt := match lstElt_43 | ||
| 882 | local | ||
| 883 | String i_tv; | ||
| 884 | |||
| 885 | case i_tv | ||
| 886 | algorithm | ||
| 887 | ✗ | txt := Tpl.writeStr(txt, i_tv); | |
| 888 | ✗ | txt := Tpl.nextIter(txt); | |
| 889 | then txt; | ||
| 890 | end match; | ||
| 891 | end for; | ||
| 892 | end lm_43; | ||
| 893 | |||
| 894 | protected function fun_44 | ||
| 895 | input Tpl.Text in_txt; | ||
| 896 | input list<String> in_a_typeVars; | ||
| 897 | |||
| 898 | output Tpl.Text out_txt; | ||
| 899 | algorithm | ||
| 900 | out_txt := | ||
| 901 | match(in_txt, in_a_typeVars) | ||
| 902 | local | ||
| 903 | Tpl.Text txt; | ||
| 904 | list<String> i_typeVars; | ||
| 905 | |||
| 906 | case ( txt, | ||
| 907 | {} ) | ||
| 908 | then txt; | ||
| 909 | |||
| 910 | case ( txt, | ||
| 911 | i_typeVars ) | ||
| 912 | algorithm | ||
| 913 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("where {")); | |
| 914 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 915 | ✗ | txt := lm_43(txt, i_typeVars); | |
| 916 | ✗ | txt := Tpl.popIter(txt); | |
| 917 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("}")); | |
| 918 | then txt; | ||
| 919 | end match; | ||
| 920 | end fun_44; | ||
| 921 | |||
| 922 | public function dumpClassTypeTypeVars | ||
| 923 | input Tpl.Text in_txt; | ||
| 924 | input Absyn.Restriction in_a_restriction; | ||
| 925 | input list<String> in_a_typeVars; | ||
| 926 | |||
| 927 | output Tpl.Text out_txt; | ||
| 928 | algorithm | ||
| 929 | out_txt := | ||
| 930 | match(in_txt, in_a_restriction, in_a_typeVars) | ||
| 931 | local | ||
| 932 | Tpl.Text txt; | ||
| 933 | list<String> a_typeVars; | ||
| 934 | |||
| 935 | case ( txt, | ||
| 936 | Absyn.R_UNIONTYPE(), | ||
| 937 | a_typeVars ) | ||
| 938 | algorithm | ||
| 939 | ✗ | txt := fun_42(txt, a_typeVars); | |
| 940 | then txt; | ||
| 941 | |||
| 942 | case ( txt, | ||
| 943 | Absyn.R_FUNCTION(functionRestriction = _), | ||
| 944 | a_typeVars ) | ||
| 945 | algorithm | ||
| 946 | ✗ | txt := fun_44(txt, a_typeVars); | |
| 947 | then txt; | ||
| 948 | |||
| 949 | case ( txt, | ||
| 950 | _, | ||
| 951 | _ ) | ||
| 952 | then txt; | ||
| 953 | end match; | ||
| 954 | end dumpClassTypeTypeVars; | ||
| 955 | |||
| 956 | protected function fun_46 | ||
| 957 | input Tpl.Text in_txt; | ||
| 958 | input String in_a_ann; | ||
| 959 | |||
| 960 | output Tpl.Text out_txt; | ||
| 961 | algorithm | ||
| 962 | out_txt := | ||
| 963 | match(in_txt, in_a_ann) | ||
| 964 | local | ||
| 965 | Tpl.Text txt; | ||
| 966 | String i_ann; | ||
| 967 | |||
| 968 | case ( txt, | ||
| 969 | "" ) | ||
| 970 | then txt; | ||
| 971 | |||
| 972 | case ( txt, | ||
| 973 | i_ann ) | ||
| 974 | algorithm | ||
| 975 | ✗ | txt := Tpl.writeStr(txt, i_ann); | |
| 976 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 977 | then txt; | ||
| 978 | end match; | ||
| 979 | end fun_46; | ||
| 980 | |||
| 981 | protected function fun_47 | ||
| 982 | input Tpl.Text in_txt; | ||
| 983 | input Boolean in_mArg; | ||
| 984 | |||
| 985 | output Tpl.Text out_txt; | ||
| 986 | algorithm | ||
| 987 | out_txt := | ||
| 988 | match(in_txt, in_mArg) | ||
| 989 | local | ||
| 990 | Tpl.Text txt; | ||
| 991 | |||
| 992 | case ( txt, | ||
| 993 | true ) | ||
| 994 | then txt; | ||
| 995 | |||
| 996 | case ( txt, | ||
| 997 | _ ) | ||
| 998 | algorithm | ||
| 999 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 1000 | then txt; | ||
| 1001 | end match; | ||
| 1002 | end fun_47; | ||
| 1003 | |||
| 1004 | protected function fun_48 | ||
| 1005 | input Tpl.Text in_txt; | ||
| 1006 | input String in_a_cdefStr; | ||
| 1007 | input Tpl.Text in_a_annotation__str; | ||
| 1008 | |||
| 1009 | output Tpl.Text out_txt; | ||
| 1010 | algorithm | ||
| 1011 | out_txt := | ||
| 1012 | match(in_txt, in_a_cdefStr, in_a_annotation__str) | ||
| 1013 | local | ||
| 1014 | Tpl.Text txt; | ||
| 1015 | Tpl.Text a_annotation__str; | ||
| 1016 | String i_cdefStr; | ||
| 1017 | Boolean ret_0; | ||
| 1018 | |||
| 1019 | case ( txt, | ||
| 1020 | "", | ||
| 1021 | a_annotation__str ) | ||
| 1022 | algorithm | ||
| 1023 | ✗ | txt := Tpl.writeText(txt, a_annotation__str); | |
| 1024 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 1025 | then txt; | ||
| 1026 | |||
| 1027 | case ( txt, | ||
| 1028 | i_cdefStr, | ||
| 1029 | a_annotation__str ) | ||
| 1030 | algorithm | ||
| 1031 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 1032 | ✗ | txt := Tpl.writeStr(txt, i_cdefStr); | |
| 1033 | ✗ | txt := Tpl.softNewLine(txt); | |
| 1034 | ✗ | txt := Tpl.popBlock(txt); | |
| 1035 | ✗ | ret_0 := Tpl.isEmpty(a_annotation__str); | |
| 1036 | ✗ | txt := fun_47(txt, ret_0); | |
| 1037 | ✗ | txt := Tpl.writeText(txt, a_annotation__str); | |
| 1038 | ✗ | txt := Tpl.softNewLine(txt); | |
| 1039 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 1040 | then txt; | ||
| 1041 | end match; | ||
| 1042 | end fun_48; | ||
| 1043 | |||
| 1044 | protected function fun_49 | ||
| 1045 | input Tpl.Text in_txt; | ||
| 1046 | input Absyn.ClassDef in_a_classDef; | ||
| 1047 | input String in_a_cdefStr; | ||
| 1048 | input String in_a_ann; | ||
| 1049 | |||
| 1050 | output Tpl.Text out_txt; | ||
| 1051 | algorithm | ||
| 1052 | out_txt := | ||
| 1053 | match(in_txt, in_a_classDef, in_a_cdefStr, in_a_ann) | ||
| 1054 | local | ||
| 1055 | Tpl.Text txt; | ||
| 1056 | String a_cdefStr; | ||
| 1057 | String a_ann; | ||
| 1058 | Tpl.Text l_annotation__str; | ||
| 1059 | |||
| 1060 | case ( txt, | ||
| 1061 | Absyn.DERIVED(typeSpec = _), | ||
| 1062 | _, | ||
| 1063 | _ ) | ||
| 1064 | algorithm | ||
| 1065 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassFooter: Derived not yet supported."); | |
| 1066 | then txt; | ||
| 1067 | |||
| 1068 | case ( txt, | ||
| 1069 | Absyn.ENUMERATION(enumLiterals = _), | ||
| 1070 | _, | ||
| 1071 | _ ) | ||
| 1072 | algorithm | ||
| 1073 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassFooterf: ENUMERATION not yet supported."); | |
| 1074 | then txt; | ||
| 1075 | |||
| 1076 | case ( txt, | ||
| 1077 | _, | ||
| 1078 | a_cdefStr, | ||
| 1079 | a_ann ) | ||
| 1080 | algorithm | ||
| 1081 | ✗ | l_annotation__str := fun_46(Tpl.emptyTxt, a_ann); | |
| 1082 | ✗ | txt := fun_48(txt, a_cdefStr, l_annotation__str); | |
| 1083 | then txt; | ||
| 1084 | end match; | ||
| 1085 | end fun_49; | ||
| 1086 | |||
| 1087 | public function dumpClassFooter | ||
| 1088 | input Tpl.Text txt; | ||
| 1089 | input Absyn.ClassDef a_classDef; | ||
| 1090 | input String a_cdefStr; | ||
| 1091 | input String a_name; | ||
| 1092 | input String a_cmt; | ||
| 1093 | input String a_ann; | ||
| 1094 | |||
| 1095 | output Tpl.Text out_txt; | ||
| 1096 | algorithm | ||
| 1097 | ✗ | out_txt := fun_49(txt, a_classDef, a_cdefStr, a_ann); | |
| 1098 | end dumpClassFooter; | ||
| 1099 | |||
| 1100 | protected function lm_51 | ||
| 1101 | input output Tpl.Text txt; | ||
| 1102 | input list<Absyn.ElementItem> items; | ||
| 1103 | algorithm | ||
| 1104 | ✗ | for lstElt_51 in items loop | |
| 1105 | txt := match lstElt_51 | ||
| 1106 | local | ||
| 1107 | Absyn.ElementItem i_ei; | ||
| 1108 | MMToJuliaUtil.Context ret_3; | ||
| 1109 | Tpl.Text txt_2; | ||
| 1110 | Option<Absyn.TypeSpec> ret_1; | ||
| 1111 | list<Absyn.ComponentItem> ret_0; | ||
| 1112 | |||
| 1113 | case i_ei | ||
| 1114 | algorithm | ||
| 1115 | ✗ | ret_0 := AbsynUtil.getComponentItemsFromElementItem(i_ei); | |
| 1116 | ✗ | ret_1 := AbsynUtil.getTypeSpecFromElementItemOpt(i_ei); | |
| 1117 | ✗ | txt_2 := dumpTypeSpecOpt(Tpl.emptyTxt, ret_1, MMToJuliaUtil.inputContext); | |
| 1118 | ✗ | ret_3 := MMToJuliaUtil.makeInputContext(Tpl.textString(txt_2)); | |
| 1119 | ✗ | txt := dumpComponentItems(txt, ret_0, ret_3); | |
| 1120 | ✗ | txt := Tpl.nextIter(txt); | |
| 1121 | then txt; | ||
| 1122 | end match; | ||
| 1123 | end for; | ||
| 1124 | end lm_51; | ||
| 1125 | |||
| 1126 | public function dumpInputsJL | ||
| 1127 | input Tpl.Text txt; | ||
| 1128 | input list<Absyn.ElementItem> a_inputs; | ||
| 1129 | input MMToJuliaUtil.Context a_context; | ||
| 1130 | |||
| 1131 | output Tpl.Text out_txt; | ||
| 1132 | protected | ||
| 1133 | list<Absyn.ElementItem> ret_3; | ||
| 1134 | list<Absyn.ElementItem> ret_2; | ||
| 1135 | Absyn.Direction ret_1; | ||
| 1136 | Tpl.Text l_inputStr; | ||
| 1137 | algorithm | ||
| 1138 | ✗ | ret_1 := MMToJuliaUtil.makeInputDirection(); | |
| 1139 | ✗ | ret_2 := MMToJuliaUtil.filterOnDirection(a_inputs, ret_1); | |
| 1140 | ✗ | ret_3 := listReverse(ret_2); | |
| 1141 | ✗ | l_inputStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 1142 | ✗ | l_inputStr := lm_51(l_inputStr, ret_3); | |
| 1143 | ✗ | l_inputStr := Tpl.popIter(l_inputStr); | |
| 1144 | ✗ | out_txt := Tpl.writeText(txt, l_inputStr); | |
| 1145 | end dumpInputsJL; | ||
| 1146 | |||
| 1147 | protected function fun_53 | ||
| 1148 | input Tpl.Text in_txt; | ||
| 1149 | input list<Absyn.ElementItem> in_mArg; | ||
| 1150 | |||
| 1151 | output Tpl.Text out_txt; | ||
| 1152 | algorithm | ||
| 1153 | out_txt := | ||
| 1154 | match(in_txt, in_mArg) | ||
| 1155 | local | ||
| 1156 | Tpl.Text txt; | ||
| 1157 | list<Absyn.ElementItem> i_L; | ||
| 1158 | |||
| 1159 | case ( txt, | ||
| 1160 | {} ) | ||
| 1161 | then txt; | ||
| 1162 | |||
| 1163 | case ( txt, | ||
| 1164 | (i_L as _ :: {}) ) | ||
| 1165 | algorithm | ||
| 1166 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("::")); | |
| 1167 | ✗ | txt := dumpOutputsJL(txt, i_L); | |
| 1168 | then txt; | ||
| 1169 | |||
| 1170 | case ( txt, | ||
| 1171 | (i_L as _ :: _) ) | ||
| 1172 | algorithm | ||
| 1173 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("::Tuple{")); | |
| 1174 | ✗ | txt := dumpOutputsJL(txt, i_L); | |
| 1175 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("}")); | |
| 1176 | then txt; | ||
| 1177 | |||
| 1178 | case ( txt, | ||
| 1179 | _ ) | ||
| 1180 | then txt; | ||
| 1181 | end match; | ||
| 1182 | end fun_53; | ||
| 1183 | |||
| 1184 | public function dumpReturnTypeJL | ||
| 1185 | input Tpl.Text txt; | ||
| 1186 | input list<Absyn.ElementItem> a_outputs; | ||
| 1187 | |||
| 1188 | output Tpl.Text out_txt; | ||
| 1189 | protected | ||
| 1190 | list<Absyn.ElementItem> ret_1; | ||
| 1191 | Absyn.Direction ret_0; | ||
| 1192 | algorithm | ||
| 1193 | ✗ | ret_0 := MMToJuliaUtil.makeOutputDirection(); | |
| 1194 | ✗ | ret_1 := MMToJuliaUtil.filterOnDirection(a_outputs, ret_0); | |
| 1195 | ✗ | out_txt := fun_53(txt, ret_1); | |
| 1196 | end dumpReturnTypeJL; | ||
| 1197 | |||
| 1198 | protected function lm_55 | ||
| 1199 | input output Tpl.Text txt; | ||
| 1200 | input list<Absyn.ElementItem> items; | ||
| 1201 | input MMToJuliaUtil.Context a_context; | ||
| 1202 | algorithm | ||
| 1203 | ✗ | for lstElt_55 in items loop | |
| 1204 | txt := match lstElt_55 | ||
| 1205 | local | ||
| 1206 | Absyn.ElementItem i_e; | ||
| 1207 | |||
| 1208 | case i_e | ||
| 1209 | algorithm | ||
| 1210 | ✗ | txt := dumpElementItemRaw(txt, i_e, Dump.defaultDumpOptions, a_context); | |
| 1211 | ✗ | txt := Tpl.nextIter(txt); | |
| 1212 | then txt; | ||
| 1213 | end match; | ||
| 1214 | end for; | ||
| 1215 | end lm_55; | ||
| 1216 | |||
| 1217 | protected function lm_56 | ||
| 1218 | input output Tpl.Text txt; | ||
| 1219 | input list<Absyn.ElementItem> items; | ||
| 1220 | input MMToJuliaUtil.Context a_context; | ||
| 1221 | algorithm | ||
| 1222 | ✗ | for lstElt_56 in items loop | |
| 1223 | txt := match lstElt_56 | ||
| 1224 | local | ||
| 1225 | Absyn.ElementItem i_e; | ||
| 1226 | |||
| 1227 | case i_e | ||
| 1228 | algorithm | ||
| 1229 | ✗ | txt := dumpElementItemRaw(txt, i_e, Dump.defaultDumpOptions, a_context); | |
| 1230 | ✗ | txt := Tpl.nextIter(txt); | |
| 1231 | then txt; | ||
| 1232 | end match; | ||
| 1233 | end for; | ||
| 1234 | end lm_56; | ||
| 1235 | |||
| 1236 | protected function fun_57 | ||
| 1237 | input Tpl.Text in_txt; | ||
| 1238 | input list<Absyn.ElementItem> in_mArg; | ||
| 1239 | input MMToJuliaUtil.Context in_a_context; | ||
| 1240 | |||
| 1241 | output Tpl.Text out_txt; | ||
| 1242 | algorithm | ||
| 1243 | out_txt := | ||
| 1244 | match(in_txt, in_mArg, in_a_context) | ||
| 1245 | local | ||
| 1246 | Tpl.Text txt; | ||
| 1247 | MMToJuliaUtil.Context a_context; | ||
| 1248 | list<Absyn.ElementItem> i_L; | ||
| 1249 | |||
| 1250 | case ( txt, | ||
| 1251 | {}, | ||
| 1252 | _ ) | ||
| 1253 | then txt; | ||
| 1254 | |||
| 1255 | case ( txt, | ||
| 1256 | (i_L as _ :: {}), | ||
| 1257 | a_context ) | ||
| 1258 | algorithm | ||
| 1259 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 1260 | ✗ | txt := lm_55(txt, i_L, a_context); | |
| 1261 | ✗ | txt := Tpl.popIter(txt); | |
| 1262 | then txt; | ||
| 1263 | |||
| 1264 | case ( txt, | ||
| 1265 | (i_L as _ :: _), | ||
| 1266 | a_context ) | ||
| 1267 | algorithm | ||
| 1268 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 1269 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 1270 | ✗ | txt := lm_56(txt, i_L, a_context); | |
| 1271 | ✗ | txt := Tpl.popIter(txt); | |
| 1272 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 1273 | then txt; | ||
| 1274 | |||
| 1275 | case ( txt, | ||
| 1276 | _, | ||
| 1277 | _ ) | ||
| 1278 | then txt; | ||
| 1279 | end match; | ||
| 1280 | end fun_57; | ||
| 1281 | |||
| 1282 | public function dumpReturnStrJL | ||
| 1283 | input Tpl.Text txt; | ||
| 1284 | input list<Absyn.ElementItem> a_outputs; | ||
| 1285 | input MMToJuliaUtil.Context a_context; | ||
| 1286 | |||
| 1287 | output Tpl.Text out_txt; | ||
| 1288 | protected | ||
| 1289 | list<Absyn.ElementItem> ret_2; | ||
| 1290 | list<Absyn.ElementItem> ret_1; | ||
| 1291 | Absyn.Direction ret_0; | ||
| 1292 | algorithm | ||
| 1293 | ✗ | ret_0 := MMToJuliaUtil.makeOutputDirection(); | |
| 1294 | ✗ | ret_1 := MMToJuliaUtil.filterOnDirection(a_outputs, ret_0); | |
| 1295 | ✗ | ret_2 := listReverse(ret_1); | |
| 1296 | ✗ | out_txt := fun_57(txt, ret_2, a_context); | |
| 1297 | end dumpReturnStrJL; | ||
| 1298 | |||
| 1299 | protected function lm_59 | ||
| 1300 | input output Tpl.Text txt; | ||
| 1301 | input list<Absyn.ClassPart> items; | ||
| 1302 | input Dump.DumpOptions a_options; | ||
| 1303 | input MMToJuliaUtil.Context a_context; | ||
| 1304 | algorithm | ||
| 1305 | ✗ | for lstElt_59 in items loop | |
| 1306 | txt := match lstElt_59 | ||
| 1307 | local | ||
| 1308 | Integer x_idx; | ||
| 1309 | Absyn.ClassPart i_class__part; | ||
| 1310 | |||
| 1311 | case i_class__part | ||
| 1312 | algorithm | ||
| 1313 | ✗ | x_idx := Tpl.getIteri_i0(txt); | |
| 1314 | ✗ | txt := dumpClassPart(txt, i_class__part, x_idx, a_context, a_options); | |
| 1315 | ✗ | txt := Tpl.nextIter(txt); | |
| 1316 | then txt; | ||
| 1317 | end match; | ||
| 1318 | end for; | ||
| 1319 | end lm_59; | ||
| 1320 | |||
| 1321 | public function dumpClassDef | ||
| 1322 | input Tpl.Text in_txt; | ||
| 1323 | input Absyn.ClassDef in_a_cdef; | ||
| 1324 | input MMToJuliaUtil.Context in_a_context; | ||
| 1325 | input Dump.DumpOptions in_a_options; | ||
| 1326 | |||
| 1327 | output Tpl.Text out_txt; | ||
| 1328 | algorithm | ||
| 1329 | out_txt := | ||
| 1330 | match(in_txt, in_a_cdef, in_a_context, in_a_options) | ||
| 1331 | local | ||
| 1332 | Tpl.Text txt; | ||
| 1333 | MMToJuliaUtil.Context a_context; | ||
| 1334 | Dump.DumpOptions a_options; | ||
| 1335 | list<Absyn.ClassPart> i_classParts; | ||
| 1336 | Tpl.Text l_body__str; | ||
| 1337 | |||
| 1338 | case ( txt, | ||
| 1339 | Absyn.PARTS(classParts = i_classParts), | ||
| 1340 | a_context, | ||
| 1341 | a_options ) | ||
| 1342 | algorithm | ||
| 1343 | ✗ | 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())); | |
| 1344 | ✗ | l_body__str := lm_59(l_body__str, i_classParts, a_options, a_context); | |
| 1345 | ✗ | l_body__str := Tpl.popIter(l_body__str); | |
| 1346 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 1347 | ✗ | txt := Tpl.writeText(txt, l_body__str); | |
| 1348 | ✗ | txt := Tpl.popBlock(txt); | |
| 1349 | then txt; | ||
| 1350 | |||
| 1351 | case ( txt, | ||
| 1352 | Absyn.DERIVED(typeSpec = _), | ||
| 1353 | _, | ||
| 1354 | _ ) | ||
| 1355 | algorithm | ||
| 1356 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassDef: Derived not yet supported."); | |
| 1357 | then txt; | ||
| 1358 | |||
| 1359 | case ( txt, | ||
| 1360 | Absyn.CLASS_EXTENDS(baseClassName = _), | ||
| 1361 | _, | ||
| 1362 | _ ) | ||
| 1363 | algorithm | ||
| 1364 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassDef: CLASS_EXETENDS not yet supported."); | |
| 1365 | then txt; | ||
| 1366 | |||
| 1367 | case ( txt, | ||
| 1368 | Absyn.ENUMERATION(enumLiterals = _), | ||
| 1369 | _, | ||
| 1370 | _ ) | ||
| 1371 | algorithm | ||
| 1372 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassDef: CLASS_ENUMERATION not yet supported."); | |
| 1373 | then txt; | ||
| 1374 | |||
| 1375 | case ( txt, | ||
| 1376 | _, | ||
| 1377 | _, | ||
| 1378 | _ ) | ||
| 1379 | algorithm | ||
| 1380 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("TODO Unkown class definition")); | |
| 1381 | then txt; | ||
| 1382 | end match; | ||
| 1383 | end dumpClassDef; | ||
| 1384 | |||
| 1385 | public function dumpClassType | ||
| 1386 | input Tpl.Text in_txt; | ||
| 1387 | input Absyn.Restriction in_a_restriction; | ||
| 1388 | |||
| 1389 | output Tpl.Text out_txt; | ||
| 1390 | algorithm | ||
| 1391 | out_txt := | ||
| 1392 | match(in_txt, in_a_restriction) | ||
| 1393 | local | ||
| 1394 | Tpl.Text txt; | ||
| 1395 | Absyn.Restriction i_restriction; | ||
| 1396 | Tpl.Text txt_0; | ||
| 1397 | |||
| 1398 | case ( txt, | ||
| 1399 | Absyn.R_PACKAGE() ) | ||
| 1400 | algorithm | ||
| 1401 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("module")); | |
| 1402 | then txt; | ||
| 1403 | |||
| 1404 | case ( txt, | ||
| 1405 | Absyn.R_METARECORD(name = _) ) | ||
| 1406 | algorithm | ||
| 1407 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("struct")); | |
| 1408 | then txt; | ||
| 1409 | |||
| 1410 | case ( txt, | ||
| 1411 | Absyn.R_RECORD() ) | ||
| 1412 | algorithm | ||
| 1413 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@Record")); | |
| 1414 | then txt; | ||
| 1415 | |||
| 1416 | case ( txt, | ||
| 1417 | Absyn.R_UNIONTYPE() ) | ||
| 1418 | algorithm | ||
| 1419 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("uniontype")); | |
| 1420 | then txt; | ||
| 1421 | |||
| 1422 | case ( txt, | ||
| 1423 | Absyn.R_TYPE() ) | ||
| 1424 | then txt; | ||
| 1425 | |||
| 1426 | case ( txt, | ||
| 1427 | Absyn.R_FUNCTION(functionRestriction = _) ) | ||
| 1428 | algorithm | ||
| 1429 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("function")); | |
| 1430 | then txt; | ||
| 1431 | |||
| 1432 | case ( txt, | ||
| 1433 | i_restriction ) | ||
| 1434 | algorithm | ||
| 1435 | ✗ | txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("AbsynToJulia.dumpClassType: Unknown restriction for class.")); | |
| 1436 | ✗ | txt_0 := AbsynDumpTpl.dumpRestriction(txt_0, i_restriction); | |
| 1437 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, Tpl.textString(txt_0)); | |
| 1438 | then txt; | ||
| 1439 | end match; | ||
| 1440 | end dumpClassType; | ||
| 1441 | |||
| 1442 | protected function fun_62 | ||
| 1443 | input Tpl.Text in_txt; | ||
| 1444 | input Boolean in_mArg; | ||
| 1445 | input Dump.DumpOptions in_a_options; | ||
| 1446 | input MMToJuliaUtil.Context in_a_context; | ||
| 1447 | input list<Absyn.ElementItem> in_a_contents; | ||
| 1448 | |||
| 1449 | output Tpl.Text out_txt; | ||
| 1450 | algorithm | ||
| 1451 | out_txt := | ||
| 1452 | match(in_txt, in_mArg, in_a_options, in_a_context, in_a_contents) | ||
| 1453 | local | ||
| 1454 | Tpl.Text txt; | ||
| 1455 | Dump.DumpOptions a_options; | ||
| 1456 | MMToJuliaUtil.Context a_context; | ||
| 1457 | list<Absyn.ElementItem> a_contents; | ||
| 1458 | list<Absyn.ElementItem> ret_1; | ||
| 1459 | Absyn.Direction ret_0; | ||
| 1460 | |||
| 1461 | case ( txt, | ||
| 1462 | false, | ||
| 1463 | a_options, | ||
| 1464 | a_context, | ||
| 1465 | a_contents ) | ||
| 1466 | algorithm | ||
| 1467 | ✗ | txt := dumpElementItems(txt, a_contents, a_context, "", true, a_options); | |
| 1468 | then txt; | ||
| 1469 | |||
| 1470 | case ( txt, | ||
| 1471 | _, | ||
| 1472 | a_options, | ||
| 1473 | a_context, | ||
| 1474 | a_contents ) | ||
| 1475 | algorithm | ||
| 1476 | ✗ | ret_0 := MMToJuliaUtil.makeOutputDirection(); | |
| 1477 | ✗ | ret_1 := MMToJuliaUtil.filterOnDirection(a_contents, ret_0); | |
| 1478 | ✗ | txt := dumpElementItems(txt, ret_1, a_context, "", true, a_options); | |
| 1479 | then txt; | ||
| 1480 | end match; | ||
| 1481 | end fun_62; | ||
| 1482 | |||
| 1483 | protected function lm_63 | ||
| 1484 | input output Tpl.Text txt; | ||
| 1485 | input list<Absyn.AlgorithmItem> items; | ||
| 1486 | input MMToJuliaUtil.Context a_context; | ||
| 1487 | algorithm | ||
| 1488 | ✗ | for lstElt_63 in items loop | |
| 1489 | txt := match lstElt_63 | ||
| 1490 | local | ||
| 1491 | Absyn.AlgorithmItem i_eq; | ||
| 1492 | |||
| 1493 | case i_eq | ||
| 1494 | algorithm | ||
| 1495 | ✗ | txt := dumpAlgorithmItem(txt, i_eq, a_context); | |
| 1496 | ✗ | txt := Tpl.nextIter(txt); | |
| 1497 | then txt; | ||
| 1498 | end match; | ||
| 1499 | end for; | ||
| 1500 | end lm_63; | ||
| 1501 | |||
| 1502 | protected function fun_64 | ||
| 1503 | input Tpl.Text in_txt; | ||
| 1504 | input Option<Absyn.Annotation> in_a_annotation__; | ||
| 1505 | input MMToJuliaUtil.Context in_a_context; | ||
| 1506 | |||
| 1507 | output Tpl.Text out_txt; | ||
| 1508 | algorithm | ||
| 1509 | out_txt := | ||
| 1510 | match(in_txt, in_a_annotation__, in_a_context) | ||
| 1511 | local | ||
| 1512 | Tpl.Text txt; | ||
| 1513 | MMToJuliaUtil.Context a_context; | ||
| 1514 | Absyn.Annotation i_ann; | ||
| 1515 | |||
| 1516 | case ( txt, | ||
| 1517 | SOME(i_ann), | ||
| 1518 | a_context ) | ||
| 1519 | algorithm | ||
| 1520 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 1521 | ✗ | txt := dumpAnnotation(txt, i_ann, a_context); | |
| 1522 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 1523 | ✗ | txt := Tpl.popBlock(txt); | |
| 1524 | then txt; | ||
| 1525 | |||
| 1526 | case ( txt, | ||
| 1527 | _, | ||
| 1528 | _ ) | ||
| 1529 | then txt; | ||
| 1530 | end match; | ||
| 1531 | end fun_64; | ||
| 1532 | |||
| 1533 | protected function fun_65 | ||
| 1534 | input Tpl.Text in_txt; | ||
| 1535 | input Absyn.ExternalDecl in_a_externalDecl; | ||
| 1536 | |||
| 1537 | output Tpl.Text out_txt; | ||
| 1538 | algorithm | ||
| 1539 | out_txt := | ||
| 1540 | match(in_txt, in_a_externalDecl) | ||
| 1541 | local | ||
| 1542 | Tpl.Text txt; | ||
| 1543 | |||
| 1544 | case ( txt, | ||
| 1545 | Absyn.EXTERNALDECL(funcName = _) ) | ||
| 1546 | algorithm | ||
| 1547 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("#= TODO: Defined in the runtime =#")); | |
| 1548 | then txt; | ||
| 1549 | |||
| 1550 | case ( txt, | ||
| 1551 | _ ) | ||
| 1552 | then txt; | ||
| 1553 | end match; | ||
| 1554 | end fun_65; | ||
| 1555 | |||
| 1556 | protected function fun_66 | ||
| 1557 | input Tpl.Text in_txt; | ||
| 1558 | input Absyn.ClassPart in_a_class__part; | ||
| 1559 | input MMToJuliaUtil.Context in_a_context; | ||
| 1560 | input Dump.DumpOptions in_a_options; | ||
| 1561 | |||
| 1562 | output Tpl.Text out_txt; | ||
| 1563 | algorithm | ||
| 1564 | out_txt := | ||
| 1565 | match(in_txt, in_a_class__part, in_a_context, in_a_options) | ||
| 1566 | local | ||
| 1567 | Tpl.Text txt; | ||
| 1568 | MMToJuliaUtil.Context a_context; | ||
| 1569 | Dump.DumpOptions a_options; | ||
| 1570 | Absyn.ExternalDecl i_externalDecl; | ||
| 1571 | Option<Absyn.Annotation> i_annotation__; | ||
| 1572 | list<Absyn.AlgorithmItem> i_contents_1; | ||
| 1573 | list<Absyn.ElementItem> i_contents; | ||
| 1574 | Tpl.Text l_ann__str; | ||
| 1575 | Boolean ret_1; | ||
| 1576 | Tpl.Text l_el__str; | ||
| 1577 | |||
| 1578 | case ( txt, | ||
| 1579 | Absyn.PUBLIC(contents = i_contents), | ||
| 1580 | a_context, | ||
| 1581 | a_options ) | ||
| 1582 | algorithm | ||
| 1583 | ✗ | ret_1 := MMToJuliaUtil.isFunctionContext(a_context); | |
| 1584 | ✗ | l_el__str := fun_62(Tpl.emptyTxt, ret_1, a_options, a_context, i_contents); | |
| 1585 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 1586 | ✗ | txt := Tpl.writeText(txt, l_el__str); | |
| 1587 | ✗ | txt := Tpl.popBlock(txt); | |
| 1588 | then txt; | ||
| 1589 | |||
| 1590 | case ( txt, | ||
| 1591 | Absyn.PROTECTED(contents = i_contents), | ||
| 1592 | a_context, | ||
| 1593 | a_options ) | ||
| 1594 | algorithm | ||
| 1595 | ✗ | l_el__str := dumpElementItems(Tpl.emptyTxt, i_contents, a_context, "", true, a_options); | |
| 1596 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 1597 | ✗ | txt := Tpl.writeText(txt, l_el__str); | |
| 1598 | ✗ | txt := Tpl.popBlock(txt); | |
| 1599 | then txt; | ||
| 1600 | |||
| 1601 | case ( txt, | ||
| 1602 | Absyn.CONSTRAINTS(contents = _), | ||
| 1603 | _, | ||
| 1604 | _ ) | ||
| 1605 | algorithm | ||
| 1606 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassPart: CONSTRAINTS(__) not supported."); | |
| 1607 | then txt; | ||
| 1608 | |||
| 1609 | case ( txt, | ||
| 1610 | Absyn.EQUATIONS(contents = _), | ||
| 1611 | _, | ||
| 1612 | _ ) | ||
| 1613 | algorithm | ||
| 1614 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassPart: EQUATIONS(__) not supported."); | |
| 1615 | then txt; | ||
| 1616 | |||
| 1617 | case ( txt, | ||
| 1618 | Absyn.INITIALEQUATIONS(contents = _), | ||
| 1619 | _, | ||
| 1620 | _ ) | ||
| 1621 | algorithm | ||
| 1622 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassPart: INITIALEQUATIONS() not supported."); | |
| 1623 | then txt; | ||
| 1624 | |||
| 1625 | case ( txt, | ||
| 1626 | Absyn.ALGORITHMS(contents = i_contents_1), | ||
| 1627 | a_context, | ||
| 1628 | _ ) | ||
| 1629 | algorithm | ||
| 1630 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 1631 | ✗ | 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())); | |
| 1632 | ✗ | txt := lm_63(txt, i_contents_1, a_context); | |
| 1633 | ✗ | txt := Tpl.popIter(txt); | |
| 1634 | ✗ | txt := Tpl.popBlock(txt); | |
| 1635 | then txt; | ||
| 1636 | |||
| 1637 | case ( txt, | ||
| 1638 | Absyn.INITIALALGORITHMS(contents = _), | ||
| 1639 | _, | ||
| 1640 | _ ) | ||
| 1641 | algorithm | ||
| 1642 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpClassPart: INITIALALGORITHMS() not supported."); | |
| 1643 | then txt; | ||
| 1644 | |||
| 1645 | case ( txt, | ||
| 1646 | Absyn.EXTERNAL(annotation_ = i_annotation__, externalDecl = i_externalDecl), | ||
| 1647 | a_context, | ||
| 1648 | _ ) | ||
| 1649 | algorithm | ||
| 1650 | ✗ | l_ann__str := fun_64(Tpl.emptyTxt, i_annotation__, a_context); | |
| 1651 | ✗ | txt := fun_65(txt, i_externalDecl); | |
| 1652 | then txt; | ||
| 1653 | |||
| 1654 | case ( txt, | ||
| 1655 | _, | ||
| 1656 | _, | ||
| 1657 | _ ) | ||
| 1658 | then txt; | ||
| 1659 | end match; | ||
| 1660 | end fun_66; | ||
| 1661 | |||
| 1662 | public function dumpClassPart | ||
| 1663 | input Tpl.Text txt; | ||
| 1664 | input Absyn.ClassPart a_class__part; | ||
| 1665 | input Integer a_idx; | ||
| 1666 | input MMToJuliaUtil.Context a_context; | ||
| 1667 | input Dump.DumpOptions a_options; | ||
| 1668 | |||
| 1669 | output Tpl.Text out_txt; | ||
| 1670 | algorithm | ||
| 1671 | ✗ | out_txt := fun_66(txt, a_class__part, a_context, a_options); | |
| 1672 | end dumpClassPart; | ||
| 1673 | |||
| 1674 | protected function fun_68 | ||
| 1675 | input Tpl.Text in_txt; | ||
| 1676 | input Boolean in_a_first; | ||
| 1677 | input String in_a_prevSpacing; | ||
| 1678 | input Tpl.Text in_a_spacing; | ||
| 1679 | |||
| 1680 | output Tpl.Text out_txt; | ||
| 1681 | algorithm | ||
| 1682 | out_txt := | ||
| 1683 | match(in_txt, in_a_first, in_a_prevSpacing, in_a_spacing) | ||
| 1684 | local | ||
| 1685 | Tpl.Text txt; | ||
| 1686 | String a_prevSpacing; | ||
| 1687 | Tpl.Text a_spacing; | ||
| 1688 | |||
| 1689 | case ( txt, | ||
| 1690 | false, | ||
| 1691 | a_prevSpacing, | ||
| 1692 | a_spacing ) | ||
| 1693 | algorithm | ||
| 1694 | ✗ | txt := dumpElementItemPreSpacing(txt, Tpl.textString(a_spacing), a_prevSpacing); | |
| 1695 | then txt; | ||
| 1696 | |||
| 1697 | case ( txt, | ||
| 1698 | _, | ||
| 1699 | _, | ||
| 1700 | _ ) | ||
| 1701 | then txt; | ||
| 1702 | end match; | ||
| 1703 | end fun_68; | ||
| 1704 | |||
| 1705 | protected function fun_69 | ||
| 1706 | input Tpl.Text in_txt; | ||
| 1707 | input Boolean in_mArg; | ||
| 1708 | input Tpl.Text in_a_spacing; | ||
| 1709 | |||
| 1710 | output Tpl.Text out_txt; | ||
| 1711 | algorithm | ||
| 1712 | out_txt := | ||
| 1713 | match(in_txt, in_mArg, in_a_spacing) | ||
| 1714 | local | ||
| 1715 | Tpl.Text txt; | ||
| 1716 | Tpl.Text a_spacing; | ||
| 1717 | |||
| 1718 | case ( txt, | ||
| 1719 | true, | ||
| 1720 | _ ) | ||
| 1721 | then txt; | ||
| 1722 | |||
| 1723 | case ( txt, | ||
| 1724 | _, | ||
| 1725 | a_spacing ) | ||
| 1726 | algorithm | ||
| 1727 | ✗ | txt := Tpl.writeText(txt, a_spacing); | |
| 1728 | then txt; | ||
| 1729 | end match; | ||
| 1730 | end fun_69; | ||
| 1731 | |||
| 1732 | protected function fun_70 | ||
| 1733 | input Tpl.Text in_txt; | ||
| 1734 | input Boolean in_mArg; | ||
| 1735 | input Tpl.Text in_a_rest__str; | ||
| 1736 | |||
| 1737 | output Tpl.Text out_txt; | ||
| 1738 | algorithm | ||
| 1739 | out_txt := | ||
| 1740 | match(in_txt, in_mArg, in_a_rest__str) | ||
| 1741 | local | ||
| 1742 | Tpl.Text txt; | ||
| 1743 | Tpl.Text a_rest__str; | ||
| 1744 | |||
| 1745 | case ( txt, | ||
| 1746 | true, | ||
| 1747 | _ ) | ||
| 1748 | then txt; | ||
| 1749 | |||
| 1750 | case ( txt, | ||
| 1751 | _, | ||
| 1752 | a_rest__str ) | ||
| 1753 | algorithm | ||
| 1754 | ✗ | txt := Tpl.writeText(txt, a_rest__str); | |
| 1755 | then txt; | ||
| 1756 | end match; | ||
| 1757 | end fun_70; | ||
| 1758 | |||
| 1759 | public function dumpElementItems | ||
| 1760 | input Tpl.Text in_txt; | ||
| 1761 | input list<Absyn.ElementItem> in_a_items; | ||
| 1762 | input MMToJuliaUtil.Context in_a_context; | ||
| 1763 | input String in_a_prevSpacing; | ||
| 1764 | input Boolean in_a_first; | ||
| 1765 | input Dump.DumpOptions in_a_options; | ||
| 1766 | |||
| 1767 | output Tpl.Text out_txt; | ||
| 1768 | algorithm | ||
| 1769 | out_txt := | ||
| 1770 | match(in_txt, in_a_items, in_a_context, in_a_prevSpacing, in_a_first, in_a_options) | ||
| 1771 | local | ||
| 1772 | Tpl.Text txt; | ||
| 1773 | MMToJuliaUtil.Context a_context; | ||
| 1774 | String a_prevSpacing; | ||
| 1775 | Boolean a_first; | ||
| 1776 | Dump.DumpOptions a_options; | ||
| 1777 | list<Absyn.ElementItem> i_rest__items; | ||
| 1778 | Absyn.ElementItem i_item; | ||
| 1779 | Boolean ret_6; | ||
| 1780 | Boolean ret_5; | ||
| 1781 | Tpl.Text l_post__spacing; | ||
| 1782 | Tpl.Text l_rest__str; | ||
| 1783 | Tpl.Text l_item__str; | ||
| 1784 | Tpl.Text l_pre__spacing; | ||
| 1785 | Tpl.Text l_spacing; | ||
| 1786 | |||
| 1787 | case ( txt, | ||
| 1788 | i_item :: i_rest__items, | ||
| 1789 | a_context, | ||
| 1790 | a_prevSpacing, | ||
| 1791 | a_first, | ||
| 1792 | a_options ) | ||
| 1793 | algorithm | ||
| 1794 | ✗ | l_spacing := dumpElementItemSpacing(Tpl.emptyTxt, i_item); | |
| 1795 | ✗ | l_pre__spacing := fun_68(Tpl.emptyTxt, a_first, a_prevSpacing, l_spacing); | |
| 1796 | ✗ | l_item__str := dumpElementItem(Tpl.emptyTxt, i_item, a_options, a_context); | |
| 1797 | ✗ | l_rest__str := dumpElementItems(Tpl.emptyTxt, i_rest__items, a_context, Tpl.textString(l_spacing), false, a_options); | |
| 1798 | ✗ | ret_5 := Tpl.isEmpty(l_rest__str); | |
| 1799 | ✗ | l_post__spacing := fun_69(Tpl.emptyTxt, ret_5, l_spacing); | |
| 1800 | ✗ | txt := Tpl.writeText(txt, l_pre__spacing); | |
| 1801 | ✗ | txt := Tpl.softNewLine(txt); | |
| 1802 | ✗ | txt := Tpl.writeText(txt, l_item__str); | |
| 1803 | ✗ | txt := Tpl.writeText(txt, l_post__spacing); | |
| 1804 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 1805 | ✗ | ret_6 := Tpl.isEmpty(l_rest__str); | |
| 1806 | ✗ | txt := fun_70(txt, ret_6, l_rest__str); | |
| 1807 | then txt; | ||
| 1808 | |||
| 1809 | case ( txt, | ||
| 1810 | _, | ||
| 1811 | _, | ||
| 1812 | _, | ||
| 1813 | _, | ||
| 1814 | _ ) | ||
| 1815 | then txt; | ||
| 1816 | end match; | ||
| 1817 | end dumpElementItems; | ||
| 1818 | |||
| 1819 | protected function fun_72 | ||
| 1820 | input Tpl.Text in_txt; | ||
| 1821 | input String in_a_prevSpacing; | ||
| 1822 | input String in_a_curSpacing; | ||
| 1823 | |||
| 1824 | output Tpl.Text out_txt; | ||
| 1825 | algorithm | ||
| 1826 | out_txt := | ||
| 1827 | match(in_txt, in_a_prevSpacing, in_a_curSpacing) | ||
| 1828 | local | ||
| 1829 | Tpl.Text txt; | ||
| 1830 | String a_curSpacing; | ||
| 1831 | |||
| 1832 | case ( txt, | ||
| 1833 | "", | ||
| 1834 | a_curSpacing ) | ||
| 1835 | algorithm | ||
| 1836 | ✗ | txt := Tpl.writeStr(txt, a_curSpacing); | |
| 1837 | then txt; | ||
| 1838 | |||
| 1839 | case ( txt, | ||
| 1840 | _, | ||
| 1841 | _ ) | ||
| 1842 | then txt; | ||
| 1843 | end match; | ||
| 1844 | end fun_72; | ||
| 1845 | |||
| 1846 | public function dumpElementItemPreSpacing | ||
| 1847 | input Tpl.Text txt; | ||
| 1848 | input String a_curSpacing; | ||
| 1849 | input String a_prevSpacing; | ||
| 1850 | |||
| 1851 | output Tpl.Text out_txt; | ||
| 1852 | algorithm | ||
| 1853 | ✗ | out_txt := fun_72(txt, a_prevSpacing, a_curSpacing); | |
| 1854 | end dumpElementItemPreSpacing; | ||
| 1855 | |||
| 1856 | public function dumpElementItemSpacing | ||
| 1857 | input Tpl.Text in_txt; | ||
| 1858 | input Absyn.ElementItem in_a_item; | ||
| 1859 | |||
| 1860 | output Tpl.Text out_txt; | ||
| 1861 | algorithm | ||
| 1862 | out_txt := | ||
| 1863 | match(in_txt, in_a_item) | ||
| 1864 | local | ||
| 1865 | Tpl.Text txt; | ||
| 1866 | Absyn.ClassDef i_cdef; | ||
| 1867 | |||
| 1868 | case ( txt, | ||
| 1869 | Absyn.ELEMENTITEM(element = Absyn.ELEMENT(specification = Absyn.CLASSDEF(class_ = Absyn.CLASS(body = i_cdef)))) ) | ||
| 1870 | algorithm | ||
| 1871 | ✗ | txt := dumpClassDefSpacing(txt, i_cdef); | |
| 1872 | then txt; | ||
| 1873 | |||
| 1874 | case ( txt, | ||
| 1875 | _ ) | ||
| 1876 | then txt; | ||
| 1877 | end match; | ||
| 1878 | end dumpElementItemSpacing; | ||
| 1879 | |||
| 1880 | public function dumpClassDefSpacing | ||
| 1881 | input Tpl.Text in_txt; | ||
| 1882 | input Absyn.ClassDef in_a_cdef; | ||
| 1883 | |||
| 1884 | output Tpl.Text out_txt; | ||
| 1885 | algorithm | ||
| 1886 | out_txt := | ||
| 1887 | match(in_txt, in_a_cdef) | ||
| 1888 | local | ||
| 1889 | Tpl.Text txt; | ||
| 1890 | |||
| 1891 | case ( txt, | ||
| 1892 | Absyn.PARTS(typeVars = _) ) | ||
| 1893 | algorithm | ||
| 1894 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 1895 | then txt; | ||
| 1896 | |||
| 1897 | case ( txt, | ||
| 1898 | Absyn.CLASS_EXTENDS(baseClassName = _) ) | ||
| 1899 | algorithm | ||
| 1900 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 1901 | then txt; | ||
| 1902 | |||
| 1903 | case ( txt, | ||
| 1904 | _ ) | ||
| 1905 | then txt; | ||
| 1906 | end match; | ||
| 1907 | end dumpClassDefSpacing; | ||
| 1908 | |||
| 1909 | public function dumpElementItem | ||
| 1910 | input Tpl.Text in_txt; | ||
| 1911 | input Absyn.ElementItem in_a_eitem; | ||
| 1912 | input Dump.DumpOptions in_a_options; | ||
| 1913 | input MMToJuliaUtil.Context in_a_context; | ||
| 1914 | |||
| 1915 | output Tpl.Text out_txt; | ||
| 1916 | algorithm | ||
| 1917 | out_txt := | ||
| 1918 | match(in_txt, in_a_eitem, in_a_options, in_a_context) | ||
| 1919 | local | ||
| 1920 | Tpl.Text txt; | ||
| 1921 | Dump.DumpOptions a_options; | ||
| 1922 | MMToJuliaUtil.Context a_context; | ||
| 1923 | String i_comment; | ||
| 1924 | Absyn.Element i_element; | ||
| 1925 | |||
| 1926 | case ( txt, | ||
| 1927 | Absyn.ELEMENTITEM(element = i_element), | ||
| 1928 | a_options, | ||
| 1929 | a_context ) | ||
| 1930 | algorithm | ||
| 1931 | ✗ | txt := dumpElement(txt, i_element, a_options, a_context); | |
| 1932 | then txt; | ||
| 1933 | |||
| 1934 | case ( txt, | ||
| 1935 | Absyn.LEXER_COMMENT(comment = i_comment), | ||
| 1936 | _, | ||
| 1937 | _ ) | ||
| 1938 | algorithm | ||
| 1939 | ✗ | txt := dumpCommentStr(txt, i_comment); | |
| 1940 | then txt; | ||
| 1941 | |||
| 1942 | case ( txt, | ||
| 1943 | _, | ||
| 1944 | _, | ||
| 1945 | _ ) | ||
| 1946 | then txt; | ||
| 1947 | end match; | ||
| 1948 | end dumpElementItem; | ||
| 1949 | |||
| 1950 | protected function lm_77 | ||
| 1951 | input output Tpl.Text txt; | ||
| 1952 | input list<Absyn.ComponentItem> items; | ||
| 1953 | input MMToJuliaUtil.Context a_context; | ||
| 1954 | algorithm | ||
| 1955 | ✗ | for lstElt_77 in items loop | |
| 1956 | txt := match lstElt_77 | ||
| 1957 | local | ||
| 1958 | Absyn.ComponentItem i_comp; | ||
| 1959 | |||
| 1960 | case i_comp | ||
| 1961 | algorithm | ||
| 1962 | ✗ | txt := dumpComponentItem(txt, i_comp, a_context); | |
| 1963 | ✗ | txt := Tpl.nextIter(txt); | |
| 1964 | then txt; | ||
| 1965 | end match; | ||
| 1966 | end for; | ||
| 1967 | end lm_77; | ||
| 1968 | |||
| 1969 | protected function fun_78 | ||
| 1970 | input Tpl.Text in_txt; | ||
| 1971 | input Absyn.ElementSpec in_a_specification; | ||
| 1972 | input MMToJuliaUtil.Context in_a_context; | ||
| 1973 | |||
| 1974 | output Tpl.Text out_txt; | ||
| 1975 | algorithm | ||
| 1976 | out_txt := | ||
| 1977 | match(in_txt, in_a_specification, in_a_context) | ||
| 1978 | local | ||
| 1979 | Tpl.Text txt; | ||
| 1980 | MMToJuliaUtil.Context a_context; | ||
| 1981 | list<Absyn.ComponentItem> i_components; | ||
| 1982 | Tpl.Text l_comps__str; | ||
| 1983 | |||
| 1984 | case ( txt, | ||
| 1985 | Absyn.COMPONENTS(components = i_components), | ||
| 1986 | a_context ) | ||
| 1987 | algorithm | ||
| 1988 | ✗ | l_comps__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())); | |
| 1989 | ✗ | l_comps__str := lm_77(l_comps__str, i_components, a_context); | |
| 1990 | ✗ | l_comps__str := Tpl.popIter(l_comps__str); | |
| 1991 | ✗ | txt := Tpl.writeText(txt, l_comps__str); | |
| 1992 | then txt; | ||
| 1993 | |||
| 1994 | case ( txt, | ||
| 1995 | _, | ||
| 1996 | _ ) | ||
| 1997 | algorithm | ||
| 1998 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpElementItem: on none component type"); | |
| 1999 | then txt; | ||
| 2000 | end match; | ||
| 2001 | end fun_78; | ||
| 2002 | |||
| 2003 | protected function fun_79 | ||
| 2004 | input Tpl.Text in_txt; | ||
| 2005 | input Absyn.Element in_a_element; | ||
| 2006 | input MMToJuliaUtil.Context in_a_context; | ||
| 2007 | |||
| 2008 | output Tpl.Text out_txt; | ||
| 2009 | algorithm | ||
| 2010 | out_txt := | ||
| 2011 | match(in_txt, in_a_element, in_a_context) | ||
| 2012 | local | ||
| 2013 | Tpl.Text txt; | ||
| 2014 | MMToJuliaUtil.Context a_context; | ||
| 2015 | Absyn.ElementSpec i_specification; | ||
| 2016 | |||
| 2017 | case ( txt, | ||
| 2018 | Absyn.ELEMENT(specification = i_specification), | ||
| 2019 | a_context ) | ||
| 2020 | algorithm | ||
| 2021 | ✗ | txt := fun_78(txt, i_specification, a_context); | |
| 2022 | then txt; | ||
| 2023 | |||
| 2024 | case ( txt, | ||
| 2025 | _, | ||
| 2026 | _ ) | ||
| 2027 | algorithm | ||
| 2028 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpElementItem: on none component type"); | |
| 2029 | then txt; | ||
| 2030 | end match; | ||
| 2031 | end fun_79; | ||
| 2032 | |||
| 2033 | protected function fun_80 | ||
| 2034 | input Tpl.Text in_txt; | ||
| 2035 | input Absyn.ElementItem in_a_eitem; | ||
| 2036 | input MMToJuliaUtil.Context in_a_context; | ||
| 2037 | |||
| 2038 | output Tpl.Text out_txt; | ||
| 2039 | algorithm | ||
| 2040 | out_txt := | ||
| 2041 | match(in_txt, in_a_eitem, in_a_context) | ||
| 2042 | local | ||
| 2043 | Tpl.Text txt; | ||
| 2044 | MMToJuliaUtil.Context a_context; | ||
| 2045 | String i_comment; | ||
| 2046 | Absyn.Element i_element; | ||
| 2047 | |||
| 2048 | case ( txt, | ||
| 2049 | Absyn.ELEMENTITEM(element = i_element), | ||
| 2050 | a_context ) | ||
| 2051 | algorithm | ||
| 2052 | ✗ | txt := fun_79(txt, i_element, a_context); | |
| 2053 | then txt; | ||
| 2054 | |||
| 2055 | case ( txt, | ||
| 2056 | Absyn.LEXER_COMMENT(comment = i_comment), | ||
| 2057 | _ ) | ||
| 2058 | algorithm | ||
| 2059 | ✗ | txt := dumpCommentStr(txt, i_comment); | |
| 2060 | then txt; | ||
| 2061 | |||
| 2062 | case ( txt, | ||
| 2063 | _, | ||
| 2064 | _ ) | ||
| 2065 | then txt; | ||
| 2066 | end match; | ||
| 2067 | end fun_80; | ||
| 2068 | |||
| 2069 | public function dumpElementItemRaw | ||
| 2070 | input Tpl.Text txt; | ||
| 2071 | input Absyn.ElementItem a_eitem; | ||
| 2072 | input Dump.DumpOptions a_options; | ||
| 2073 | input MMToJuliaUtil.Context a_context; | ||
| 2074 | |||
| 2075 | output Tpl.Text out_txt; | ||
| 2076 | algorithm | ||
| 2077 | ✗ | out_txt := fun_80(txt, a_eitem, a_context); | |
| 2078 | end dumpElementItemRaw; | ||
| 2079 | |||
| 2080 | protected function fun_82 | ||
| 2081 | input Tpl.Text in_txt; | ||
| 2082 | input Option<Absyn.RedeclareKeywords> in_a_redeclareKeywords; | ||
| 2083 | |||
| 2084 | output Tpl.Text out_txt; | ||
| 2085 | algorithm | ||
| 2086 | out_txt := | ||
| 2087 | match(in_txt, in_a_redeclareKeywords) | ||
| 2088 | local | ||
| 2089 | Tpl.Text txt; | ||
| 2090 | Absyn.RedeclareKeywords i_re; | ||
| 2091 | |||
| 2092 | case ( txt, | ||
| 2093 | SOME(i_re) ) | ||
| 2094 | algorithm | ||
| 2095 | ✗ | txt := dumpRedeclare(txt, i_re); | |
| 2096 | then txt; | ||
| 2097 | |||
| 2098 | case ( txt, | ||
| 2099 | _ ) | ||
| 2100 | then txt; | ||
| 2101 | end match; | ||
| 2102 | end fun_82; | ||
| 2103 | |||
| 2104 | protected function fun_83 | ||
| 2105 | input Tpl.Text in_txt; | ||
| 2106 | input Option<Absyn.RedeclareKeywords> in_a_redeclareKeywords; | ||
| 2107 | |||
| 2108 | output Tpl.Text out_txt; | ||
| 2109 | algorithm | ||
| 2110 | out_txt := | ||
| 2111 | match(in_txt, in_a_redeclareKeywords) | ||
| 2112 | local | ||
| 2113 | Tpl.Text txt; | ||
| 2114 | Absyn.RedeclareKeywords i_re; | ||
| 2115 | |||
| 2116 | case ( txt, | ||
| 2117 | SOME(i_re) ) | ||
| 2118 | algorithm | ||
| 2119 | ✗ | txt := dumpReplaceable(txt, i_re); | |
| 2120 | then txt; | ||
| 2121 | |||
| 2122 | case ( txt, | ||
| 2123 | _ ) | ||
| 2124 | then txt; | ||
| 2125 | end match; | ||
| 2126 | end fun_83; | ||
| 2127 | |||
| 2128 | protected function fun_84 | ||
| 2129 | input Tpl.Text in_txt; | ||
| 2130 | input Option<Absyn.ConstrainClass> in_a_constrainClass; | ||
| 2131 | input MMToJuliaUtil.Context in_a_context; | ||
| 2132 | |||
| 2133 | output Tpl.Text out_txt; | ||
| 2134 | algorithm | ||
| 2135 | out_txt := | ||
| 2136 | match(in_txt, in_a_constrainClass, in_a_context) | ||
| 2137 | local | ||
| 2138 | Tpl.Text txt; | ||
| 2139 | MMToJuliaUtil.Context a_context; | ||
| 2140 | Absyn.ConstrainClass i_cc; | ||
| 2141 | |||
| 2142 | case ( txt, | ||
| 2143 | SOME(i_cc), | ||
| 2144 | a_context ) | ||
| 2145 | algorithm | ||
| 2146 | ✗ | txt := dumpConstrainClass(txt, i_cc, a_context); | |
| 2147 | then txt; | ||
| 2148 | |||
| 2149 | case ( txt, | ||
| 2150 | _, | ||
| 2151 | _ ) | ||
| 2152 | then txt; | ||
| 2153 | end match; | ||
| 2154 | end fun_84; | ||
| 2155 | |||
| 2156 | protected function fun_85 | ||
| 2157 | input Tpl.Text in_txt; | ||
| 2158 | input Boolean in_mArg; | ||
| 2159 | input Option<Absyn.ConstrainClass> in_a_constrainClass; | ||
| 2160 | input MMToJuliaUtil.Context in_a_context; | ||
| 2161 | input Dump.DumpOptions in_a_options; | ||
| 2162 | input Absyn.ElementSpec in_a_specification; | ||
| 2163 | input Option<Absyn.RedeclareKeywords> in_a_redeclareKeywords; | ||
| 2164 | input Boolean in_a_finalPrefix; | ||
| 2165 | |||
| 2166 | output Tpl.Text out_txt; | ||
| 2167 | algorithm | ||
| 2168 | out_txt := | ||
| 2169 | match(in_txt, in_mArg, in_a_constrainClass, in_a_context, in_a_options, in_a_specification, in_a_redeclareKeywords, in_a_finalPrefix) | ||
| 2170 | local | ||
| 2171 | Tpl.Text txt; | ||
| 2172 | Option<Absyn.ConstrainClass> a_constrainClass; | ||
| 2173 | MMToJuliaUtil.Context a_context; | ||
| 2174 | Dump.DumpOptions a_options; | ||
| 2175 | Absyn.ElementSpec a_specification; | ||
| 2176 | Option<Absyn.RedeclareKeywords> a_redeclareKeywords; | ||
| 2177 | Boolean a_finalPrefix; | ||
| 2178 | Tpl.Text l_constrainClass__str; | ||
| 2179 | Tpl.Text l_elementSpec__str; | ||
| 2180 | Tpl.Text l_repl__str; | ||
| 2181 | Tpl.Text l_redecl__str; | ||
| 2182 | Tpl.Text l_final__str; | ||
| 2183 | |||
| 2184 | case ( txt, | ||
| 2185 | false, | ||
| 2186 | _, | ||
| 2187 | _, | ||
| 2188 | _, | ||
| 2189 | _, | ||
| 2190 | _, | ||
| 2191 | _ ) | ||
| 2192 | then txt; | ||
| 2193 | |||
| 2194 | case ( txt, | ||
| 2195 | _, | ||
| 2196 | a_constrainClass, | ||
| 2197 | a_context, | ||
| 2198 | a_options, | ||
| 2199 | a_specification, | ||
| 2200 | a_redeclareKeywords, | ||
| 2201 | a_finalPrefix ) | ||
| 2202 | algorithm | ||
| 2203 | ✗ | l_final__str := dumpFinal(Tpl.emptyTxt, a_finalPrefix); | |
| 2204 | ✗ | l_redecl__str := fun_82(Tpl.emptyTxt, a_redeclareKeywords); | |
| 2205 | ✗ | l_repl__str := fun_83(Tpl.emptyTxt, a_redeclareKeywords); | |
| 2206 | ✗ | l_elementSpec__str := dumpElementSpec(Tpl.emptyTxt, a_specification, a_options, a_context); | |
| 2207 | ✗ | l_constrainClass__str := fun_84(Tpl.emptyTxt, a_constrainClass, a_context); | |
| 2208 | ✗ | txt := Tpl.writeText(txt, l_elementSpec__str); | |
| 2209 | ✗ | txt := Tpl.writeText(txt, l_constrainClass__str); | |
| 2210 | then txt; | ||
| 2211 | end match; | ||
| 2212 | end fun_85; | ||
| 2213 | |||
| 2214 | protected function fun_86 | ||
| 2215 | input Tpl.Text in_txt; | ||
| 2216 | input Option<Absyn.Ident> in_a_optName; | ||
| 2217 | |||
| 2218 | output Tpl.Text out_txt; | ||
| 2219 | algorithm | ||
| 2220 | out_txt := | ||
| 2221 | match(in_txt, in_a_optName) | ||
| 2222 | local | ||
| 2223 | Tpl.Text txt; | ||
| 2224 | Absyn.Ident i_name; | ||
| 2225 | |||
| 2226 | case ( txt, | ||
| 2227 | SOME(i_name) ) | ||
| 2228 | algorithm | ||
| 2229 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 2230 | then txt; | ||
| 2231 | |||
| 2232 | case ( txt, | ||
| 2233 | _ ) | ||
| 2234 | then txt; | ||
| 2235 | end match; | ||
| 2236 | end fun_86; | ||
| 2237 | |||
| 2238 | protected function fun_87 | ||
| 2239 | input Tpl.Text in_txt; | ||
| 2240 | input Boolean in_mArg; | ||
| 2241 | input String in_a_string; | ||
| 2242 | input SourceInfo in_a_info; | ||
| 2243 | input Option<Absyn.Ident> in_a_optName; | ||
| 2244 | |||
| 2245 | output Tpl.Text out_txt; | ||
| 2246 | algorithm | ||
| 2247 | out_txt := | ||
| 2248 | match(in_txt, in_mArg, in_a_string, in_a_info, in_a_optName) | ||
| 2249 | local | ||
| 2250 | Tpl.Text txt; | ||
| 2251 | String a_string; | ||
| 2252 | SourceInfo a_info; | ||
| 2253 | Option<Absyn.Ident> a_optName; | ||
| 2254 | Tpl.Text l_info__str; | ||
| 2255 | Tpl.Text l_name__str; | ||
| 2256 | |||
| 2257 | case ( txt, | ||
| 2258 | false, | ||
| 2259 | _, | ||
| 2260 | _, | ||
| 2261 | _ ) | ||
| 2262 | then txt; | ||
| 2263 | |||
| 2264 | case ( txt, | ||
| 2265 | _, | ||
| 2266 | a_string, | ||
| 2267 | a_info, | ||
| 2268 | a_optName ) | ||
| 2269 | algorithm | ||
| 2270 | ✗ | l_name__str := fun_86(Tpl.emptyTxt, a_optName); | |
| 2271 | ✗ | l_info__str := dumpInfo(Tpl.emptyTxt, a_info); | |
| 2272 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("/* Absyn.TEXT(SOME(\"")); | |
| 2273 | ✗ | txt := Tpl.writeText(txt, l_name__str); | |
| 2274 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"), \"")); | |
| 2275 | ✗ | txt := Tpl.writeStr(txt, a_string); | |
| 2276 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\", \"")); | |
| 2277 | ✗ | txt := Tpl.writeText(txt, l_info__str); | |
| 2278 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"); */")); | |
| 2279 | then txt; | ||
| 2280 | end match; | ||
| 2281 | end fun_87; | ||
| 2282 | |||
| 2283 | public function dumpElement | ||
| 2284 | input Tpl.Text in_txt; | ||
| 2285 | input Absyn.Element in_a_elem; | ||
| 2286 | input Dump.DumpOptions in_a_options; | ||
| 2287 | input MMToJuliaUtil.Context in_a_context; | ||
| 2288 | |||
| 2289 | output Tpl.Text out_txt; | ||
| 2290 | algorithm | ||
| 2291 | out_txt := | ||
| 2292 | match(in_txt, in_a_elem, in_a_options, in_a_context) | ||
| 2293 | local | ||
| 2294 | Tpl.Text txt; | ||
| 2295 | Dump.DumpOptions a_options; | ||
| 2296 | MMToJuliaUtil.Context a_context; | ||
| 2297 | String i_string; | ||
| 2298 | Option<Absyn.Ident> i_optName; | ||
| 2299 | Option<Absyn.ConstrainClass> i_constrainClass; | ||
| 2300 | Absyn.ElementSpec i_specification; | ||
| 2301 | Option<Absyn.RedeclareKeywords> i_redeclareKeywords; | ||
| 2302 | Boolean i_finalPrefix; | ||
| 2303 | Absyn.Element i_elem; | ||
| 2304 | SourceInfo i_info; | ||
| 2305 | Boolean ret_4; | ||
| 2306 | Boolean ret_3; | ||
| 2307 | Boolean ret_2; | ||
| 2308 | Boolean ret_1; | ||
| 2309 | Boolean ret_0; | ||
| 2310 | |||
| 2311 | case ( txt, | ||
| 2312 | (i_elem as Absyn.ELEMENT(info = i_info, finalPrefix = i_finalPrefix, redeclareKeywords = i_redeclareKeywords, specification = i_specification, constrainClass = i_constrainClass)), | ||
| 2313 | a_options, | ||
| 2314 | a_context ) | ||
| 2315 | algorithm | ||
| 2316 | ✗ | ret_0 := Dump.boolUnparseFileFromInfo(i_info, a_options); | |
| 2317 | ✗ | ret_1 := AbsynUtil.isClassdef(i_elem); | |
| 2318 | ✗ | ret_2 := boolNot(ret_1); | |
| 2319 | ✗ | ret_3 := boolOr(ret_0, ret_2); | |
| 2320 | ✗ | txt := fun_85(txt, ret_3, i_constrainClass, a_context, a_options, i_specification, i_redeclareKeywords, i_finalPrefix); | |
| 2321 | then txt; | ||
| 2322 | |||
| 2323 | case ( txt, | ||
| 2324 | Absyn.DEFINEUNIT(name = _), | ||
| 2325 | _, | ||
| 2326 | _ ) | ||
| 2327 | algorithm | ||
| 2328 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpElement: DEFINEUNIT(__) not supported"); | |
| 2329 | then txt; | ||
| 2330 | |||
| 2331 | case ( txt, | ||
| 2332 | Absyn.TEXT(info = i_info, optName = i_optName, string = i_string), | ||
| 2333 | a_options, | ||
| 2334 | _ ) | ||
| 2335 | algorithm | ||
| 2336 | ✗ | ret_4 := Dump.boolUnparseFileFromInfo(i_info, a_options); | |
| 2337 | ✗ | txt := fun_87(txt, ret_4, i_string, i_info, i_optName); | |
| 2338 | then txt; | ||
| 2339 | |||
| 2340 | case ( txt, | ||
| 2341 | _, | ||
| 2342 | _, | ||
| 2343 | _ ) | ||
| 2344 | then txt; | ||
| 2345 | end match; | ||
| 2346 | end dumpElement; | ||
| 2347 | |||
| 2348 | protected function fun_89 | ||
| 2349 | input Tpl.Text in_txt; | ||
| 2350 | input Boolean in_a_isReadOnly; | ||
| 2351 | |||
| 2352 | output Tpl.Text out_txt; | ||
| 2353 | algorithm | ||
| 2354 | out_txt := | ||
| 2355 | match(in_txt, in_a_isReadOnly) | ||
| 2356 | local | ||
| 2357 | Tpl.Text txt; | ||
| 2358 | |||
| 2359 | case ( txt, | ||
| 2360 | false ) | ||
| 2361 | algorithm | ||
| 2362 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("writable")); | |
| 2363 | then txt; | ||
| 2364 | |||
| 2365 | case ( txt, | ||
| 2366 | _ ) | ||
| 2367 | algorithm | ||
| 2368 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("readonly")); | |
| 2369 | then txt; | ||
| 2370 | end match; | ||
| 2371 | end fun_89; | ||
| 2372 | |||
| 2373 | public function dumpInfo | ||
| 2374 | input Tpl.Text in_txt; | ||
| 2375 | input SourceInfo in_a_info; | ||
| 2376 | |||
| 2377 | output Tpl.Text out_txt; | ||
| 2378 | algorithm | ||
| 2379 | out_txt := | ||
| 2380 | match(in_txt, in_a_info) | ||
| 2381 | local | ||
| 2382 | Tpl.Text txt; | ||
| 2383 | Integer i_columnNumberEnd; | ||
| 2384 | Integer i_lineNumberEnd; | ||
| 2385 | Integer i_columnNumberStart; | ||
| 2386 | Integer i_lineNumberStart; | ||
| 2387 | String i_fileName; | ||
| 2388 | Boolean i_isReadOnly; | ||
| 2389 | Tpl.Text l_rm__str; | ||
| 2390 | |||
| 2391 | case ( txt, | ||
| 2392 | SOURCEINFO(isReadOnly = i_isReadOnly, fileName = i_fileName, lineNumberStart = i_lineNumberStart, columnNumberStart = i_columnNumberStart, lineNumberEnd = i_lineNumberEnd, columnNumberEnd = i_columnNumberEnd) ) | ||
| 2393 | algorithm | ||
| 2394 | ✗ | l_rm__str := fun_89(Tpl.emptyTxt, i_isReadOnly); | |
| 2395 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("SOURCEINFO(\"")); | |
| 2396 | ✗ | txt := Tpl.writeStr(txt, i_fileName); | |
| 2397 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\", ")); | |
| 2398 | ✗ | txt := Tpl.writeText(txt, l_rm__str); | |
| 2399 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 2400 | ✗ | txt := Tpl.writeStr(txt, intString(i_lineNumberStart)); | |
| 2401 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 2402 | ✗ | txt := Tpl.writeStr(txt, intString(i_columnNumberStart)); | |
| 2403 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 2404 | ✗ | txt := Tpl.writeStr(txt, intString(i_lineNumberEnd)); | |
| 2405 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 2406 | ✗ | txt := Tpl.writeStr(txt, intString(i_columnNumberEnd)); | |
| 2407 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")\\n")); | |
| 2408 | then txt; | ||
| 2409 | |||
| 2410 | case ( txt, | ||
| 2411 | _ ) | ||
| 2412 | then txt; | ||
| 2413 | end match; | ||
| 2414 | end dumpInfo; | ||
| 2415 | |||
| 2416 | protected function lm_91 | ||
| 2417 | input output Tpl.Text txt; | ||
| 2418 | input list<Absyn.ElementArg> items; | ||
| 2419 | input MMToJuliaUtil.Context a_context; | ||
| 2420 | algorithm | ||
| 2421 | ✗ | for lstElt_91 in items loop | |
| 2422 | txt := match lstElt_91 | ||
| 2423 | local | ||
| 2424 | Absyn.ElementArg i_earg; | ||
| 2425 | |||
| 2426 | case i_earg | ||
| 2427 | algorithm | ||
| 2428 | ✗ | txt := dumpElementArg(txt, i_earg, a_context); | |
| 2429 | ✗ | txt := Tpl.nextIter(txt); | |
| 2430 | then txt; | ||
| 2431 | end match; | ||
| 2432 | end for; | ||
| 2433 | end lm_91; | ||
| 2434 | |||
| 2435 | public function dumpAnnotation | ||
| 2436 | input Tpl.Text in_txt; | ||
| 2437 | input Absyn.Annotation in_a_ann; | ||
| 2438 | input MMToJuliaUtil.Context in_a_context; | ||
| 2439 | |||
| 2440 | output Tpl.Text out_txt; | ||
| 2441 | algorithm | ||
| 2442 | out_txt := | ||
| 2443 | match(in_txt, in_a_ann, in_a_context) | ||
| 2444 | local | ||
| 2445 | Tpl.Text txt; | ||
| 2446 | MMToJuliaUtil.Context a_context; | ||
| 2447 | list<Absyn.ElementArg> i_elementArgs; | ||
| 2448 | Tpl.StringToken ret_1; | ||
| 2449 | Tpl.Text txt_0; | ||
| 2450 | |||
| 2451 | case ( txt, | ||
| 2452 | Absyn.ANNOTATION(elementArgs = {}), | ||
| 2453 | _ ) | ||
| 2454 | algorithm | ||
| 2455 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("#= annotation() =#")); | |
| 2456 | then txt; | ||
| 2457 | |||
| 2458 | case ( txt, | ||
| 2459 | Absyn.ANNOTATION(elementArgs = i_elementArgs), | ||
| 2460 | a_context ) | ||
| 2461 | algorithm | ||
| 2462 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("#= annotation(\n")); | |
| 2463 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 2464 | ✗ | txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING(",")); | |
| 2465 | ✗ | txt_0 := Tpl.writeTok(txt_0, Tpl.ST_NEW_LINE()); | |
| 2466 | ✗ | ret_1 := Tpl.textStrTok(txt_0); | |
| 2467 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(ret_1), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2468 | ✗ | txt := lm_91(txt, i_elementArgs, a_context); | |
| 2469 | ✗ | txt := Tpl.popIter(txt); | |
| 2470 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(") =#")); | |
| 2471 | ✗ | txt := Tpl.popBlock(txt); | |
| 2472 | then txt; | ||
| 2473 | |||
| 2474 | case ( txt, | ||
| 2475 | _, | ||
| 2476 | _ ) | ||
| 2477 | then txt; | ||
| 2478 | end match; | ||
| 2479 | end dumpAnnotation; | ||
| 2480 | |||
| 2481 | public function dumpAnnotationOpt | ||
| 2482 | input Tpl.Text in_txt; | ||
| 2483 | input Option<Absyn.Annotation> in_a_oann; | ||
| 2484 | input MMToJuliaUtil.Context in_a_context; | ||
| 2485 | |||
| 2486 | output Tpl.Text out_txt; | ||
| 2487 | algorithm | ||
| 2488 | out_txt := | ||
| 2489 | match(in_txt, in_a_oann, in_a_context) | ||
| 2490 | local | ||
| 2491 | Tpl.Text txt; | ||
| 2492 | MMToJuliaUtil.Context a_context; | ||
| 2493 | Absyn.Annotation i_ann; | ||
| 2494 | |||
| 2495 | case ( txt, | ||
| 2496 | SOME(i_ann), | ||
| 2497 | a_context ) | ||
| 2498 | algorithm | ||
| 2499 | ✗ | txt := dumpAnnotation(txt, i_ann, a_context); | |
| 2500 | then txt; | ||
| 2501 | |||
| 2502 | case ( txt, | ||
| 2503 | _, | ||
| 2504 | _ ) | ||
| 2505 | then txt; | ||
| 2506 | end match; | ||
| 2507 | end dumpAnnotationOpt; | ||
| 2508 | |||
| 2509 | public function dumpAnnotationOptSpace | ||
| 2510 | input Tpl.Text in_txt; | ||
| 2511 | input Option<Absyn.Annotation> in_a_oann; | ||
| 2512 | input MMToJuliaUtil.Context in_a_context; | ||
| 2513 | |||
| 2514 | output Tpl.Text out_txt; | ||
| 2515 | algorithm | ||
| 2516 | out_txt := | ||
| 2517 | match(in_txt, in_a_oann, in_a_context) | ||
| 2518 | local | ||
| 2519 | Tpl.Text txt; | ||
| 2520 | MMToJuliaUtil.Context a_context; | ||
| 2521 | Absyn.Annotation i_ann; | ||
| 2522 | |||
| 2523 | case ( txt, | ||
| 2524 | SOME(i_ann), | ||
| 2525 | a_context ) | ||
| 2526 | algorithm | ||
| 2527 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 2528 | ✗ | txt := dumpAnnotation(txt, i_ann, a_context); | |
| 2529 | then txt; | ||
| 2530 | |||
| 2531 | case ( txt, | ||
| 2532 | _, | ||
| 2533 | _ ) | ||
| 2534 | then txt; | ||
| 2535 | end match; | ||
| 2536 | end dumpAnnotationOptSpace; | ||
| 2537 | |||
| 2538 | public function dumpComment | ||
| 2539 | input Tpl.Text in_txt; | ||
| 2540 | input Absyn.Comment in_a_cmt; | ||
| 2541 | input MMToJuliaUtil.Context in_a_context; | ||
| 2542 | |||
| 2543 | output Tpl.Text out_txt; | ||
| 2544 | algorithm | ||
| 2545 | out_txt := | ||
| 2546 | match(in_txt, in_a_cmt, in_a_context) | ||
| 2547 | local | ||
| 2548 | Tpl.Text txt; | ||
| 2549 | MMToJuliaUtil.Context a_context; | ||
| 2550 | Option<Absyn.Annotation> i_annotation__; | ||
| 2551 | Option<String> i_comment; | ||
| 2552 | |||
| 2553 | case ( txt, | ||
| 2554 | Absyn.COMMENT(comment = i_comment, annotation_ = i_annotation__), | ||
| 2555 | a_context ) | ||
| 2556 | algorithm | ||
| 2557 | ✗ | txt := dumpCommentStrOpt(txt, i_comment); | |
| 2558 | ✗ | txt := dumpAnnotationOptSpace(txt, i_annotation__, a_context); | |
| 2559 | then txt; | ||
| 2560 | |||
| 2561 | case ( txt, | ||
| 2562 | _, | ||
| 2563 | _ ) | ||
| 2564 | then txt; | ||
| 2565 | end match; | ||
| 2566 | end dumpComment; | ||
| 2567 | |||
| 2568 | public function dumpCommentOpt | ||
| 2569 | input Tpl.Text in_txt; | ||
| 2570 | input Option<Absyn.Comment> in_a_ocmt; | ||
| 2571 | input MMToJuliaUtil.Context in_a_context; | ||
| 2572 | |||
| 2573 | output Tpl.Text out_txt; | ||
| 2574 | algorithm | ||
| 2575 | out_txt := | ||
| 2576 | match(in_txt, in_a_ocmt, in_a_context) | ||
| 2577 | local | ||
| 2578 | Tpl.Text txt; | ||
| 2579 | MMToJuliaUtil.Context a_context; | ||
| 2580 | Absyn.Comment i_cmt; | ||
| 2581 | |||
| 2582 | case ( txt, | ||
| 2583 | SOME(i_cmt), | ||
| 2584 | a_context ) | ||
| 2585 | algorithm | ||
| 2586 | ✗ | txt := dumpComment(txt, i_cmt, a_context); | |
| 2587 | then txt; | ||
| 2588 | |||
| 2589 | case ( txt, | ||
| 2590 | _, | ||
| 2591 | _ ) | ||
| 2592 | then txt; | ||
| 2593 | end match; | ||
| 2594 | end dumpCommentOpt; | ||
| 2595 | |||
| 2596 | public function dumpCommentStrOpt | ||
| 2597 | input Tpl.Text in_txt; | ||
| 2598 | input Option<String> in_a_comment; | ||
| 2599 | |||
| 2600 | output Tpl.Text out_txt; | ||
| 2601 | algorithm | ||
| 2602 | out_txt := | ||
| 2603 | match(in_txt, in_a_comment) | ||
| 2604 | local | ||
| 2605 | Tpl.Text txt; | ||
| 2606 | String i_cmt; | ||
| 2607 | |||
| 2608 | case ( txt, | ||
| 2609 | SOME(i_cmt) ) | ||
| 2610 | algorithm | ||
| 2611 | ✗ | txt := dumpCommentStr(txt, i_cmt); | |
| 2612 | then txt; | ||
| 2613 | |||
| 2614 | case ( txt, | ||
| 2615 | _ ) | ||
| 2616 | then txt; | ||
| 2617 | end match; | ||
| 2618 | end dumpCommentStrOpt; | ||
| 2619 | |||
| 2620 | public function dumpCommentStr | ||
| 2621 | input Tpl.Text txt; | ||
| 2622 | input String a_comment; | ||
| 2623 | |||
| 2624 | output Tpl.Text out_txt; | ||
| 2625 | protected | ||
| 2626 | String ret_2; | ||
| 2627 | String ret_1; | ||
| 2628 | Tpl.Text l_replaceAllRegular; | ||
| 2629 | algorithm | ||
| 2630 | ✗ | l_replaceAllRegular := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING(" ")); | |
| 2631 | ✗ | l_replaceAllRegular := Tpl.writeTok(l_replaceAllRegular, Tpl.ST_STRING("#= ")); | |
| 2632 | ✗ | ret_1 := System.escapedString(a_comment, false); | |
| 2633 | ✗ | ret_2 := System.stringReplace(ret_1, "//", ""); | |
| 2634 | ✗ | l_replaceAllRegular := Tpl.writeStr(l_replaceAllRegular, ret_2); | |
| 2635 | ✗ | l_replaceAllRegular := Tpl.writeTok(l_replaceAllRegular, Tpl.ST_STRING(" =#")); | |
| 2636 | ✗ | out_txt := Tpl.writeText(txt, l_replaceAllRegular); | |
| 2637 | end dumpCommentStr; | ||
| 2638 | |||
| 2639 | protected function fun_99 | ||
| 2640 | input Tpl.Text in_txt; | ||
| 2641 | input Option<Absyn.Modification> in_a_modification; | ||
| 2642 | input MMToJuliaUtil.Context in_a_context; | ||
| 2643 | |||
| 2644 | output Tpl.Text out_txt; | ||
| 2645 | algorithm | ||
| 2646 | out_txt := | ||
| 2647 | match(in_txt, in_a_modification, in_a_context) | ||
| 2648 | local | ||
| 2649 | Tpl.Text txt; | ||
| 2650 | MMToJuliaUtil.Context a_context; | ||
| 2651 | Absyn.Modification i_mod; | ||
| 2652 | |||
| 2653 | case ( txt, | ||
| 2654 | SOME(i_mod), | ||
| 2655 | a_context ) | ||
| 2656 | algorithm | ||
| 2657 | ✗ | txt := dumpModification(txt, i_mod, a_context); | |
| 2658 | then txt; | ||
| 2659 | |||
| 2660 | case ( txt, | ||
| 2661 | _, | ||
| 2662 | _ ) | ||
| 2663 | then txt; | ||
| 2664 | end match; | ||
| 2665 | end fun_99; | ||
| 2666 | |||
| 2667 | protected function fun_100 | ||
| 2668 | input Tpl.Text in_txt; | ||
| 2669 | input Option<Absyn.ConstrainClass> in_a_constrainClass; | ||
| 2670 | input MMToJuliaUtil.Context in_a_context; | ||
| 2671 | |||
| 2672 | output Tpl.Text out_txt; | ||
| 2673 | algorithm | ||
| 2674 | out_txt := | ||
| 2675 | match(in_txt, in_a_constrainClass, in_a_context) | ||
| 2676 | local | ||
| 2677 | Tpl.Text txt; | ||
| 2678 | MMToJuliaUtil.Context a_context; | ||
| 2679 | Absyn.ConstrainClass i_cc; | ||
| 2680 | |||
| 2681 | case ( txt, | ||
| 2682 | SOME(i_cc), | ||
| 2683 | a_context ) | ||
| 2684 | algorithm | ||
| 2685 | ✗ | txt := dumpConstrainClass(txt, i_cc, a_context); | |
| 2686 | then txt; | ||
| 2687 | |||
| 2688 | case ( txt, | ||
| 2689 | _, | ||
| 2690 | _ ) | ||
| 2691 | then txt; | ||
| 2692 | end match; | ||
| 2693 | end fun_100; | ||
| 2694 | |||
| 2695 | public function dumpElementArg | ||
| 2696 | input Tpl.Text in_txt; | ||
| 2697 | input Absyn.ElementArg in_a_earg; | ||
| 2698 | input MMToJuliaUtil.Context in_a_context; | ||
| 2699 | |||
| 2700 | output Tpl.Text out_txt; | ||
| 2701 | algorithm | ||
| 2702 | out_txt := | ||
| 2703 | match(in_txt, in_a_earg, in_a_context) | ||
| 2704 | local | ||
| 2705 | Tpl.Text txt; | ||
| 2706 | MMToJuliaUtil.Context a_context; | ||
| 2707 | Option<Absyn.ConstrainClass> i_constrainClass; | ||
| 2708 | Absyn.ElementSpec i_elementSpec; | ||
| 2709 | Absyn.RedeclareKeywords i_redeclareKeywords; | ||
| 2710 | Option<String> i_comment; | ||
| 2711 | Option<Absyn.Modification> i_modification; | ||
| 2712 | Absyn.Path i_path; | ||
| 2713 | Boolean i_finalPrefix; | ||
| 2714 | Absyn.Each i_eachPrefix; | ||
| 2715 | Tpl.Text l_cc__str; | ||
| 2716 | Tpl.Text l_elem__str; | ||
| 2717 | Tpl.Text l_eredecl__str; | ||
| 2718 | Tpl.Text l_repl__str; | ||
| 2719 | Tpl.Text l_redecl__str; | ||
| 2720 | Tpl.Text l_cmt__str; | ||
| 2721 | Tpl.Text l_mod__str; | ||
| 2722 | Tpl.Text l_path__str; | ||
| 2723 | Tpl.Text l_final__str; | ||
| 2724 | Tpl.Text l_each__str; | ||
| 2725 | |||
| 2726 | case ( txt, | ||
| 2727 | Absyn.MODIFICATION(eachPrefix = i_eachPrefix, finalPrefix = i_finalPrefix, path = i_path, modification = i_modification, comment = i_comment), | ||
| 2728 | a_context ) | ||
| 2729 | algorithm | ||
| 2730 | ✗ | l_each__str := dumpEach(Tpl.emptyTxt, i_eachPrefix); | |
| 2731 | ✗ | l_final__str := dumpFinal(Tpl.emptyTxt, i_finalPrefix); | |
| 2732 | ✗ | l_path__str := dumpPathJL(Tpl.emptyTxt, i_path); | |
| 2733 | ✗ | l_mod__str := fun_99(Tpl.emptyTxt, i_modification, a_context); | |
| 2734 | ✗ | l_cmt__str := dumpCommentStrOpt(Tpl.emptyTxt, i_comment); | |
| 2735 | ✗ | txt := Tpl.writeText(txt, l_each__str); | |
| 2736 | ✗ | txt := Tpl.writeText(txt, l_final__str); | |
| 2737 | ✗ | txt := Tpl.writeText(txt, l_path__str); | |
| 2738 | ✗ | txt := Tpl.writeText(txt, l_mod__str); | |
| 2739 | ✗ | txt := Tpl.writeText(txt, l_cmt__str); | |
| 2740 | then txt; | ||
| 2741 | |||
| 2742 | case ( txt, | ||
| 2743 | Absyn.REDECLARATION(eachPrefix = i_eachPrefix, finalPrefix = i_finalPrefix, redeclareKeywords = i_redeclareKeywords, elementSpec = i_elementSpec, constrainClass = i_constrainClass), | ||
| 2744 | a_context ) | ||
| 2745 | algorithm | ||
| 2746 | ✗ | l_each__str := dumpEach(Tpl.emptyTxt, i_eachPrefix); | |
| 2747 | ✗ | l_final__str := dumpFinal(Tpl.emptyTxt, i_finalPrefix); | |
| 2748 | ✗ | l_redecl__str := dumpRedeclare(Tpl.emptyTxt, i_redeclareKeywords); | |
| 2749 | ✗ | l_repl__str := dumpReplaceable(Tpl.emptyTxt, i_redeclareKeywords); | |
| 2750 | ✗ | l_eredecl__str := Tpl.writeText(Tpl.emptyTxt, l_redecl__str); | |
| 2751 | ✗ | l_eredecl__str := Tpl.writeText(l_eredecl__str, l_each__str); | |
| 2752 | ✗ | l_elem__str := dumpElementSpec(Tpl.emptyTxt, i_elementSpec, Dump.defaultDumpOptions, a_context); | |
| 2753 | ✗ | l_cc__str := fun_100(Tpl.emptyTxt, i_constrainClass, a_context); | |
| 2754 | ✗ | txt := Tpl.writeText(txt, l_elem__str); | |
| 2755 | ✗ | txt := Tpl.writeText(txt, l_cc__str); | |
| 2756 | then txt; | ||
| 2757 | |||
| 2758 | case ( txt, | ||
| 2759 | _, | ||
| 2760 | _ ) | ||
| 2761 | then txt; | ||
| 2762 | end match; | ||
| 2763 | end dumpElementArg; | ||
| 2764 | |||
| 2765 | public function dumpEach | ||
| 2766 | input Tpl.Text in_txt; | ||
| 2767 | input Absyn.Each in_a_each; | ||
| 2768 | |||
| 2769 | output Tpl.Text out_txt; | ||
| 2770 | algorithm | ||
| 2771 | out_txt := | ||
| 2772 | match(in_txt, in_a_each) | ||
| 2773 | local | ||
| 2774 | Tpl.Text txt; | ||
| 2775 | |||
| 2776 | case ( txt, | ||
| 2777 | Absyn.EACH() ) | ||
| 2778 | algorithm | ||
| 2779 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("each ")); | |
| 2780 | then txt; | ||
| 2781 | |||
| 2782 | case ( txt, | ||
| 2783 | _ ) | ||
| 2784 | then txt; | ||
| 2785 | end match; | ||
| 2786 | end dumpEach; | ||
| 2787 | |||
| 2788 | public function dumpFinal | ||
| 2789 | input Tpl.Text in_txt; | ||
| 2790 | input Boolean in_a_final; | ||
| 2791 | |||
| 2792 | output Tpl.Text out_txt; | ||
| 2793 | algorithm | ||
| 2794 | out_txt := | ||
| 2795 | match(in_txt, in_a_final) | ||
| 2796 | local | ||
| 2797 | Tpl.Text txt; | ||
| 2798 | |||
| 2799 | case ( txt, | ||
| 2800 | false ) | ||
| 2801 | then txt; | ||
| 2802 | |||
| 2803 | case ( txt, | ||
| 2804 | _ ) | ||
| 2805 | algorithm | ||
| 2806 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("final ")); | |
| 2807 | then txt; | ||
| 2808 | end match; | ||
| 2809 | end dumpFinal; | ||
| 2810 | |||
| 2811 | public function dumpRedeclare | ||
| 2812 | input Tpl.Text in_txt; | ||
| 2813 | input Absyn.RedeclareKeywords in_a_redecl; | ||
| 2814 | |||
| 2815 | output Tpl.Text out_txt; | ||
| 2816 | algorithm | ||
| 2817 | out_txt := | ||
| 2818 | match(in_txt, in_a_redecl) | ||
| 2819 | local | ||
| 2820 | Tpl.Text txt; | ||
| 2821 | |||
| 2822 | case ( txt, | ||
| 2823 | Absyn.REDECLARE() ) | ||
| 2824 | algorithm | ||
| 2825 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("redeclare ")); | |
| 2826 | then txt; | ||
| 2827 | |||
| 2828 | case ( txt, | ||
| 2829 | Absyn.REDECLARE_REPLACEABLE() ) | ||
| 2830 | algorithm | ||
| 2831 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("redeclare ")); | |
| 2832 | then txt; | ||
| 2833 | |||
| 2834 | case ( txt, | ||
| 2835 | _ ) | ||
| 2836 | then txt; | ||
| 2837 | end match; | ||
| 2838 | end dumpRedeclare; | ||
| 2839 | |||
| 2840 | public function dumpReplaceable | ||
| 2841 | input Tpl.Text in_txt; | ||
| 2842 | input Absyn.RedeclareKeywords in_a_repl; | ||
| 2843 | |||
| 2844 | output Tpl.Text out_txt; | ||
| 2845 | algorithm | ||
| 2846 | out_txt := | ||
| 2847 | match(in_txt, in_a_repl) | ||
| 2848 | local | ||
| 2849 | Tpl.Text txt; | ||
| 2850 | |||
| 2851 | case ( txt, | ||
| 2852 | Absyn.REPLACEABLE() ) | ||
| 2853 | algorithm | ||
| 2854 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("replaceable ")); | |
| 2855 | then txt; | ||
| 2856 | |||
| 2857 | case ( txt, | ||
| 2858 | Absyn.REDECLARE_REPLACEABLE() ) | ||
| 2859 | algorithm | ||
| 2860 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("replaceable ")); | |
| 2861 | then txt; | ||
| 2862 | |||
| 2863 | case ( txt, | ||
| 2864 | _ ) | ||
| 2865 | then txt; | ||
| 2866 | end match; | ||
| 2867 | end dumpReplaceable; | ||
| 2868 | |||
| 2869 | protected function lm_106 | ||
| 2870 | input output Tpl.Text txt; | ||
| 2871 | input list<Absyn.ElementArg> items; | ||
| 2872 | input MMToJuliaUtil.Context a_context; | ||
| 2873 | algorithm | ||
| 2874 | ✗ | for lstElt_106 in items loop | |
| 2875 | txt := match lstElt_106 | ||
| 2876 | local | ||
| 2877 | Absyn.ElementArg i_earg; | ||
| 2878 | |||
| 2879 | case i_earg | ||
| 2880 | algorithm | ||
| 2881 | ✗ | txt := dumpElementArg(txt, i_earg, a_context); | |
| 2882 | ✗ | txt := Tpl.nextIter(txt); | |
| 2883 | then txt; | ||
| 2884 | end match; | ||
| 2885 | end for; | ||
| 2886 | end lm_106; | ||
| 2887 | |||
| 2888 | protected function fun_107 | ||
| 2889 | input Tpl.Text in_txt; | ||
| 2890 | input list<Absyn.ElementArg> in_a_elementArgLst; | ||
| 2891 | input MMToJuliaUtil.Context in_a_context; | ||
| 2892 | |||
| 2893 | output Tpl.Text out_txt; | ||
| 2894 | algorithm | ||
| 2895 | out_txt := | ||
| 2896 | match(in_txt, in_a_elementArgLst, in_a_context) | ||
| 2897 | local | ||
| 2898 | Tpl.Text txt; | ||
| 2899 | MMToJuliaUtil.Context a_context; | ||
| 2900 | list<Absyn.ElementArg> i_elementArgLst; | ||
| 2901 | |||
| 2902 | case ( txt, | ||
| 2903 | {}, | ||
| 2904 | _ ) | ||
| 2905 | then txt; | ||
| 2906 | |||
| 2907 | case ( txt, | ||
| 2908 | i_elementArgLst, | ||
| 2909 | a_context ) | ||
| 2910 | algorithm | ||
| 2911 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 2912 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2913 | ✗ | txt := lm_106(txt, i_elementArgLst, a_context); | |
| 2914 | ✗ | txt := Tpl.popIter(txt); | |
| 2915 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 2916 | then txt; | ||
| 2917 | end match; | ||
| 2918 | end fun_107; | ||
| 2919 | |||
| 2920 | public function dumpModification | ||
| 2921 | input Tpl.Text in_txt; | ||
| 2922 | input Absyn.Modification in_a_mod; | ||
| 2923 | input MMToJuliaUtil.Context in_a_context; | ||
| 2924 | |||
| 2925 | output Tpl.Text out_txt; | ||
| 2926 | algorithm | ||
| 2927 | out_txt := | ||
| 2928 | match(in_txt, in_a_mod, in_a_context) | ||
| 2929 | local | ||
| 2930 | Tpl.Text txt; | ||
| 2931 | MMToJuliaUtil.Context a_context; | ||
| 2932 | Absyn.EqMod i_eqMod; | ||
| 2933 | list<Absyn.ElementArg> i_elementArgLst; | ||
| 2934 | Tpl.Text l_eq__str; | ||
| 2935 | Tpl.Text l_arg__str; | ||
| 2936 | |||
| 2937 | case ( txt, | ||
| 2938 | Absyn.CLASSMOD(elementArgLst = i_elementArgLst, eqMod = i_eqMod), | ||
| 2939 | a_context ) | ||
| 2940 | algorithm | ||
| 2941 | ✗ | l_arg__str := fun_107(Tpl.emptyTxt, i_elementArgLst, a_context); | |
| 2942 | ✗ | l_eq__str := dumpEqMod(Tpl.emptyTxt, i_eqMod, a_context); | |
| 2943 | ✗ | txt := Tpl.writeText(txt, l_arg__str); | |
| 2944 | ✗ | txt := Tpl.writeText(txt, l_eq__str); | |
| 2945 | then txt; | ||
| 2946 | |||
| 2947 | case ( txt, | ||
| 2948 | _, | ||
| 2949 | _ ) | ||
| 2950 | then txt; | ||
| 2951 | end match; | ||
| 2952 | end dumpModification; | ||
| 2953 | |||
| 2954 | public function dumpEqMod | ||
| 2955 | input Tpl.Text in_txt; | ||
| 2956 | input Absyn.EqMod in_a_eqmod; | ||
| 2957 | input MMToJuliaUtil.Context in_a_context; | ||
| 2958 | |||
| 2959 | output Tpl.Text out_txt; | ||
| 2960 | algorithm | ||
| 2961 | out_txt := | ||
| 2962 | match(in_txt, in_a_eqmod, in_a_context) | ||
| 2963 | local | ||
| 2964 | Tpl.Text txt; | ||
| 2965 | MMToJuliaUtil.Context a_context; | ||
| 2966 | Absyn.Exp i_exp; | ||
| 2967 | |||
| 2968 | case ( txt, | ||
| 2969 | Absyn.EQMOD(exp = i_exp), | ||
| 2970 | a_context ) | ||
| 2971 | algorithm | ||
| 2972 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 2973 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("= ")); | |
| 2974 | ✗ | txt := dumpExp(txt, i_exp, a_context); | |
| 2975 | then txt; | ||
| 2976 | |||
| 2977 | case ( txt, | ||
| 2978 | _, | ||
| 2979 | _ ) | ||
| 2980 | then txt; | ||
| 2981 | end match; | ||
| 2982 | end dumpEqMod; | ||
| 2983 | |||
| 2984 | protected function lm_110 | ||
| 2985 | input output Tpl.Text txt; | ||
| 2986 | input list<Absyn.ElementArg> items; | ||
| 2987 | input MMToJuliaUtil.Context a_context; | ||
| 2988 | algorithm | ||
| 2989 | ✗ | for lstElt_110 in items loop | |
| 2990 | txt := match lstElt_110 | ||
| 2991 | local | ||
| 2992 | Absyn.ElementArg i_earg; | ||
| 2993 | |||
| 2994 | case i_earg | ||
| 2995 | algorithm | ||
| 2996 | ✗ | txt := dumpElementArg(txt, i_earg, a_context); | |
| 2997 | ✗ | txt := Tpl.nextIter(txt); | |
| 2998 | then txt; | ||
| 2999 | end match; | ||
| 3000 | end for; | ||
| 3001 | end lm_110; | ||
| 3002 | |||
| 3003 | protected function fun_111 | ||
| 3004 | input Tpl.Text in_txt; | ||
| 3005 | input Boolean in_mArg; | ||
| 3006 | input Tpl.Text in_a_args__str; | ||
| 3007 | |||
| 3008 | output Tpl.Text out_txt; | ||
| 3009 | algorithm | ||
| 3010 | out_txt := | ||
| 3011 | match(in_txt, in_mArg, in_a_args__str) | ||
| 3012 | local | ||
| 3013 | Tpl.Text txt; | ||
| 3014 | Tpl.Text a_args__str; | ||
| 3015 | |||
| 3016 | case ( txt, | ||
| 3017 | true, | ||
| 3018 | _ ) | ||
| 3019 | then txt; | ||
| 3020 | |||
| 3021 | case ( txt, | ||
| 3022 | _, | ||
| 3023 | a_args__str ) | ||
| 3024 | algorithm | ||
| 3025 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 3026 | ✗ | txt := Tpl.writeText(txt, a_args__str); | |
| 3027 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 3028 | then txt; | ||
| 3029 | end match; | ||
| 3030 | end fun_111; | ||
| 3031 | |||
| 3032 | protected function lm_112 | ||
| 3033 | input output Tpl.Text txt; | ||
| 3034 | input list<Absyn.ComponentItem> items; | ||
| 3035 | input Tpl.Text a_ty__str; | ||
| 3036 | algorithm | ||
| 3037 | ✗ | for lstElt_112 in items loop | |
| 3038 | txt := match lstElt_112 | ||
| 3039 | local | ||
| 3040 | Absyn.ComponentItem i_comp; | ||
| 3041 | MMToJuliaUtil.Context ret_1; | ||
| 3042 | Tpl.Text l_comp__str; | ||
| 3043 | |||
| 3044 | case i_comp | ||
| 3045 | algorithm | ||
| 3046 | ✗ | ret_1 := MMToJuliaUtil.makeFunctionReturnContext("", Tpl.textString(a_ty__str)); | |
| 3047 | ✗ | l_comp__str := dumpComponentItem(Tpl.emptyTxt, i_comp, ret_1); | |
| 3048 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("local ")); | |
| 3049 | ✗ | txt := Tpl.writeText(txt, l_comp__str); | |
| 3050 | ✗ | txt := Tpl.nextIter(txt); | |
| 3051 | then txt; | ||
| 3052 | end match; | ||
| 3053 | end for; | ||
| 3054 | end lm_112; | ||
| 3055 | |||
| 3056 | protected function fun_113 | ||
| 3057 | input Tpl.Text in_txt; | ||
| 3058 | input Boolean in_mArg; | ||
| 3059 | input Tpl.Text in_a_ty__str; | ||
| 3060 | input list<Absyn.ComponentItem> in_a_components; | ||
| 3061 | |||
| 3062 | output Tpl.Text out_txt; | ||
| 3063 | algorithm | ||
| 3064 | out_txt := | ||
| 3065 | match(in_txt, in_mArg, in_a_ty__str, in_a_components) | ||
| 3066 | local | ||
| 3067 | Tpl.Text txt; | ||
| 3068 | Tpl.Text a_ty__str; | ||
| 3069 | list<Absyn.ComponentItem> a_components; | ||
| 3070 | |||
| 3071 | case ( txt, | ||
| 3072 | false, | ||
| 3073 | _, | ||
| 3074 | _ ) | ||
| 3075 | then txt; | ||
| 3076 | |||
| 3077 | case ( txt, | ||
| 3078 | _, | ||
| 3079 | a_ty__str, | ||
| 3080 | a_components ) | ||
| 3081 | algorithm | ||
| 3082 | ✗ | 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())); | |
| 3083 | ✗ | txt := lm_112(txt, a_components, a_ty__str); | |
| 3084 | ✗ | txt := Tpl.popIter(txt); | |
| 3085 | then txt; | ||
| 3086 | end match; | ||
| 3087 | end fun_113; | ||
| 3088 | |||
| 3089 | protected function fun_114 | ||
| 3090 | input Tpl.Text in_txt; | ||
| 3091 | input MMToJuliaUtil.Context in_a_context; | ||
| 3092 | |||
| 3093 | output Tpl.Text out_txt; | ||
| 3094 | algorithm | ||
| 3095 | out_txt := | ||
| 3096 | match(in_txt, in_a_context) | ||
| 3097 | local | ||
| 3098 | Tpl.Text txt; | ||
| 3099 | |||
| 3100 | case ( txt, | ||
| 3101 | MMToJuliaUtil.PACKAGE() ) | ||
| 3102 | algorithm | ||
| 3103 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("const ")); | |
| 3104 | then txt; | ||
| 3105 | |||
| 3106 | case ( txt, | ||
| 3107 | _ ) | ||
| 3108 | then txt; | ||
| 3109 | end match; | ||
| 3110 | end fun_114; | ||
| 3111 | |||
| 3112 | protected function lm_115 | ||
| 3113 | input output Tpl.Text txt; | ||
| 3114 | input list<Absyn.ComponentItem> items; | ||
| 3115 | input Tpl.Text a_ty__str; | ||
| 3116 | input MMToJuliaUtil.Context a_context; | ||
| 3117 | algorithm | ||
| 3118 | ✗ | for lstElt_115 in items loop | |
| 3119 | txt := match lstElt_115 | ||
| 3120 | local | ||
| 3121 | Absyn.ComponentItem i_comp; | ||
| 3122 | Tpl.Text l_comp__str; | ||
| 3123 | |||
| 3124 | case i_comp | ||
| 3125 | algorithm | ||
| 3126 | ✗ | l_comp__str := dumpComponentItem(Tpl.emptyTxt, i_comp, MMToJuliaUtil.noContext); | |
| 3127 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 3128 | ✗ | txt := fun_114(txt, a_context); | |
| 3129 | ✗ | txt := Tpl.writeText(txt, l_comp__str); | |
| 3130 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("::")); | |
| 3131 | ✗ | txt := Tpl.writeText(txt, a_ty__str); | |
| 3132 | ✗ | txt := Tpl.popBlock(txt); | |
| 3133 | ✗ | txt := Tpl.nextIter(txt); | |
| 3134 | then txt; | ||
| 3135 | end match; | ||
| 3136 | end for; | ||
| 3137 | end lm_115; | ||
| 3138 | |||
| 3139 | protected function fun_116 | ||
| 3140 | input Tpl.Text in_txt; | ||
| 3141 | input Boolean in_mArg; | ||
| 3142 | input Tpl.Text in_a_ty__str; | ||
| 3143 | input MMToJuliaUtil.Context in_a_context; | ||
| 3144 | input list<Absyn.ComponentItem> in_a_components; | ||
| 3145 | |||
| 3146 | output Tpl.Text out_txt; | ||
| 3147 | algorithm | ||
| 3148 | out_txt := | ||
| 3149 | match(in_txt, in_mArg, in_a_ty__str, in_a_context, in_a_components) | ||
| 3150 | local | ||
| 3151 | Tpl.Text txt; | ||
| 3152 | Tpl.Text a_ty__str; | ||
| 3153 | MMToJuliaUtil.Context a_context; | ||
| 3154 | list<Absyn.ComponentItem> a_components; | ||
| 3155 | |||
| 3156 | case ( txt, | ||
| 3157 | false, | ||
| 3158 | _, | ||
| 3159 | _, | ||
| 3160 | _ ) | ||
| 3161 | then txt; | ||
| 3162 | |||
| 3163 | case ( txt, | ||
| 3164 | _, | ||
| 3165 | a_ty__str, | ||
| 3166 | a_context, | ||
| 3167 | a_components ) | ||
| 3168 | algorithm | ||
| 3169 | ✗ | 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())); | |
| 3170 | ✗ | txt := lm_115(txt, a_components, a_ty__str, a_context); | |
| 3171 | ✗ | txt := Tpl.popIter(txt); | |
| 3172 | then txt; | ||
| 3173 | end match; | ||
| 3174 | end fun_116; | ||
| 3175 | |||
| 3176 | protected function fun_117 | ||
| 3177 | input Tpl.Text in_txt; | ||
| 3178 | input MMToJuliaUtil.Context in_a_context; | ||
| 3179 | |||
| 3180 | output Tpl.Text out_txt; | ||
| 3181 | algorithm | ||
| 3182 | out_txt := | ||
| 3183 | match(in_txt, in_a_context) | ||
| 3184 | local | ||
| 3185 | Tpl.Text txt; | ||
| 3186 | String i_retValsStr; | ||
| 3187 | |||
| 3188 | case ( txt, | ||
| 3189 | MMToJuliaUtil.FUNCTION(retValsStr = i_retValsStr) ) | ||
| 3190 | algorithm | ||
| 3191 | ✗ | txt := Tpl.writeStr(txt, i_retValsStr); | |
| 3192 | then txt; | ||
| 3193 | |||
| 3194 | case ( txt, | ||
| 3195 | _ ) | ||
| 3196 | then txt; | ||
| 3197 | end match; | ||
| 3198 | end fun_117; | ||
| 3199 | |||
| 3200 | protected function fun_118 | ||
| 3201 | input Tpl.Text in_txt; | ||
| 3202 | input Boolean in_mArg; | ||
| 3203 | input Tpl.Text in_a_comps__str; | ||
| 3204 | |||
| 3205 | output Tpl.Text out_txt; | ||
| 3206 | algorithm | ||
| 3207 | out_txt := | ||
| 3208 | match(in_txt, in_mArg, in_a_comps__str) | ||
| 3209 | local | ||
| 3210 | Tpl.Text txt; | ||
| 3211 | Tpl.Text a_comps__str; | ||
| 3212 | |||
| 3213 | case ( txt, | ||
| 3214 | true, | ||
| 3215 | _ ) | ||
| 3216 | then txt; | ||
| 3217 | |||
| 3218 | case ( txt, | ||
| 3219 | _, | ||
| 3220 | a_comps__str ) | ||
| 3221 | algorithm | ||
| 3222 | ✗ | txt := Tpl.writeText(txt, a_comps__str); | |
| 3223 | then txt; | ||
| 3224 | end match; | ||
| 3225 | end fun_118; | ||
| 3226 | |||
| 3227 | protected function fun_119 | ||
| 3228 | input Tpl.Text in_txt; | ||
| 3229 | input MMToJuliaUtil.Context in_a_context; | ||
| 3230 | input Tpl.Text in_a_comps__str__no__local; | ||
| 3231 | input Tpl.Text in_a_comps__str; | ||
| 3232 | |||
| 3233 | output Tpl.Text out_txt; | ||
| 3234 | algorithm | ||
| 3235 | out_txt := | ||
| 3236 | match(in_txt, in_a_context, in_a_comps__str__no__local, in_a_comps__str) | ||
| 3237 | local | ||
| 3238 | Tpl.Text txt; | ||
| 3239 | Tpl.Text a_comps__str__no__local; | ||
| 3240 | Tpl.Text a_comps__str; | ||
| 3241 | Boolean ret_0; | ||
| 3242 | |||
| 3243 | case ( txt, | ||
| 3244 | MMToJuliaUtil.FUNCTION(retValsStr = _), | ||
| 3245 | _, | ||
| 3246 | a_comps__str ) | ||
| 3247 | algorithm | ||
| 3248 | ✗ | ret_0 := Tpl.isEmpty(a_comps__str); | |
| 3249 | ✗ | txt := fun_118(txt, ret_0, a_comps__str); | |
| 3250 | then txt; | ||
| 3251 | |||
| 3252 | case ( txt, | ||
| 3253 | MMToJuliaUtil.UNIONTYPE(name = _), | ||
| 3254 | a_comps__str__no__local, | ||
| 3255 | _ ) | ||
| 3256 | algorithm | ||
| 3257 | ✗ | txt := Tpl.writeText(txt, a_comps__str__no__local); | |
| 3258 | then txt; | ||
| 3259 | |||
| 3260 | case ( txt, | ||
| 3261 | MMToJuliaUtil.PACKAGE(), | ||
| 3262 | a_comps__str__no__local, | ||
| 3263 | _ ) | ||
| 3264 | algorithm | ||
| 3265 | ✗ | txt := Tpl.writeText(txt, a_comps__str__no__local); | |
| 3266 | then txt; | ||
| 3267 | |||
| 3268 | case ( txt, | ||
| 3269 | _, | ||
| 3270 | _, | ||
| 3271 | _ ) | ||
| 3272 | algorithm | ||
| 3273 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("ERROR")); | |
| 3274 | then txt; | ||
| 3275 | end match; | ||
| 3276 | end fun_119; | ||
| 3277 | |||
| 3278 | public function dumpElementSpec | ||
| 3279 | input Tpl.Text in_txt; | ||
| 3280 | input Absyn.ElementSpec in_a_specification; | ||
| 3281 | input Dump.DumpOptions in_a_options; | ||
| 3282 | input MMToJuliaUtil.Context in_a_context; | ||
| 3283 | |||
| 3284 | output Tpl.Text out_txt; | ||
| 3285 | algorithm | ||
| 3286 | out_txt := | ||
| 3287 | match(in_txt, in_a_specification, in_a_options, in_a_context) | ||
| 3288 | local | ||
| 3289 | Tpl.Text txt; | ||
| 3290 | Dump.DumpOptions a_options; | ||
| 3291 | MMToJuliaUtil.Context a_context; | ||
| 3292 | Absyn.Import i_import__; | ||
| 3293 | list<Absyn.ComponentItem> i_components; | ||
| 3294 | Absyn.ElementSpec i_specification; | ||
| 3295 | Absyn.TypeSpec i_typeSpec; | ||
| 3296 | Absyn.ElementAttributes i_attributes; | ||
| 3297 | Option<Absyn.Annotation> i_annotationOpt; | ||
| 3298 | list<Absyn.ElementArg> i_elementArg; | ||
| 3299 | Absyn.Path i_path; | ||
| 3300 | Absyn.Class i_class__; | ||
| 3301 | Tpl.Text l_imp__str; | ||
| 3302 | Tpl.Text l_rStr; | ||
| 3303 | Boolean ret_10; | ||
| 3304 | Tpl.Text l_comps__str__no__local; | ||
| 3305 | Boolean ret_8; | ||
| 3306 | Tpl.Text l_comps__str; | ||
| 3307 | Tpl.Text l_ty__str; | ||
| 3308 | Tpl.Text l_attr__str; | ||
| 3309 | Tpl.Text l_ann__str; | ||
| 3310 | Boolean ret_3; | ||
| 3311 | Tpl.Text l_mod__str; | ||
| 3312 | Tpl.Text l_args__str; | ||
| 3313 | Tpl.Text l_bc__str; | ||
| 3314 | |||
| 3315 | case ( txt, | ||
| 3316 | Absyn.CLASSDEF(class_ = i_class__), | ||
| 3317 | a_options, | ||
| 3318 | a_context ) | ||
| 3319 | algorithm | ||
| 3320 | ✗ | txt := dumpClassElement(txt, i_class__, a_options, a_context); | |
| 3321 | then txt; | ||
| 3322 | |||
| 3323 | case ( txt, | ||
| 3324 | Absyn.EXTENDS(path = i_path, elementArg = i_elementArg, annotationOpt = i_annotationOpt), | ||
| 3325 | _, | ||
| 3326 | a_context ) | ||
| 3327 | algorithm | ||
| 3328 | ✗ | l_bc__str := dumpPathJL(Tpl.emptyTxt, i_path); | |
| 3329 | ✗ | 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())); | |
| 3330 | ✗ | l_args__str := lm_110(l_args__str, i_elementArg, a_context); | |
| 3331 | ✗ | l_args__str := Tpl.popIter(l_args__str); | |
| 3332 | ✗ | ret_3 := Tpl.isEmpty(l_args__str); | |
| 3333 | ✗ | l_mod__str := fun_111(Tpl.emptyTxt, ret_3, l_args__str); | |
| 3334 | ✗ | l_ann__str := dumpAnnotationOptSpace(Tpl.emptyTxt, i_annotationOpt, a_context); | |
| 3335 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("extends ")); | |
| 3336 | ✗ | txt := Tpl.writeText(txt, l_bc__str); | |
| 3337 | ✗ | txt := Tpl.writeText(txt, l_mod__str); | |
| 3338 | ✗ | txt := Tpl.writeText(txt, l_ann__str); | |
| 3339 | then txt; | ||
| 3340 | |||
| 3341 | case ( txt, | ||
| 3342 | (i_specification as Absyn.COMPONENTS(attributes = i_attributes, typeSpec = i_typeSpec, components = i_components)), | ||
| 3343 | _, | ||
| 3344 | a_context ) | ||
| 3345 | algorithm | ||
| 3346 | ✗ | l_attr__str := dumpElementAttr(Tpl.emptyTxt, i_attributes); | |
| 3347 | ✗ | l_ty__str := dumpTypeSpec(Tpl.emptyTxt, i_typeSpec, a_context); | |
| 3348 | ✗ | ret_8 := MMToJuliaUtil.elementSpecIsOUTPUT_OR_BIDIR(i_specification); | |
| 3349 | ✗ | l_comps__str := fun_113(Tpl.emptyTxt, ret_8, l_ty__str, i_components); | |
| 3350 | ✗ | ret_10 := MMToJuliaUtil.elementSpecIsOUTPUT_OR_BIDIR(i_specification); | |
| 3351 | ✗ | l_comps__str__no__local := fun_116(Tpl.emptyTxt, ret_10, l_ty__str, a_context, i_components); | |
| 3352 | ✗ | l_rStr := fun_117(Tpl.emptyTxt, a_context); | |
| 3353 | ✗ | txt := fun_119(txt, a_context, l_comps__str__no__local, l_comps__str); | |
| 3354 | then txt; | ||
| 3355 | |||
| 3356 | case ( txt, | ||
| 3357 | Absyn.IMPORT(import_ = i_import__), | ||
| 3358 | _, | ||
| 3359 | _ ) | ||
| 3360 | algorithm | ||
| 3361 | ✗ | l_imp__str := dumpImport(Tpl.emptyTxt, i_import__); | |
| 3362 | ✗ | txt := Tpl.writeText(txt, l_imp__str); | |
| 3363 | then txt; | ||
| 3364 | |||
| 3365 | case ( txt, | ||
| 3366 | _, | ||
| 3367 | _, | ||
| 3368 | _ ) | ||
| 3369 | then txt; | ||
| 3370 | end match; | ||
| 3371 | end dumpElementSpec; | ||
| 3372 | |||
| 3373 | protected function lm_121 | ||
| 3374 | input output Tpl.Text txt; | ||
| 3375 | input list<Absyn.ComponentItem> items; | ||
| 3376 | input MMToJuliaUtil.Context a_context; | ||
| 3377 | algorithm | ||
| 3378 | ✗ | for lstElt_121 in items loop | |
| 3379 | txt := match lstElt_121 | ||
| 3380 | local | ||
| 3381 | Absyn.ComponentItem i_comp; | ||
| 3382 | |||
| 3383 | case i_comp | ||
| 3384 | algorithm | ||
| 3385 | ✗ | txt := dumpComponentItem(txt, i_comp, a_context); | |
| 3386 | ✗ | txt := Tpl.nextIter(txt); | |
| 3387 | then txt; | ||
| 3388 | end match; | ||
| 3389 | end for; | ||
| 3390 | end lm_121; | ||
| 3391 | |||
| 3392 | protected function fun_122 | ||
| 3393 | input Tpl.Text in_txt; | ||
| 3394 | input Absyn.ElementSpec in_a_specification; | ||
| 3395 | input MMToJuliaUtil.Context in_a_context; | ||
| 3396 | |||
| 3397 | output Tpl.Text out_txt; | ||
| 3398 | algorithm | ||
| 3399 | out_txt := | ||
| 3400 | match(in_txt, in_a_specification, in_a_context) | ||
| 3401 | local | ||
| 3402 | Tpl.Text txt; | ||
| 3403 | MMToJuliaUtil.Context a_context; | ||
| 3404 | list<Absyn.ComponentItem> i_components; | ||
| 3405 | Tpl.Text l_comps__str; | ||
| 3406 | |||
| 3407 | case ( txt, | ||
| 3408 | Absyn.COMPONENTS(components = i_components), | ||
| 3409 | a_context ) | ||
| 3410 | algorithm | ||
| 3411 | ✗ | l_comps__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())); | |
| 3412 | ✗ | l_comps__str := lm_121(l_comps__str, i_components, a_context); | |
| 3413 | ✗ | l_comps__str := Tpl.popIter(l_comps__str); | |
| 3414 | ✗ | txt := Tpl.writeText(txt, l_comps__str); | |
| 3415 | then txt; | ||
| 3416 | |||
| 3417 | case ( txt, | ||
| 3418 | _, | ||
| 3419 | _ ) | ||
| 3420 | then txt; | ||
| 3421 | end match; | ||
| 3422 | end fun_122; | ||
| 3423 | |||
| 3424 | public function dumpElementSpecForComponents | ||
| 3425 | input Tpl.Text txt; | ||
| 3426 | input Absyn.ElementSpec a_specification; | ||
| 3427 | input Dump.DumpOptions a_options; | ||
| 3428 | input MMToJuliaUtil.Context a_context; | ||
| 3429 | |||
| 3430 | output Tpl.Text out_txt; | ||
| 3431 | algorithm | ||
| 3432 | ✗ | out_txt := fun_122(txt, a_specification, a_context); | |
| 3433 | end dumpElementSpecForComponents; | ||
| 3434 | |||
| 3435 | public function dumpElementAttr | ||
| 3436 | input Tpl.Text in_txt; | ||
| 3437 | input Absyn.ElementAttributes in_a_attr; | ||
| 3438 | |||
| 3439 | output Tpl.Text out_txt; | ||
| 3440 | algorithm | ||
| 3441 | out_txt := | ||
| 3442 | match(in_txt, in_a_attr) | ||
| 3443 | local | ||
| 3444 | Tpl.Text txt; | ||
| 3445 | Absyn.Variability i_variability; | ||
| 3446 | Tpl.Text l_var__str; | ||
| 3447 | |||
| 3448 | case ( txt, | ||
| 3449 | Absyn.ATTR(variability = i_variability) ) | ||
| 3450 | algorithm | ||
| 3451 | ✗ | l_var__str := dumpVariability(Tpl.emptyTxt, i_variability); | |
| 3452 | ✗ | txt := Tpl.writeText(txt, l_var__str); | |
| 3453 | then txt; | ||
| 3454 | |||
| 3455 | case ( txt, | ||
| 3456 | _ ) | ||
| 3457 | then txt; | ||
| 3458 | end match; | ||
| 3459 | end dumpElementAttr; | ||
| 3460 | |||
| 3461 | public function dumpVariability | ||
| 3462 | input Tpl.Text in_txt; | ||
| 3463 | input Absyn.Variability in_a_var; | ||
| 3464 | |||
| 3465 | output Tpl.Text out_txt; | ||
| 3466 | algorithm | ||
| 3467 | out_txt := | ||
| 3468 | match(in_txt, in_a_var) | ||
| 3469 | local | ||
| 3470 | Tpl.Text txt; | ||
| 3471 | |||
| 3472 | case ( txt, | ||
| 3473 | Absyn.VAR() ) | ||
| 3474 | then txt; | ||
| 3475 | |||
| 3476 | case ( txt, | ||
| 3477 | Absyn.CONST() ) | ||
| 3478 | then txt; | ||
| 3479 | |||
| 3480 | case ( txt, | ||
| 3481 | _ ) | ||
| 3482 | algorithm | ||
| 3483 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpVariability: Only const and var are supported"); | |
| 3484 | then txt; | ||
| 3485 | end match; | ||
| 3486 | end dumpVariability; | ||
| 3487 | |||
| 3488 | protected function lm_126 | ||
| 3489 | input output Tpl.Text txt; | ||
| 3490 | input list<Absyn.ElementArg> items; | ||
| 3491 | input MMToJuliaUtil.Context a_context; | ||
| 3492 | algorithm | ||
| 3493 | ✗ | for lstElt_126 in items loop | |
| 3494 | txt := match lstElt_126 | ||
| 3495 | local | ||
| 3496 | Absyn.ElementArg i_e; | ||
| 3497 | |||
| 3498 | case i_e | ||
| 3499 | algorithm | ||
| 3500 | ✗ | txt := dumpElementArg(txt, i_e, a_context); | |
| 3501 | ✗ | txt := Tpl.nextIter(txt); | |
| 3502 | then txt; | ||
| 3503 | end match; | ||
| 3504 | end for; | ||
| 3505 | end lm_126; | ||
| 3506 | |||
| 3507 | protected function fun_127 | ||
| 3508 | input Tpl.Text in_txt; | ||
| 3509 | input list<Absyn.ElementArg> in_a_el; | ||
| 3510 | input MMToJuliaUtil.Context in_a_context; | ||
| 3511 | |||
| 3512 | output Tpl.Text out_txt; | ||
| 3513 | algorithm | ||
| 3514 | out_txt := | ||
| 3515 | match(in_txt, in_a_el, in_a_context) | ||
| 3516 | local | ||
| 3517 | Tpl.Text txt; | ||
| 3518 | MMToJuliaUtil.Context a_context; | ||
| 3519 | list<Absyn.ElementArg> i_el; | ||
| 3520 | |||
| 3521 | case ( txt, | ||
| 3522 | {}, | ||
| 3523 | _ ) | ||
| 3524 | then txt; | ||
| 3525 | |||
| 3526 | case ( txt, | ||
| 3527 | i_el, | ||
| 3528 | a_context ) | ||
| 3529 | algorithm | ||
| 3530 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 3531 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 3532 | ✗ | txt := lm_126(txt, i_el, a_context); | |
| 3533 | ✗ | txt := Tpl.popIter(txt); | |
| 3534 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 3535 | then txt; | ||
| 3536 | end match; | ||
| 3537 | end fun_127; | ||
| 3538 | |||
| 3539 | public function dumpConstrainClass | ||
| 3540 | input Tpl.Text in_txt; | ||
| 3541 | input Absyn.ConstrainClass in_a_cc; | ||
| 3542 | input MMToJuliaUtil.Context in_a_context; | ||
| 3543 | |||
| 3544 | output Tpl.Text out_txt; | ||
| 3545 | algorithm | ||
| 3546 | out_txt := | ||
| 3547 | match(in_txt, in_a_cc, in_a_context) | ||
| 3548 | local | ||
| 3549 | Tpl.Text txt; | ||
| 3550 | MMToJuliaUtil.Context a_context; | ||
| 3551 | Option<Absyn.Comment> i_comment; | ||
| 3552 | list<Absyn.ElementArg> i_el; | ||
| 3553 | Absyn.Path i_p; | ||
| 3554 | Tpl.Text l_cmt__str; | ||
| 3555 | Tpl.Text l_el__str; | ||
| 3556 | Tpl.Text l_path__str; | ||
| 3557 | |||
| 3558 | case ( txt, | ||
| 3559 | Absyn.CONSTRAINCLASS(elementSpec = Absyn.EXTENDS(path = i_p, elementArg = i_el), comment = i_comment), | ||
| 3560 | a_context ) | ||
| 3561 | algorithm | ||
| 3562 | ✗ | l_path__str := dumpPathJL(Tpl.emptyTxt, i_p); | |
| 3563 | ✗ | l_el__str := fun_127(Tpl.emptyTxt, i_el, a_context); | |
| 3564 | ✗ | l_cmt__str := dumpCommentOpt(Tpl.emptyTxt, i_comment, a_context); | |
| 3565 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 3566 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("constrainedby ")); | |
| 3567 | ✗ | txt := Tpl.writeText(txt, l_path__str); | |
| 3568 | ✗ | txt := Tpl.writeText(txt, l_el__str); | |
| 3569 | ✗ | txt := Tpl.writeText(txt, l_cmt__str); | |
| 3570 | ✗ | txt := Tpl.popBlock(txt); | |
| 3571 | then txt; | ||
| 3572 | |||
| 3573 | case ( txt, | ||
| 3574 | _, | ||
| 3575 | _ ) | ||
| 3576 | then txt; | ||
| 3577 | end match; | ||
| 3578 | end dumpConstrainClass; | ||
| 3579 | |||
| 3580 | protected function lm_129 | ||
| 3581 | input output Tpl.Text txt; | ||
| 3582 | input list<Absyn.ComponentItem> items; | ||
| 3583 | input MMToJuliaUtil.Context a_context; | ||
| 3584 | algorithm | ||
| 3585 | ✗ | for lstElt_129 in items loop | |
| 3586 | txt := match lstElt_129 | ||
| 3587 | local | ||
| 3588 | Absyn.ComponentItem i_ci; | ||
| 3589 | |||
| 3590 | case i_ci | ||
| 3591 | algorithm | ||
| 3592 | ✗ | txt := dumpComponentItemWithoutCondString(txt, i_ci, a_context); | |
| 3593 | ✗ | txt := Tpl.nextIter(txt); | |
| 3594 | then txt; | ||
| 3595 | end match; | ||
| 3596 | end for; | ||
| 3597 | end lm_129; | ||
| 3598 | |||
| 3599 | public function dumpComponentItems | ||
| 3600 | input Tpl.Text txt; | ||
| 3601 | input list<Absyn.ComponentItem> a_componentItems; | ||
| 3602 | input MMToJuliaUtil.Context a_context; | ||
| 3603 | |||
| 3604 | output Tpl.Text out_txt; | ||
| 3605 | algorithm | ||
| 3606 | ✗ | out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 3607 | ✗ | out_txt := lm_129(out_txt, a_componentItems, a_context); | |
| 3608 | ✗ | out_txt := Tpl.popIter(out_txt); | |
| 3609 | end dumpComponentItems; | ||
| 3610 | |||
| 3611 | public function dumpComponentItem | ||
| 3612 | input Tpl.Text in_txt; | ||
| 3613 | input Absyn.ComponentItem in_a_comp; | ||
| 3614 | input MMToJuliaUtil.Context in_a_context; | ||
| 3615 | |||
| 3616 | output Tpl.Text out_txt; | ||
| 3617 | algorithm | ||
| 3618 | out_txt := | ||
| 3619 | match(in_txt, in_a_comp, in_a_context) | ||
| 3620 | local | ||
| 3621 | Tpl.Text txt; | ||
| 3622 | MMToJuliaUtil.Context a_context; | ||
| 3623 | Option<Absyn.Comment> i_comment; | ||
| 3624 | Option<Absyn.ComponentCondition> i_condition; | ||
| 3625 | Absyn.Component i_component; | ||
| 3626 | Tpl.Text l_cmt; | ||
| 3627 | Tpl.Text l_cond__str; | ||
| 3628 | Tpl.Text l_comp__str; | ||
| 3629 | |||
| 3630 | case ( txt, | ||
| 3631 | Absyn.COMPONENTITEM(component = i_component, condition = i_condition, comment = i_comment), | ||
| 3632 | a_context ) | ||
| 3633 | algorithm | ||
| 3634 | ✗ | l_comp__str := dumpComponent(Tpl.emptyTxt, i_component, a_context); | |
| 3635 | ✗ | l_cond__str := dumpComponentCondition(Tpl.emptyTxt, i_condition, a_context); | |
| 3636 | ✗ | l_cmt := dumpCommentOpt(Tpl.emptyTxt, i_comment, a_context); | |
| 3637 | ✗ | txt := Tpl.writeText(txt, l_comp__str); | |
| 3638 | ✗ | txt := Tpl.writeText(txt, l_cond__str); | |
| 3639 | ✗ | txt := Tpl.writeText(txt, l_cmt); | |
| 3640 | then txt; | ||
| 3641 | |||
| 3642 | case ( txt, | ||
| 3643 | _, | ||
| 3644 | _ ) | ||
| 3645 | then txt; | ||
| 3646 | end match; | ||
| 3647 | end dumpComponentItem; | ||
| 3648 | |||
| 3649 | public function dumpComponentItemWithoutCondString | ||
| 3650 | input Tpl.Text in_txt; | ||
| 3651 | input Absyn.ComponentItem in_a_comp; | ||
| 3652 | input MMToJuliaUtil.Context in_a_context; | ||
| 3653 | |||
| 3654 | output Tpl.Text out_txt; | ||
| 3655 | algorithm | ||
| 3656 | out_txt := | ||
| 3657 | match(in_txt, in_a_comp, in_a_context) | ||
| 3658 | local | ||
| 3659 | Tpl.Text txt; | ||
| 3660 | MMToJuliaUtil.Context a_context; | ||
| 3661 | Option<Absyn.Comment> i_comment; | ||
| 3662 | Absyn.Component i_component; | ||
| 3663 | Tpl.Text l_cmt; | ||
| 3664 | Tpl.Text l_comp__str; | ||
| 3665 | |||
| 3666 | case ( txt, | ||
| 3667 | Absyn.COMPONENTITEM(component = i_component, comment = i_comment), | ||
| 3668 | a_context ) | ||
| 3669 | algorithm | ||
| 3670 | ✗ | l_comp__str := dumpComponent(Tpl.emptyTxt, i_component, a_context); | |
| 3671 | ✗ | l_cmt := dumpCommentOpt(Tpl.emptyTxt, i_comment, a_context); | |
| 3672 | ✗ | txt := Tpl.writeText(txt, l_comp__str); | |
| 3673 | ✗ | txt := Tpl.writeText(txt, l_cmt); | |
| 3674 | then txt; | ||
| 3675 | |||
| 3676 | case ( txt, | ||
| 3677 | _, | ||
| 3678 | _ ) | ||
| 3679 | then txt; | ||
| 3680 | end match; | ||
| 3681 | end dumpComponentItemWithoutCondString; | ||
| 3682 | |||
| 3683 | protected function fun_133 | ||
| 3684 | input Tpl.Text in_txt; | ||
| 3685 | input Option<Absyn.Modification> in_a_modification; | ||
| 3686 | input MMToJuliaUtil.Context in_a_context; | ||
| 3687 | |||
| 3688 | output Tpl.Text out_txt; | ||
| 3689 | algorithm | ||
| 3690 | out_txt := | ||
| 3691 | match(in_txt, in_a_modification, in_a_context) | ||
| 3692 | local | ||
| 3693 | Tpl.Text txt; | ||
| 3694 | MMToJuliaUtil.Context a_context; | ||
| 3695 | Absyn.Modification i_mod; | ||
| 3696 | |||
| 3697 | case ( txt, | ||
| 3698 | SOME(i_mod), | ||
| 3699 | a_context ) | ||
| 3700 | algorithm | ||
| 3701 | ✗ | txt := dumpModification(txt, i_mod, a_context); | |
| 3702 | then txt; | ||
| 3703 | |||
| 3704 | case ( txt, | ||
| 3705 | _, | ||
| 3706 | _ ) | ||
| 3707 | then txt; | ||
| 3708 | end match; | ||
| 3709 | end fun_133; | ||
| 3710 | |||
| 3711 | protected function fun_134 | ||
| 3712 | input Tpl.Text in_txt; | ||
| 3713 | input MMToJuliaUtil.Context in_a_context; | ||
| 3714 | input Tpl.Text in_a_mod__str; | ||
| 3715 | input Tpl.Text in_a_dim__str; | ||
| 3716 | input Tpl.Text in_a_component__name; | ||
| 3717 | |||
| 3718 | output Tpl.Text out_txt; | ||
| 3719 | algorithm | ||
| 3720 | out_txt := | ||
| 3721 | match(in_txt, in_a_context, in_a_mod__str, in_a_dim__str, in_a_component__name) | ||
| 3722 | local | ||
| 3723 | Tpl.Text txt; | ||
| 3724 | Tpl.Text a_mod__str; | ||
| 3725 | Tpl.Text a_dim__str; | ||
| 3726 | Tpl.Text a_component__name; | ||
| 3727 | String i_ty__str; | ||
| 3728 | |||
| 3729 | case ( txt, | ||
| 3730 | MMToJuliaUtil.FUNCTION_RETURN_CONTEXT(ty_str = i_ty__str), | ||
| 3731 | a_mod__str, | ||
| 3732 | a_dim__str, | ||
| 3733 | a_component__name ) | ||
| 3734 | algorithm | ||
| 3735 | ✗ | txt := Tpl.writeText(txt, a_component__name); | |
| 3736 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("::")); | |
| 3737 | ✗ | txt := Tpl.writeStr(txt, i_ty__str); | |
| 3738 | ✗ | txt := Tpl.writeText(txt, a_dim__str); | |
| 3739 | ✗ | txt := Tpl.writeText(txt, a_mod__str); | |
| 3740 | then txt; | ||
| 3741 | |||
| 3742 | case ( txt, | ||
| 3743 | MMToJuliaUtil.FUNCTION(retValsStr = _), | ||
| 3744 | _, | ||
| 3745 | _, | ||
| 3746 | a_component__name ) | ||
| 3747 | algorithm | ||
| 3748 | ✗ | txt := Tpl.writeText(txt, a_component__name); | |
| 3749 | then txt; | ||
| 3750 | |||
| 3751 | case ( txt, | ||
| 3752 | MMToJuliaUtil.INPUT_CONTEXT(ty_str = i_ty__str), | ||
| 3753 | a_mod__str, | ||
| 3754 | a_dim__str, | ||
| 3755 | a_component__name ) | ||
| 3756 | algorithm | ||
| 3757 | ✗ | txt := Tpl.writeText(txt, a_component__name); | |
| 3758 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("::")); | |
| 3759 | ✗ | txt := Tpl.writeStr(txt, i_ty__str); | |
| 3760 | ✗ | txt := Tpl.writeText(txt, a_dim__str); | |
| 3761 | ✗ | txt := Tpl.writeText(txt, a_mod__str); | |
| 3762 | then txt; | ||
| 3763 | |||
| 3764 | case ( txt, | ||
| 3765 | _, | ||
| 3766 | a_mod__str, | ||
| 3767 | a_dim__str, | ||
| 3768 | a_component__name ) | ||
| 3769 | algorithm | ||
| 3770 | ✗ | txt := Tpl.writeText(txt, a_component__name); | |
| 3771 | ✗ | txt := Tpl.writeText(txt, a_dim__str); | |
| 3772 | ✗ | txt := Tpl.writeText(txt, a_mod__str); | |
| 3773 | then txt; | ||
| 3774 | end match; | ||
| 3775 | end fun_134; | ||
| 3776 | |||
| 3777 | public function dumpComponent | ||
| 3778 | input Tpl.Text in_txt; | ||
| 3779 | input Absyn.Component in_a_comp; | ||
| 3780 | input MMToJuliaUtil.Context in_a_context; | ||
| 3781 | |||
| 3782 | output Tpl.Text out_txt; | ||
| 3783 | algorithm | ||
| 3784 | out_txt := | ||
| 3785 | match(in_txt, in_a_comp, in_a_context) | ||
| 3786 | local | ||
| 3787 | Tpl.Text txt; | ||
| 3788 | MMToJuliaUtil.Context a_context; | ||
| 3789 | Absyn.Ident i_name; | ||
| 3790 | Option<Absyn.Modification> i_modification; | ||
| 3791 | Absyn.ArrayDim i_arrayDim; | ||
| 3792 | Tpl.Text l_component__name; | ||
| 3793 | Tpl.Text l_mod__str; | ||
| 3794 | Tpl.Text l_dim__str; | ||
| 3795 | |||
| 3796 | case ( txt, | ||
| 3797 | Absyn.COMPONENT(arrayDim = i_arrayDim, modification = i_modification, name = i_name), | ||
| 3798 | a_context ) | ||
| 3799 | algorithm | ||
| 3800 | ✗ | l_dim__str := dumpSubscripts(Tpl.emptyTxt, i_arrayDim, a_context); | |
| 3801 | ✗ | l_mod__str := fun_133(Tpl.emptyTxt, i_modification, a_context); | |
| 3802 | ✗ | l_component__name := Tpl.writeStr(Tpl.emptyTxt, i_name); | |
| 3803 | ✗ | txt := fun_134(txt, a_context, l_mod__str, l_dim__str, l_component__name); | |
| 3804 | then txt; | ||
| 3805 | |||
| 3806 | case ( txt, | ||
| 3807 | _, | ||
| 3808 | _ ) | ||
| 3809 | then txt; | ||
| 3810 | end match; | ||
| 3811 | end dumpComponent; | ||
| 3812 | |||
| 3813 | public function dumpComponentCondition | ||
| 3814 | input Tpl.Text in_txt; | ||
| 3815 | input Option<Absyn.ComponentCondition> in_a_cond; | ||
| 3816 | input MMToJuliaUtil.Context in_a_context; | ||
| 3817 | |||
| 3818 | output Tpl.Text out_txt; | ||
| 3819 | algorithm | ||
| 3820 | out_txt := | ||
| 3821 | match(in_txt, in_a_cond, in_a_context) | ||
| 3822 | local | ||
| 3823 | Tpl.Text txt; | ||
| 3824 | MMToJuliaUtil.Context a_context; | ||
| 3825 | Absyn.ComponentCondition i_cexp; | ||
| 3826 | Tpl.Text l_exp__str; | ||
| 3827 | |||
| 3828 | case ( txt, | ||
| 3829 | SOME(i_cexp), | ||
| 3830 | a_context ) | ||
| 3831 | algorithm | ||
| 3832 | ✗ | l_exp__str := dumpExp(Tpl.emptyTxt, i_cexp, a_context); | |
| 3833 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 3834 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("if ")); | |
| 3835 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 3836 | ✗ | txt := Tpl.popBlock(txt); | |
| 3837 | then txt; | ||
| 3838 | |||
| 3839 | case ( txt, | ||
| 3840 | _, | ||
| 3841 | _ ) | ||
| 3842 | then txt; | ||
| 3843 | end match; | ||
| 3844 | end dumpComponentCondition; | ||
| 3845 | |||
| 3846 | protected function fun_137 | ||
| 3847 | input Tpl.Text in_txt; | ||
| 3848 | input String in_mArg; | ||
| 3849 | input Tpl.Text in_a_path__str; | ||
| 3850 | |||
| 3851 | output Tpl.Text out_txt; | ||
| 3852 | algorithm | ||
| 3853 | out_txt := | ||
| 3854 | match(in_txt, in_mArg, in_a_path__str) | ||
| 3855 | local | ||
| 3856 | Tpl.Text txt; | ||
| 3857 | Tpl.Text a_path__str; | ||
| 3858 | |||
| 3859 | case ( txt, | ||
| 3860 | "Array", | ||
| 3861 | _ ) | ||
| 3862 | algorithm | ||
| 3863 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("import ArrayUtil")); | |
| 3864 | then txt; | ||
| 3865 | |||
| 3866 | case ( txt, | ||
| 3867 | "List", | ||
| 3868 | _ ) | ||
| 3869 | algorithm | ||
| 3870 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("import ListUtil")); | |
| 3871 | then txt; | ||
| 3872 | |||
| 3873 | case ( txt, | ||
| 3874 | _, | ||
| 3875 | a_path__str ) | ||
| 3876 | algorithm | ||
| 3877 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("import ")); | |
| 3878 | ✗ | txt := Tpl.writeText(txt, a_path__str); | |
| 3879 | then txt; | ||
| 3880 | end match; | ||
| 3881 | end fun_137; | ||
| 3882 | |||
| 3883 | protected function lm_138 | ||
| 3884 | input output Tpl.Text txt; | ||
| 3885 | input list<Absyn.GroupImport> items; | ||
| 3886 | algorithm | ||
| 3887 | ✗ | for lstElt_138 in items loop | |
| 3888 | txt := match lstElt_138 | ||
| 3889 | local | ||
| 3890 | Absyn.GroupImport i_group; | ||
| 3891 | |||
| 3892 | case i_group | ||
| 3893 | algorithm | ||
| 3894 | ✗ | txt := dumpGroupImport(txt, i_group); | |
| 3895 | ✗ | txt := Tpl.nextIter(txt); | |
| 3896 | then txt; | ||
| 3897 | end match; | ||
| 3898 | end for; | ||
| 3899 | end lm_138; | ||
| 3900 | |||
| 3901 | public function dumpImport | ||
| 3902 | input Tpl.Text in_txt; | ||
| 3903 | input Absyn.Import in_a_imp; | ||
| 3904 | |||
| 3905 | output Tpl.Text out_txt; | ||
| 3906 | algorithm | ||
| 3907 | out_txt := | ||
| 3908 | match(in_txt, in_a_imp) | ||
| 3909 | local | ||
| 3910 | Tpl.Text txt; | ||
| 3911 | list<Absyn.GroupImport> i_groups; | ||
| 3912 | Absyn.Path i_prefix; | ||
| 3913 | Absyn.Ident i_name; | ||
| 3914 | Absyn.Path i_path; | ||
| 3915 | Tpl.Text l_groups__str; | ||
| 3916 | Tpl.Text l_prefix__str; | ||
| 3917 | String str_1; | ||
| 3918 | Tpl.Text l_path__str; | ||
| 3919 | |||
| 3920 | case ( txt, | ||
| 3921 | Absyn.NAMED_IMPORT(path = i_path, name = i_name) ) | ||
| 3922 | algorithm | ||
| 3923 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("import ")); | |
| 3924 | ✗ | txt := dumpPathJL(txt, i_path); | |
| 3925 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("; ")); | |
| 3926 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 3927 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=")); | |
| 3928 | ✗ | txt := dumpPathJL(txt, i_path); | |
| 3929 | then txt; | ||
| 3930 | |||
| 3931 | case ( txt, | ||
| 3932 | Absyn.QUAL_IMPORT(path = i_path) ) | ||
| 3933 | algorithm | ||
| 3934 | ✗ | l_path__str := dumpPathJL(Tpl.emptyTxt, i_path); | |
| 3935 | ✗ | str_1 := Tpl.textString(l_path__str); | |
| 3936 | ✗ | txt := fun_137(txt, str_1, l_path__str); | |
| 3937 | then txt; | ||
| 3938 | |||
| 3939 | case ( txt, | ||
| 3940 | Absyn.UNQUAL_IMPORT(path = i_path) ) | ||
| 3941 | algorithm | ||
| 3942 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("using ")); | |
| 3943 | ✗ | txt := dumpPathJL(txt, i_path); | |
| 3944 | then txt; | ||
| 3945 | |||
| 3946 | case ( txt, | ||
| 3947 | Absyn.GROUP_IMPORT(prefix = i_prefix, groups = i_groups) ) | ||
| 3948 | algorithm | ||
| 3949 | ✗ | l_prefix__str := dumpPathJL(Tpl.emptyTxt, i_prefix); | |
| 3950 | ✗ | l_groups__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())); | |
| 3951 | ✗ | l_groups__str := lm_138(l_groups__str, i_groups); | |
| 3952 | ✗ | l_groups__str := Tpl.popIter(l_groups__str); | |
| 3953 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("using ")); | |
| 3954 | ✗ | txt := Tpl.writeText(txt, l_prefix__str); | |
| 3955 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(": ")); | |
| 3956 | ✗ | txt := Tpl.writeText(txt, l_groups__str); | |
| 3957 | then txt; | ||
| 3958 | |||
| 3959 | case ( txt, | ||
| 3960 | _ ) | ||
| 3961 | then txt; | ||
| 3962 | end match; | ||
| 3963 | end dumpImport; | ||
| 3964 | |||
| 3965 | public function dumpGroupImport | ||
| 3966 | input Tpl.Text in_txt; | ||
| 3967 | input Absyn.GroupImport in_a_gimp; | ||
| 3968 | |||
| 3969 | output Tpl.Text out_txt; | ||
| 3970 | algorithm | ||
| 3971 | out_txt := | ||
| 3972 | match(in_txt, in_a_gimp) | ||
| 3973 | local | ||
| 3974 | Tpl.Text txt; | ||
| 3975 | String i_rename; | ||
| 3976 | String i_name; | ||
| 3977 | |||
| 3978 | case ( txt, | ||
| 3979 | Absyn.GROUP_IMPORT_NAME(name = i_name) ) | ||
| 3980 | algorithm | ||
| 3981 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 3982 | then txt; | ||
| 3983 | |||
| 3984 | case ( txt, | ||
| 3985 | Absyn.GROUP_IMPORT_RENAME(rename = i_rename, name = i_name) ) | ||
| 3986 | algorithm | ||
| 3987 | ✗ | txt := Tpl.writeStr(txt, i_rename); | |
| 3988 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 3989 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 3990 | then txt; | ||
| 3991 | |||
| 3992 | case ( txt, | ||
| 3993 | _ ) | ||
| 3994 | then txt; | ||
| 3995 | end match; | ||
| 3996 | end dumpGroupImport; | ||
| 3997 | |||
| 3998 | public function dumpEquation | ||
| 3999 | input Tpl.Text txt; | ||
| 4000 | input Absyn.Equation a_eq; | ||
| 4001 | |||
| 4002 | output Tpl.Text out_txt; | ||
| 4003 | algorithm | ||
| 4004 | ✗ | out_txt := Tpl.writeTok(txt, Tpl.ST_STRING("No equations allowed. Translate them to algorithms")); | |
| 4005 | end dumpEquation; | ||
| 4006 | |||
| 4007 | protected function lm_142 | ||
| 4008 | input output Tpl.Text txt; | ||
| 4009 | input list<Absyn.AlgorithmItem> items; | ||
| 4010 | input MMToJuliaUtil.Context a_context; | ||
| 4011 | algorithm | ||
| 4012 | ✗ | for lstElt_142 in items loop | |
| 4013 | txt := match lstElt_142 | ||
| 4014 | local | ||
| 4015 | Absyn.AlgorithmItem i_alg; | ||
| 4016 | |||
| 4017 | case i_alg | ||
| 4018 | algorithm | ||
| 4019 | ✗ | txt := dumpAlgorithmItem(txt, i_alg, a_context); | |
| 4020 | ✗ | txt := Tpl.nextIter(txt); | |
| 4021 | then txt; | ||
| 4022 | end match; | ||
| 4023 | end for; | ||
| 4024 | end lm_142; | ||
| 4025 | |||
| 4026 | public function dumpAlgorithmItems | ||
| 4027 | input Tpl.Text txt; | ||
| 4028 | input list<Absyn.AlgorithmItem> a_algs; | ||
| 4029 | input MMToJuliaUtil.Context a_context; | ||
| 4030 | |||
| 4031 | output Tpl.Text out_txt; | ||
| 4032 | algorithm | ||
| 4033 | ✗ | 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())); | |
| 4034 | ✗ | out_txt := lm_142(out_txt, a_algs, a_context); | |
| 4035 | ✗ | out_txt := Tpl.popIter(out_txt); | |
| 4036 | end dumpAlgorithmItems; | ||
| 4037 | |||
| 4038 | public function dumpAlgorithmItem | ||
| 4039 | input Tpl.Text in_txt; | ||
| 4040 | input Absyn.AlgorithmItem in_a_alg; | ||
| 4041 | input MMToJuliaUtil.Context in_a_context; | ||
| 4042 | |||
| 4043 | output Tpl.Text out_txt; | ||
| 4044 | algorithm | ||
| 4045 | out_txt := | ||
| 4046 | match(in_txt, in_a_alg, in_a_context) | ||
| 4047 | local | ||
| 4048 | Tpl.Text txt; | ||
| 4049 | MMToJuliaUtil.Context a_context; | ||
| 4050 | String i_comment_1; | ||
| 4051 | Option<Absyn.Comment> i_comment; | ||
| 4052 | Absyn.Algorithm i_algorithm__; | ||
| 4053 | Tpl.Text l_cmt__str; | ||
| 4054 | Tpl.Text l_alg__str; | ||
| 4055 | |||
| 4056 | case ( txt, | ||
| 4057 | Absyn.ALGORITHMITEM(algorithm_ = i_algorithm__, comment = i_comment), | ||
| 4058 | a_context ) | ||
| 4059 | algorithm | ||
| 4060 | ✗ | l_alg__str := dumpAlgorithm(Tpl.emptyTxt, i_algorithm__, a_context); | |
| 4061 | ✗ | l_cmt__str := dumpCommentOpt(Tpl.emptyTxt, i_comment, a_context); | |
| 4062 | ✗ | txt := Tpl.writeText(txt, l_alg__str); | |
| 4063 | ✗ | txt := Tpl.writeText(txt, l_cmt__str); | |
| 4064 | then txt; | ||
| 4065 | |||
| 4066 | case ( txt, | ||
| 4067 | Absyn.ALGORITHMITEMCOMMENT(comment = i_comment_1), | ||
| 4068 | _ ) | ||
| 4069 | algorithm | ||
| 4070 | ✗ | txt := dumpCommentStr(txt, i_comment_1); | |
| 4071 | then txt; | ||
| 4072 | |||
| 4073 | case ( txt, | ||
| 4074 | _, | ||
| 4075 | _ ) | ||
| 4076 | then txt; | ||
| 4077 | end match; | ||
| 4078 | end dumpAlgorithmItem; | ||
| 4079 | |||
| 4080 | protected function fun_145 | ||
| 4081 | input Tpl.Text in_txt; | ||
| 4082 | input Absyn.Exp in_a_assignComponent; | ||
| 4083 | input Tpl.Text in_a_rhs__str; | ||
| 4084 | input Tpl.Text in_a_lhs__str; | ||
| 4085 | |||
| 4086 | output Tpl.Text out_txt; | ||
| 4087 | algorithm | ||
| 4088 | out_txt := | ||
| 4089 | match(in_txt, in_a_assignComponent, in_a_rhs__str, in_a_lhs__str) | ||
| 4090 | local | ||
| 4091 | Tpl.Text txt; | ||
| 4092 | Tpl.Text a_rhs__str; | ||
| 4093 | Tpl.Text a_lhs__str; | ||
| 4094 | |||
| 4095 | case ( txt, | ||
| 4096 | Absyn.CONS(head = _), | ||
| 4097 | a_rhs__str, | ||
| 4098 | a_lhs__str ) | ||
| 4099 | algorithm | ||
| 4100 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@match ")); | |
| 4101 | ✗ | txt := Tpl.writeText(txt, a_lhs__str); | |
| 4102 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 4103 | ✗ | txt := Tpl.writeText(txt, a_rhs__str); | |
| 4104 | then txt; | ||
| 4105 | |||
| 4106 | case ( txt, | ||
| 4107 | _, | ||
| 4108 | a_rhs__str, | ||
| 4109 | a_lhs__str ) | ||
| 4110 | algorithm | ||
| 4111 | ✗ | txt := Tpl.writeText(txt, a_lhs__str); | |
| 4112 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 4113 | ✗ | txt := Tpl.writeText(txt, a_rhs__str); | |
| 4114 | then txt; | ||
| 4115 | end match; | ||
| 4116 | end fun_145; | ||
| 4117 | |||
| 4118 | protected function fun_146 | ||
| 4119 | input Tpl.Text in_txt; | ||
| 4120 | input Boolean in_mArg; | ||
| 4121 | input Absyn.Exp in_a_assignComponent; | ||
| 4122 | input Tpl.Text in_a_rhs__str; | ||
| 4123 | input Tpl.Text in_a_lhs__str; | ||
| 4124 | |||
| 4125 | output Tpl.Text out_txt; | ||
| 4126 | algorithm | ||
| 4127 | out_txt := | ||
| 4128 | match(in_txt, in_mArg, in_a_assignComponent, in_a_rhs__str, in_a_lhs__str) | ||
| 4129 | local | ||
| 4130 | Tpl.Text txt; | ||
| 4131 | Absyn.Exp a_assignComponent; | ||
| 4132 | Tpl.Text a_rhs__str; | ||
| 4133 | Tpl.Text a_lhs__str; | ||
| 4134 | |||
| 4135 | case ( txt, | ||
| 4136 | false, | ||
| 4137 | _, | ||
| 4138 | a_rhs__str, | ||
| 4139 | a_lhs__str ) | ||
| 4140 | algorithm | ||
| 4141 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@match ")); | |
| 4142 | ✗ | txt := Tpl.writeText(txt, a_lhs__str); | |
| 4143 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 4144 | ✗ | txt := Tpl.writeText(txt, a_rhs__str); | |
| 4145 | then txt; | ||
| 4146 | |||
| 4147 | case ( txt, | ||
| 4148 | _, | ||
| 4149 | a_assignComponent, | ||
| 4150 | a_rhs__str, | ||
| 4151 | a_lhs__str ) | ||
| 4152 | algorithm | ||
| 4153 | ✗ | txt := fun_145(txt, a_assignComponent, a_rhs__str, a_lhs__str); | |
| 4154 | then txt; | ||
| 4155 | end match; | ||
| 4156 | end fun_146; | ||
| 4157 | |||
| 4158 | protected function lm_147 | ||
| 4159 | input output Tpl.Text txt; | ||
| 4160 | input list<tuple<Absyn.Exp, list<Absyn.AlgorithmItem>>> items; | ||
| 4161 | input MMToJuliaUtil.Context a_context; | ||
| 4162 | algorithm | ||
| 4163 | ✗ | for lstElt_147 in items loop | |
| 4164 | txt := match lstElt_147 | ||
| 4165 | local | ||
| 4166 | list<Absyn.AlgorithmItem> i_b; | ||
| 4167 | Absyn.Exp i_c; | ||
| 4168 | |||
| 4169 | case (i_c, i_b) | ||
| 4170 | algorithm | ||
| 4171 | ✗ | txt := dumpAlgorithmBranch(txt, i_c, i_b, "elseif", a_context); | |
| 4172 | ✗ | txt := Tpl.nextIter(txt); | |
| 4173 | then txt; | ||
| 4174 | end match; | ||
| 4175 | end for; | ||
| 4176 | end lm_147; | ||
| 4177 | |||
| 4178 | protected function fun_148 | ||
| 4179 | input Tpl.Text in_txt; | ||
| 4180 | input Boolean in_mArg; | ||
| 4181 | input Tpl.Text in_a_else__branch__str; | ||
| 4182 | |||
| 4183 | output Tpl.Text out_txt; | ||
| 4184 | algorithm | ||
| 4185 | out_txt := | ||
| 4186 | match(in_txt, in_mArg, in_a_else__branch__str) | ||
| 4187 | local | ||
| 4188 | Tpl.Text txt; | ||
| 4189 | Tpl.Text a_else__branch__str; | ||
| 4190 | |||
| 4191 | case ( txt, | ||
| 4192 | true, | ||
| 4193 | _ ) | ||
| 4194 | then txt; | ||
| 4195 | |||
| 4196 | case ( txt, | ||
| 4197 | _, | ||
| 4198 | a_else__branch__str ) | ||
| 4199 | algorithm | ||
| 4200 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("else\n")); | |
| 4201 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 4202 | ✗ | txt := Tpl.writeText(txt, a_else__branch__str); | |
| 4203 | ✗ | txt := Tpl.popBlock(txt); | |
| 4204 | then txt; | ||
| 4205 | end match; | ||
| 4206 | end fun_148; | ||
| 4207 | |||
| 4208 | protected function fun_149 | ||
| 4209 | input Tpl.Text in_txt; | ||
| 4210 | input list<Absyn.AlgorithmItem> in_a_equ; | ||
| 4211 | input MMToJuliaUtil.Context in_a_context; | ||
| 4212 | |||
| 4213 | output Tpl.Text out_txt; | ||
| 4214 | algorithm | ||
| 4215 | out_txt := | ||
| 4216 | match(in_txt, in_a_equ, in_a_context) | ||
| 4217 | local | ||
| 4218 | Tpl.Text txt; | ||
| 4219 | MMToJuliaUtil.Context a_context; | ||
| 4220 | list<Absyn.AlgorithmItem> i_equ; | ||
| 4221 | |||
| 4222 | case ( txt, | ||
| 4223 | {}, | ||
| 4224 | _ ) | ||
| 4225 | algorithm | ||
| 4226 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("...")); | |
| 4227 | then txt; | ||
| 4228 | |||
| 4229 | case ( txt, | ||
| 4230 | i_equ, | ||
| 4231 | a_context ) | ||
| 4232 | algorithm | ||
| 4233 | ✗ | txt := dumpAlgorithmItems(txt, i_equ, a_context); | |
| 4234 | then txt; | ||
| 4235 | end match; | ||
| 4236 | end fun_149; | ||
| 4237 | |||
| 4238 | public function dumpAlgorithm | ||
| 4239 | input Tpl.Text in_txt; | ||
| 4240 | input Absyn.Algorithm in_a_alg; | ||
| 4241 | input MMToJuliaUtil.Context in_a_context; | ||
| 4242 | |||
| 4243 | output Tpl.Text out_txt; | ||
| 4244 | algorithm | ||
| 4245 | out_txt := | ||
| 4246 | match(in_txt, in_a_alg, in_a_context) | ||
| 4247 | local | ||
| 4248 | Tpl.Text txt; | ||
| 4249 | MMToJuliaUtil.Context a_context; | ||
| 4250 | list<Absyn.AlgorithmItem> i_elseBody; | ||
| 4251 | list<Absyn.AlgorithmItem> i_body; | ||
| 4252 | list<Absyn.AlgorithmItem> i_equ; | ||
| 4253 | Absyn.FunctionArgs i_functionArgs; | ||
| 4254 | Absyn.ComponentRef i_functionCall; | ||
| 4255 | list<Absyn.AlgorithmItem> i_whileBody; | ||
| 4256 | Absyn.Exp i_boolExpr; | ||
| 4257 | list<Absyn.AlgorithmItem> i_forBody; | ||
| 4258 | Absyn.ForIterators i_iterators; | ||
| 4259 | list<Absyn.AlgorithmItem> i_elseBranch; | ||
| 4260 | list<tuple<Absyn.Exp, list<Absyn.AlgorithmItem>>> i_elseIfAlgorithmBranch; | ||
| 4261 | list<Absyn.AlgorithmItem> i_trueBranch; | ||
| 4262 | Absyn.Exp i_ifExp; | ||
| 4263 | Absyn.Exp i_value; | ||
| 4264 | Absyn.Exp i_assignComponent; | ||
| 4265 | Tpl.Text l_arg2; | ||
| 4266 | Tpl.Text l_arg1; | ||
| 4267 | Tpl.Text l_arg__str; | ||
| 4268 | Tpl.Text l_args__str; | ||
| 4269 | Tpl.Text l_name__str; | ||
| 4270 | Tpl.Text l_while__str; | ||
| 4271 | Tpl.Text l_body__str; | ||
| 4272 | Tpl.Text l_iter__str; | ||
| 4273 | Boolean ret_8; | ||
| 4274 | Tpl.Text l_else__str; | ||
| 4275 | Tpl.Text l_else__branch__str; | ||
| 4276 | Tpl.Text l_elseif__str; | ||
| 4277 | Tpl.Text l_if__str; | ||
| 4278 | Boolean ret_3; | ||
| 4279 | Tpl.Text l_rhs__str; | ||
| 4280 | MMToJuliaUtil.Context ret_1; | ||
| 4281 | Tpl.Text l_lhs__str; | ||
| 4282 | |||
| 4283 | case ( txt, | ||
| 4284 | Absyn.ALG_ASSIGN(assignComponent = i_assignComponent, value = i_value), | ||
| 4285 | a_context ) | ||
| 4286 | algorithm | ||
| 4287 | ✗ | ret_1 := MMToJuliaUtil.makeFunctionContext("listMatchAssign"); | |
| 4288 | ✗ | l_lhs__str := dumpLhsExp(Tpl.emptyTxt, i_assignComponent, ret_1); | |
| 4289 | ✗ | l_rhs__str := dumpExp(Tpl.emptyTxt, i_value, a_context); | |
| 4290 | ✗ | ret_3 := AbsynUtil.complexIsCref(i_assignComponent); | |
| 4291 | ✗ | txt := fun_146(txt, ret_3, i_assignComponent, l_rhs__str, l_lhs__str); | |
| 4292 | then txt; | ||
| 4293 | |||
| 4294 | case ( txt, | ||
| 4295 | Absyn.ALG_IF(ifExp = i_ifExp, trueBranch = i_trueBranch, elseIfAlgorithmBranch = i_elseIfAlgorithmBranch, elseBranch = i_elseBranch), | ||
| 4296 | a_context ) | ||
| 4297 | algorithm | ||
| 4298 | ✗ | l_if__str := dumpAlgorithmBranch(Tpl.emptyTxt, i_ifExp, i_trueBranch, "if", a_context); | |
| 4299 | ✗ | l_elseif__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())); | |
| 4300 | ✗ | l_elseif__str := lm_147(l_elseif__str, i_elseIfAlgorithmBranch, a_context); | |
| 4301 | ✗ | l_elseif__str := Tpl.popIter(l_elseif__str); | |
| 4302 | ✗ | l_else__branch__str := dumpAlgorithmItems(Tpl.emptyTxt, i_elseBranch, a_context); | |
| 4303 | ✗ | ret_8 := Tpl.isEmpty(l_else__branch__str); | |
| 4304 | ✗ | l_else__str := fun_148(Tpl.emptyTxt, ret_8, l_else__branch__str); | |
| 4305 | ✗ | txt := Tpl.writeText(txt, l_if__str); | |
| 4306 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4307 | ✗ | txt := Tpl.writeText(txt, l_elseif__str); | |
| 4308 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4309 | ✗ | txt := Tpl.writeText(txt, l_else__str); | |
| 4310 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4311 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 4312 | then txt; | ||
| 4313 | |||
| 4314 | case ( txt, | ||
| 4315 | Absyn.ALG_FOR(iterators = i_iterators, forBody = i_forBody), | ||
| 4316 | a_context ) | ||
| 4317 | algorithm | ||
| 4318 | ✗ | l_iter__str := dumpForIterators(Tpl.emptyTxt, i_iterators, a_context); | |
| 4319 | ✗ | l_body__str := dumpAlgorithmItems(Tpl.emptyTxt, i_forBody, a_context); | |
| 4320 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("for ")); | |
| 4321 | ✗ | txt := Tpl.writeText(txt, l_iter__str); | |
| 4322 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4323 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 4324 | ✗ | txt := Tpl.writeText(txt, l_body__str); | |
| 4325 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4326 | ✗ | txt := Tpl.popBlock(txt); | |
| 4327 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 4328 | then txt; | ||
| 4329 | |||
| 4330 | case ( txt, | ||
| 4331 | Absyn.ALG_WHILE(boolExpr = i_boolExpr, whileBody = i_whileBody), | ||
| 4332 | a_context ) | ||
| 4333 | algorithm | ||
| 4334 | ✗ | l_while__str := dumpAlgorithmBranch(Tpl.emptyTxt, i_boolExpr, i_whileBody, "while", a_context); | |
| 4335 | ✗ | txt := Tpl.writeText(txt, l_while__str); | |
| 4336 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4337 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 4338 | then txt; | ||
| 4339 | |||
| 4340 | case ( txt, | ||
| 4341 | Absyn.ALG_WHEN_A(boolExpr = _), | ||
| 4342 | _ ) | ||
| 4343 | algorithm | ||
| 4344 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "When statements are not allowed!."); | |
| 4345 | then txt; | ||
| 4346 | |||
| 4347 | case ( txt, | ||
| 4348 | Absyn.ALG_NORETCALL(functionCall = i_functionCall, functionArgs = i_functionArgs), | ||
| 4349 | a_context ) | ||
| 4350 | algorithm | ||
| 4351 | ✗ | l_name__str := dumpCref(Tpl.emptyTxt, i_functionCall, a_context); | |
| 4352 | ✗ | l_args__str := dumpFunctionArgs(Tpl.emptyTxt, i_functionArgs, a_context); | |
| 4353 | ✗ | txt := Tpl.writeText(txt, l_name__str); | |
| 4354 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 4355 | ✗ | txt := Tpl.writeText(txt, l_args__str); | |
| 4356 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 4357 | then txt; | ||
| 4358 | |||
| 4359 | case ( txt, | ||
| 4360 | Absyn.ALG_RETURN(), | ||
| 4361 | a_context ) | ||
| 4362 | algorithm | ||
| 4363 | ✗ | txt := dumpAlgReturnString(txt, a_context); | |
| 4364 | then txt; | ||
| 4365 | |||
| 4366 | case ( txt, | ||
| 4367 | Absyn.ALG_BREAK(), | ||
| 4368 | _ ) | ||
| 4369 | algorithm | ||
| 4370 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("break")); | |
| 4371 | then txt; | ||
| 4372 | |||
| 4373 | case ( txt, | ||
| 4374 | Absyn.ALG_FAILURE(equ = i_equ), | ||
| 4375 | a_context ) | ||
| 4376 | algorithm | ||
| 4377 | ✗ | l_arg__str := fun_149(Tpl.emptyTxt, i_equ, a_context); | |
| 4378 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@shouldFail ")); | |
| 4379 | ✗ | txt := Tpl.writeText(txt, l_arg__str); | |
| 4380 | then txt; | ||
| 4381 | |||
| 4382 | case ( txt, | ||
| 4383 | Absyn.ALG_TRY(body = i_body, elseBody = i_elseBody), | ||
| 4384 | a_context ) | ||
| 4385 | algorithm | ||
| 4386 | ✗ | l_arg1 := dumpAlgorithmItems(Tpl.emptyTxt, i_body, a_context); | |
| 4387 | ✗ | l_arg2 := dumpAlgorithmItems(Tpl.emptyTxt, i_elseBody, a_context); | |
| 4388 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("try\n")); | |
| 4389 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 4390 | ✗ | txt := Tpl.writeText(txt, l_arg1); | |
| 4391 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4392 | ✗ | txt := Tpl.popBlock(txt); | |
| 4393 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("catch\n")); | |
| 4394 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 4395 | ✗ | txt := Tpl.writeText(txt, l_arg2); | |
| 4396 | ✗ | txt := Tpl.softNewLine(txt); | |
| 4397 | ✗ | txt := Tpl.popBlock(txt); | |
| 4398 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 4399 | then txt; | ||
| 4400 | |||
| 4401 | case ( txt, | ||
| 4402 | Absyn.ALG_CONTINUE(), | ||
| 4403 | _ ) | ||
| 4404 | algorithm | ||
| 4405 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("continue")); | |
| 4406 | then txt; | ||
| 4407 | |||
| 4408 | case ( txt, | ||
| 4409 | _, | ||
| 4410 | _ ) | ||
| 4411 | then txt; | ||
| 4412 | end match; | ||
| 4413 | end dumpAlgorithm; | ||
| 4414 | |||
| 4415 | public function dumpAlgReturnString | ||
| 4416 | input Tpl.Text in_txt; | ||
| 4417 | input MMToJuliaUtil.Context in_a_context; | ||
| 4418 | |||
| 4419 | output Tpl.Text out_txt; | ||
| 4420 | algorithm | ||
| 4421 | out_txt := | ||
| 4422 | match(in_txt, in_a_context) | ||
| 4423 | local | ||
| 4424 | Tpl.Text txt; | ||
| 4425 | String i_retValsStr; | ||
| 4426 | |||
| 4427 | case ( txt, | ||
| 4428 | MMToJuliaUtil.FUNCTION(retValsStr = i_retValsStr) ) | ||
| 4429 | algorithm | ||
| 4430 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("return ")); | |
| 4431 | ✗ | txt := Tpl.writeStr(txt, i_retValsStr); | |
| 4432 | then txt; | ||
| 4433 | |||
| 4434 | case ( txt, | ||
| 4435 | _ ) | ||
| 4436 | algorithm | ||
| 4437 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("return")); | |
| 4438 | then txt; | ||
| 4439 | end match; | ||
| 4440 | end dumpAlgReturnString; | ||
| 4441 | |||
| 4442 | protected function lm_152 | ||
| 4443 | input output Tpl.Text txt; | ||
| 4444 | input list<Absyn.AlgorithmItem> items; | ||
| 4445 | input MMToJuliaUtil.Context a_context; | ||
| 4446 | algorithm | ||
| 4447 | ✗ | for lstElt_152 in items loop | |
| 4448 | txt := match lstElt_152 | ||
| 4449 | local | ||
| 4450 | Absyn.AlgorithmItem i_eq; | ||
| 4451 | |||
| 4452 | case i_eq | ||
| 4453 | algorithm | ||
| 4454 | ✗ | txt := dumpAlgorithmItem(txt, i_eq, a_context); | |
| 4455 | ✗ | txt := Tpl.nextIter(txt); | |
| 4456 | then txt; | ||
| 4457 | end match; | ||
| 4458 | end for; | ||
| 4459 | end lm_152; | ||
| 4460 | |||
| 4461 | public function dumpAlgorithmBranch | ||
| 4462 | input Tpl.Text txt; | ||
| 4463 | input Absyn.Exp a_cond; | ||
| 4464 | input list<Absyn.AlgorithmItem> a_body; | ||
| 4465 | input String a_header; | ||
| 4466 | input MMToJuliaUtil.Context a_context; | ||
| 4467 | |||
| 4468 | output Tpl.Text out_txt; | ||
| 4469 | protected | ||
| 4470 | Tpl.Text l_body__str; | ||
| 4471 | Tpl.Text l_cond__str; | ||
| 4472 | algorithm | ||
| 4473 | ✗ | l_cond__str := dumpExp(Tpl.emptyTxt, a_cond, a_context); | |
| 4474 | ✗ | 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())); | |
| 4475 | ✗ | l_body__str := lm_152(l_body__str, a_body, a_context); | |
| 4476 | ✗ | l_body__str := Tpl.popIter(l_body__str); | |
| 4477 | ✗ | out_txt := Tpl.writeStr(txt, a_header); | |
| 4478 | ✗ | out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING(" ")); | |
| 4479 | ✗ | out_txt := Tpl.writeText(out_txt, l_cond__str); | |
| 4480 | ✗ | out_txt := Tpl.softNewLine(out_txt); | |
| 4481 | ✗ | out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(2)); | |
| 4482 | ✗ | out_txt := Tpl.writeText(out_txt, l_body__str); | |
| 4483 | ✗ | out_txt := Tpl.popBlock(out_txt); | |
| 4484 | end dumpAlgorithmBranch; | ||
| 4485 | |||
| 4486 | protected function fun_154 | ||
| 4487 | input Tpl.Text in_txt; | ||
| 4488 | input Boolean in_mArg; | ||
| 4489 | input Absyn.Path in_a_path; | ||
| 4490 | input Absyn.Ident in_a_name; | ||
| 4491 | |||
| 4492 | output Tpl.Text out_txt; | ||
| 4493 | algorithm | ||
| 4494 | out_txt := | ||
| 4495 | match(in_txt, in_mArg, in_a_path, in_a_name) | ||
| 4496 | local | ||
| 4497 | Tpl.Text txt; | ||
| 4498 | Absyn.Path a_path; | ||
| 4499 | Absyn.Ident a_name; | ||
| 4500 | |||
| 4501 | case ( txt, | ||
| 4502 | false, | ||
| 4503 | a_path, | ||
| 4504 | a_name ) | ||
| 4505 | algorithm | ||
| 4506 | ✗ | txt := Tpl.writeStr(txt, a_name); | |
| 4507 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 4508 | ✗ | txt := AbsynDumpTpl.dumpPath(txt, a_path); | |
| 4509 | then txt; | ||
| 4510 | |||
| 4511 | case ( txt, | ||
| 4512 | _, | ||
| 4513 | a_path, | ||
| 4514 | a_name ) | ||
| 4515 | algorithm | ||
| 4516 | ✗ | txt := Tpl.writeStr(txt, a_name); | |
| 4517 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("__")); | |
| 4518 | ✗ | txt := AbsynDumpTpl.dumpPath(txt, a_path); | |
| 4519 | then txt; | ||
| 4520 | end match; | ||
| 4521 | end fun_154; | ||
| 4522 | |||
| 4523 | protected function fun_155 | ||
| 4524 | input Tpl.Text in_txt; | ||
| 4525 | input Absyn.Ident in_a_name; | ||
| 4526 | |||
| 4527 | output Tpl.Text out_txt; | ||
| 4528 | algorithm | ||
| 4529 | out_txt := | ||
| 4530 | match(in_txt, in_a_name) | ||
| 4531 | local | ||
| 4532 | Tpl.Text txt; | ||
| 4533 | Absyn.Ident i_name; | ||
| 4534 | |||
| 4535 | case ( txt, | ||
| 4536 | "Real" ) | ||
| 4537 | algorithm | ||
| 4538 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Float")); | |
| 4539 | then txt; | ||
| 4540 | |||
| 4541 | case ( txt, | ||
| 4542 | "Integer" ) | ||
| 4543 | algorithm | ||
| 4544 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Integer")); | |
| 4545 | then txt; | ||
| 4546 | |||
| 4547 | case ( txt, | ||
| 4548 | "Boolean" ) | ||
| 4549 | algorithm | ||
| 4550 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Bool")); | |
| 4551 | then txt; | ||
| 4552 | |||
| 4553 | case ( txt, | ||
| 4554 | "list" ) | ||
| 4555 | algorithm | ||
| 4556 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("List")); | |
| 4557 | then txt; | ||
| 4558 | |||
| 4559 | case ( txt, | ||
| 4560 | "array" ) | ||
| 4561 | algorithm | ||
| 4562 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Array")); | |
| 4563 | then txt; | ||
| 4564 | |||
| 4565 | case ( txt, | ||
| 4566 | "tuple" ) | ||
| 4567 | algorithm | ||
| 4568 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Tuple")); | |
| 4569 | then txt; | ||
| 4570 | |||
| 4571 | case ( txt, | ||
| 4572 | "polymorphic" ) | ||
| 4573 | algorithm | ||
| 4574 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Any")); | |
| 4575 | then txt; | ||
| 4576 | |||
| 4577 | case ( txt, | ||
| 4578 | "Mutable" ) | ||
| 4579 | algorithm | ||
| 4580 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("MutableType")); | |
| 4581 | then txt; | ||
| 4582 | |||
| 4583 | case ( txt, | ||
| 4584 | i_name ) | ||
| 4585 | algorithm | ||
| 4586 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 4587 | then txt; | ||
| 4588 | end match; | ||
| 4589 | end fun_155; | ||
| 4590 | |||
| 4591 | public function dumpPathJL | ||
| 4592 | input Tpl.Text in_txt; | ||
| 4593 | input Absyn.Path in_a_path; | ||
| 4594 | |||
| 4595 | output Tpl.Text out_txt; | ||
| 4596 | algorithm | ||
| 4597 | out_txt := | ||
| 4598 | match(in_txt, in_a_path) | ||
| 4599 | local | ||
| 4600 | Tpl.Text txt; | ||
| 4601 | Absyn.Ident i_name; | ||
| 4602 | Absyn.Path i_path; | ||
| 4603 | Boolean ret_0; | ||
| 4604 | |||
| 4605 | case ( txt, | ||
| 4606 | Absyn.FULLYQUALIFIED(path = i_path) ) | ||
| 4607 | algorithm | ||
| 4608 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 4609 | ✗ | txt := AbsynDumpTpl.dumpPath(txt, i_path); | |
| 4610 | then txt; | ||
| 4611 | |||
| 4612 | case ( txt, | ||
| 4613 | Absyn.QUALIFIED(name = i_name, path = i_path) ) | ||
| 4614 | algorithm | ||
| 4615 | ✗ | ret_0 := Flags.getConfigBool(Flags.MODELICA_OUTPUT); | |
| 4616 | ✗ | txt := fun_154(txt, ret_0, i_path, i_name); | |
| 4617 | then txt; | ||
| 4618 | |||
| 4619 | case ( txt, | ||
| 4620 | Absyn.IDENT(name = i_name) ) | ||
| 4621 | algorithm | ||
| 4622 | ✗ | txt := fun_155(txt, i_name); | |
| 4623 | then txt; | ||
| 4624 | |||
| 4625 | case ( txt, | ||
| 4626 | _ ) | ||
| 4627 | algorithm | ||
| 4628 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpPathJL: Unknown path."); | |
| 4629 | then txt; | ||
| 4630 | end match; | ||
| 4631 | end dumpPathJL; | ||
| 4632 | |||
| 4633 | public function dumpPathNoQual | ||
| 4634 | input Tpl.Text in_txt; | ||
| 4635 | input Absyn.Path in_a_path; | ||
| 4636 | |||
| 4637 | output Tpl.Text out_txt; | ||
| 4638 | algorithm | ||
| 4639 | out_txt := | ||
| 4640 | match(in_txt, in_a_path) | ||
| 4641 | local | ||
| 4642 | Tpl.Text txt; | ||
| 4643 | Absyn.Path i_path; | ||
| 4644 | |||
| 4645 | case ( txt, | ||
| 4646 | Absyn.FULLYQUALIFIED(path = i_path) ) | ||
| 4647 | algorithm | ||
| 4648 | ✗ | txt := dumpPathJL(txt, i_path); | |
| 4649 | then txt; | ||
| 4650 | |||
| 4651 | case ( txt, | ||
| 4652 | i_path ) | ||
| 4653 | algorithm | ||
| 4654 | ✗ | txt := dumpPathJL(txt, i_path); | |
| 4655 | then txt; | ||
| 4656 | end match; | ||
| 4657 | end dumpPathNoQual; | ||
| 4658 | |||
| 4659 | public function dumpTypeSpecOpt | ||
| 4660 | input Tpl.Text in_txt; | ||
| 4661 | input Option<Absyn.TypeSpec> in_a_typespecOpt; | ||
| 4662 | input MMToJuliaUtil.Context in_a_context; | ||
| 4663 | |||
| 4664 | output Tpl.Text out_txt; | ||
| 4665 | algorithm | ||
| 4666 | out_txt := | ||
| 4667 | match(in_txt, in_a_typespecOpt, in_a_context) | ||
| 4668 | local | ||
| 4669 | Tpl.Text txt; | ||
| 4670 | MMToJuliaUtil.Context a_context; | ||
| 4671 | Absyn.TypeSpec i_ts; | ||
| 4672 | |||
| 4673 | case ( txt, | ||
| 4674 | SOME(i_ts), | ||
| 4675 | a_context ) | ||
| 4676 | algorithm | ||
| 4677 | ✗ | txt := dumpTypeSpec(txt, i_ts, a_context); | |
| 4678 | then txt; | ||
| 4679 | |||
| 4680 | case ( txt, | ||
| 4681 | _, | ||
| 4682 | _ ) | ||
| 4683 | then txt; | ||
| 4684 | end match; | ||
| 4685 | end dumpTypeSpecOpt; | ||
| 4686 | |||
| 4687 | protected function lm_159 | ||
| 4688 | input output Tpl.Text txt; | ||
| 4689 | input list<Absyn.TypeSpec> items; | ||
| 4690 | input MMToJuliaUtil.Context a_context; | ||
| 4691 | algorithm | ||
| 4692 | ✗ | for lstElt_159 in items loop | |
| 4693 | txt := match lstElt_159 | ||
| 4694 | local | ||
| 4695 | Absyn.TypeSpec i_ty; | ||
| 4696 | |||
| 4697 | case i_ty | ||
| 4698 | algorithm | ||
| 4699 | ✗ | txt := dumpTypeSpec(txt, i_ty, a_context); | |
| 4700 | ✗ | txt := Tpl.nextIter(txt); | |
| 4701 | then txt; | ||
| 4702 | end match; | ||
| 4703 | end for; | ||
| 4704 | end lm_159; | ||
| 4705 | |||
| 4706 | protected function fun_160 | ||
| 4707 | input Tpl.Text in_txt; | ||
| 4708 | input MMToJuliaUtil.Context in_a_context; | ||
| 4709 | |||
| 4710 | output Tpl.Text out_txt; | ||
| 4711 | algorithm | ||
| 4712 | out_txt := | ||
| 4713 | match(in_txt, in_a_context) | ||
| 4714 | local | ||
| 4715 | Tpl.Text txt; | ||
| 4716 | |||
| 4717 | case ( txt, | ||
| 4718 | MMToJuliaUtil.INPUT_CONTEXT(ty_str = _) ) | ||
| 4719 | algorithm | ||
| 4720 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("iofunc")); | |
| 4721 | then txt; | ||
| 4722 | |||
| 4723 | case ( txt, | ||
| 4724 | _ ) | ||
| 4725 | then txt; | ||
| 4726 | end match; | ||
| 4727 | end fun_160; | ||
| 4728 | |||
| 4729 | protected function fun_161 | ||
| 4730 | input Tpl.Text in_txt; | ||
| 4731 | input MMToJuliaUtil.Context in_a_context; | ||
| 4732 | |||
| 4733 | output Tpl.Text out_txt; | ||
| 4734 | algorithm | ||
| 4735 | out_txt := | ||
| 4736 | match(in_txt, in_a_context) | ||
| 4737 | local | ||
| 4738 | Tpl.Text txt; | ||
| 4739 | |||
| 4740 | case ( txt, | ||
| 4741 | MMToJuliaUtil.PACKAGE() ) | ||
| 4742 | algorithm | ||
| 4743 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("package")); | |
| 4744 | then txt; | ||
| 4745 | |||
| 4746 | case ( txt, | ||
| 4747 | _ ) | ||
| 4748 | then txt; | ||
| 4749 | end match; | ||
| 4750 | end fun_161; | ||
| 4751 | |||
| 4752 | protected function fun_162 | ||
| 4753 | input Tpl.Text in_txt; | ||
| 4754 | input Boolean in_mArg; | ||
| 4755 | input Tpl.Text in_a_arraydim__str; | ||
| 4756 | input Tpl.Text in_a_ty__str; | ||
| 4757 | input Tpl.Text in_a_path__str; | ||
| 4758 | |||
| 4759 | output Tpl.Text out_txt; | ||
| 4760 | algorithm | ||
| 4761 | out_txt := | ||
| 4762 | match(in_txt, in_mArg, in_a_arraydim__str, in_a_ty__str, in_a_path__str) | ||
| 4763 | local | ||
| 4764 | Tpl.Text txt; | ||
| 4765 | Tpl.Text a_arraydim__str; | ||
| 4766 | Tpl.Text a_ty__str; | ||
| 4767 | Tpl.Text a_path__str; | ||
| 4768 | |||
| 4769 | case ( txt, | ||
| 4770 | true, | ||
| 4771 | a_arraydim__str, | ||
| 4772 | a_ty__str, | ||
| 4773 | a_path__str ) | ||
| 4774 | algorithm | ||
| 4775 | ✗ | txt := Tpl.writeText(txt, a_path__str); | |
| 4776 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("{")); | |
| 4777 | ✗ | txt := Tpl.writeText(txt, a_ty__str); | |
| 4778 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("}")); | |
| 4779 | ✗ | txt := Tpl.writeText(txt, a_arraydim__str); | |
| 4780 | then txt; | ||
| 4781 | |||
| 4782 | case ( txt, | ||
| 4783 | _, | ||
| 4784 | _, | ||
| 4785 | _, | ||
| 4786 | a_path__str ) | ||
| 4787 | algorithm | ||
| 4788 | ✗ | txt := Tpl.writeText(txt, a_path__str); | |
| 4789 | then txt; | ||
| 4790 | end match; | ||
| 4791 | end fun_162; | ||
| 4792 | |||
| 4793 | protected function fun_163 | ||
| 4794 | input Tpl.Text in_txt; | ||
| 4795 | input Boolean in_mArg; | ||
| 4796 | input Tpl.Text in_a_res; | ||
| 4797 | input Tpl.Text in_a_arraydim__str; | ||
| 4798 | input Tpl.Text in_a_ty__str; | ||
| 4799 | input Tpl.Text in_a_path__str; | ||
| 4800 | input Tpl.Text in_a_isPackage; | ||
| 4801 | |||
| 4802 | output Tpl.Text out_txt; | ||
| 4803 | algorithm | ||
| 4804 | out_txt := | ||
| 4805 | match(in_txt, in_mArg, in_a_res, in_a_arraydim__str, in_a_ty__str, in_a_path__str, in_a_isPackage) | ||
| 4806 | local | ||
| 4807 | Tpl.Text txt; | ||
| 4808 | Tpl.Text a_res; | ||
| 4809 | Tpl.Text a_arraydim__str; | ||
| 4810 | Tpl.Text a_ty__str; | ||
| 4811 | Tpl.Text a_path__str; | ||
| 4812 | Tpl.Text a_isPackage; | ||
| 4813 | Boolean ret_0; | ||
| 4814 | |||
| 4815 | case ( txt, | ||
| 4816 | true, | ||
| 4817 | _, | ||
| 4818 | a_arraydim__str, | ||
| 4819 | a_ty__str, | ||
| 4820 | a_path__str, | ||
| 4821 | a_isPackage ) | ||
| 4822 | algorithm | ||
| 4823 | ✗ | ret_0 := Tpl.isEmpty(a_isPackage); | |
| 4824 | ✗ | txt := fun_162(txt, ret_0, a_arraydim__str, a_ty__str, a_path__str); | |
| 4825 | then txt; | ||
| 4826 | |||
| 4827 | case ( txt, | ||
| 4828 | _, | ||
| 4829 | a_res, | ||
| 4830 | _, | ||
| 4831 | _, | ||
| 4832 | _, | ||
| 4833 | _ ) | ||
| 4834 | algorithm | ||
| 4835 | ✗ | txt := Tpl.writeText(txt, a_res); | |
| 4836 | then txt; | ||
| 4837 | end match; | ||
| 4838 | end fun_163; | ||
| 4839 | |||
| 4840 | public function dumpTypeSpec | ||
| 4841 | input Tpl.Text in_txt; | ||
| 4842 | input Absyn.TypeSpec in_a_typeSpec; | ||
| 4843 | input MMToJuliaUtil.Context in_a_context; | ||
| 4844 | |||
| 4845 | output Tpl.Text out_txt; | ||
| 4846 | algorithm | ||
| 4847 | out_txt := | ||
| 4848 | match(in_txt, in_a_typeSpec, in_a_context) | ||
| 4849 | local | ||
| 4850 | Tpl.Text txt; | ||
| 4851 | MMToJuliaUtil.Context a_context; | ||
| 4852 | list<Absyn.TypeSpec> i_typeSpecs; | ||
| 4853 | Option<Absyn.ArrayDim> i_arrayDim; | ||
| 4854 | Absyn.Path i_path; | ||
| 4855 | Boolean ret_7; | ||
| 4856 | Tpl.Text l_res; | ||
| 4857 | Tpl.Text l_ty__str2; | ||
| 4858 | Tpl.Text l_isPackage; | ||
| 4859 | Tpl.Text l_isFunc; | ||
| 4860 | Tpl.Text l_ty__str; | ||
| 4861 | Tpl.Text l_arraydim__str; | ||
| 4862 | Tpl.Text l_path__str; | ||
| 4863 | |||
| 4864 | case ( txt, | ||
| 4865 | Absyn.TPATH(path = i_path, arrayDim = i_arrayDim), | ||
| 4866 | a_context ) | ||
| 4867 | algorithm | ||
| 4868 | ✗ | l_path__str := dumpPathJL(Tpl.emptyTxt, i_path); | |
| 4869 | ✗ | l_arraydim__str := dumpArrayDimOpt(Tpl.emptyTxt, i_arrayDim, a_context); | |
| 4870 | ✗ | txt := Tpl.writeText(txt, l_path__str); | |
| 4871 | ✗ | txt := Tpl.writeText(txt, l_arraydim__str); | |
| 4872 | then txt; | ||
| 4873 | |||
| 4874 | case ( txt, | ||
| 4875 | Absyn.TCOMPLEX(path = i_path, typeSpecs = i_typeSpecs, arrayDim = i_arrayDim), | ||
| 4876 | a_context ) | ||
| 4877 | algorithm | ||
| 4878 | ✗ | l_path__str := dumpPathJL(Tpl.emptyTxt, i_path); | |
| 4879 | ✗ | l_ty__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())); | |
| 4880 | ✗ | l_ty__str := lm_159(l_ty__str, i_typeSpecs, a_context); | |
| 4881 | ✗ | l_ty__str := Tpl.popIter(l_ty__str); | |
| 4882 | ✗ | l_arraydim__str := dumpArrayDimOpt(Tpl.emptyTxt, i_arrayDim, a_context); | |
| 4883 | ✗ | l_isFunc := fun_160(Tpl.emptyTxt, a_context); | |
| 4884 | ✗ | l_isPackage := fun_161(Tpl.emptyTxt, a_context); | |
| 4885 | ✗ | l_ty__str2 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("{<:")); | |
| 4886 | ✗ | l_ty__str2 := Tpl.writeText(l_ty__str2, l_ty__str); | |
| 4887 | ✗ | l_ty__str2 := Tpl.writeTok(l_ty__str2, Tpl.ST_STRING("}")); | |
| 4888 | ✗ | l_res := Tpl.writeText(Tpl.emptyTxt, l_path__str); | |
| 4889 | ✗ | l_res := Tpl.writeText(l_res, l_ty__str2); | |
| 4890 | ✗ | l_res := Tpl.writeText(l_res, l_arraydim__str); | |
| 4891 | ✗ | ret_7 := Tpl.isEmpty(l_isFunc); | |
| 4892 | ✗ | txt := fun_163(txt, ret_7, l_res, l_arraydim__str, l_ty__str, l_path__str, l_isPackage); | |
| 4893 | then txt; | ||
| 4894 | |||
| 4895 | case ( txt, | ||
| 4896 | _, | ||
| 4897 | _ ) | ||
| 4898 | then txt; | ||
| 4899 | end match; | ||
| 4900 | end dumpTypeSpec; | ||
| 4901 | |||
| 4902 | public function dumpArrayDimOptTypeSpec | ||
| 4903 | input Tpl.Text in_txt; | ||
| 4904 | input Option<Absyn.ArrayDim> in_a_arraydim; | ||
| 4905 | input MMToJuliaUtil.Context in_a_context; | ||
| 4906 | |||
| 4907 | output Tpl.Text out_txt; | ||
| 4908 | algorithm | ||
| 4909 | out_txt := | ||
| 4910 | match(in_txt, in_a_arraydim, in_a_context) | ||
| 4911 | local | ||
| 4912 | Tpl.Text txt; | ||
| 4913 | MMToJuliaUtil.Context a_context; | ||
| 4914 | Absyn.ArrayDim i_ad; | ||
| 4915 | |||
| 4916 | case ( txt, | ||
| 4917 | SOME(i_ad), | ||
| 4918 | a_context ) | ||
| 4919 | algorithm | ||
| 4920 | ✗ | txt := dumpSubscriptsTypeSpec(txt, i_ad, a_context); | |
| 4921 | then txt; | ||
| 4922 | |||
| 4923 | case ( txt, | ||
| 4924 | _, | ||
| 4925 | _ ) | ||
| 4926 | then txt; | ||
| 4927 | end match; | ||
| 4928 | end dumpArrayDimOptTypeSpec; | ||
| 4929 | |||
| 4930 | protected function lm_166 | ||
| 4931 | input output Tpl.Text txt; | ||
| 4932 | input list<Absyn.Subscript> items; | ||
| 4933 | algorithm | ||
| 4934 | ✗ | for lstElt_166 in items loop | |
| 4935 | txt := match lstElt_166 | ||
| 4936 | |||
| 4937 | case _ | ||
| 4938 | algorithm | ||
| 4939 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Array")); | |
| 4940 | ✗ | txt := Tpl.nextIter(txt); | |
| 4941 | then txt; | ||
| 4942 | end match; | ||
| 4943 | end for; | ||
| 4944 | end lm_166; | ||
| 4945 | |||
| 4946 | protected function fun_167 | ||
| 4947 | input Tpl.Text in_txt; | ||
| 4948 | input list<Absyn.Subscript> in_a_subscripts; | ||
| 4949 | |||
| 4950 | output Tpl.Text out_txt; | ||
| 4951 | algorithm | ||
| 4952 | out_txt := | ||
| 4953 | match(in_txt, in_a_subscripts) | ||
| 4954 | local | ||
| 4955 | Tpl.Text txt; | ||
| 4956 | list<Absyn.Subscript> i_subscripts; | ||
| 4957 | Tpl.Text l_sub__str; | ||
| 4958 | |||
| 4959 | case ( txt, | ||
| 4960 | {} ) | ||
| 4961 | then txt; | ||
| 4962 | |||
| 4963 | case ( txt, | ||
| 4964 | i_subscripts ) | ||
| 4965 | algorithm | ||
| 4966 | ✗ | l_sub__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())); | |
| 4967 | ✗ | l_sub__str := lm_166(l_sub__str, i_subscripts); | |
| 4968 | ✗ | l_sub__str := Tpl.popIter(l_sub__str); | |
| 4969 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("Array{")); | |
| 4970 | ✗ | txt := Tpl.writeText(txt, l_sub__str); | |
| 4971 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("}")); | |
| 4972 | then txt; | ||
| 4973 | end match; | ||
| 4974 | end fun_167; | ||
| 4975 | |||
| 4976 | public function dumpSubscriptsTypeSpec | ||
| 4977 | input Tpl.Text txt; | ||
| 4978 | input list<Absyn.Subscript> a_subscripts; | ||
| 4979 | input MMToJuliaUtil.Context a_context; | ||
| 4980 | |||
| 4981 | output Tpl.Text out_txt; | ||
| 4982 | algorithm | ||
| 4983 | ✗ | out_txt := fun_167(txt, a_subscripts); | |
| 4984 | end dumpSubscriptsTypeSpec; | ||
| 4985 | |||
| 4986 | public function dumpArrayDimOpt | ||
| 4987 | input Tpl.Text in_txt; | ||
| 4988 | input Option<Absyn.ArrayDim> in_a_arraydim; | ||
| 4989 | input MMToJuliaUtil.Context in_a_context; | ||
| 4990 | |||
| 4991 | output Tpl.Text out_txt; | ||
| 4992 | algorithm | ||
| 4993 | out_txt := | ||
| 4994 | match(in_txt, in_a_arraydim, in_a_context) | ||
| 4995 | local | ||
| 4996 | Tpl.Text txt; | ||
| 4997 | MMToJuliaUtil.Context a_context; | ||
| 4998 | Absyn.ArrayDim i_ad; | ||
| 4999 | |||
| 5000 | case ( txt, | ||
| 5001 | SOME(i_ad), | ||
| 5002 | a_context ) | ||
| 5003 | algorithm | ||
| 5004 | ✗ | txt := dumpSubscripts(txt, i_ad, a_context); | |
| 5005 | then txt; | ||
| 5006 | |||
| 5007 | case ( txt, | ||
| 5008 | _, | ||
| 5009 | _ ) | ||
| 5010 | then txt; | ||
| 5011 | end match; | ||
| 5012 | end dumpArrayDimOpt; | ||
| 5013 | |||
| 5014 | protected function lm_170 | ||
| 5015 | input output Tpl.Text txt; | ||
| 5016 | input list<Absyn.Subscript> items; | ||
| 5017 | input MMToJuliaUtil.Context a_context; | ||
| 5018 | algorithm | ||
| 5019 | ✗ | for lstElt_170 in items loop | |
| 5020 | txt := match lstElt_170 | ||
| 5021 | local | ||
| 5022 | Absyn.Subscript i_s; | ||
| 5023 | |||
| 5024 | case i_s | ||
| 5025 | algorithm | ||
| 5026 | ✗ | txt := dumpSubscript(txt, i_s, a_context); | |
| 5027 | ✗ | txt := Tpl.nextIter(txt); | |
| 5028 | then txt; | ||
| 5029 | end match; | ||
| 5030 | end for; | ||
| 5031 | end lm_170; | ||
| 5032 | |||
| 5033 | public function dumpSubscripts | ||
| 5034 | input Tpl.Text in_txt; | ||
| 5035 | input list<Absyn.Subscript> in_a_subscripts; | ||
| 5036 | input MMToJuliaUtil.Context in_a_context; | ||
| 5037 | |||
| 5038 | output Tpl.Text out_txt; | ||
| 5039 | algorithm | ||
| 5040 | out_txt := | ||
| 5041 | match(in_txt, in_a_subscripts, in_a_context) | ||
| 5042 | local | ||
| 5043 | Tpl.Text txt; | ||
| 5044 | MMToJuliaUtil.Context a_context; | ||
| 5045 | list<Absyn.Subscript> i_subscripts; | ||
| 5046 | Tpl.Text l_sub__str; | ||
| 5047 | |||
| 5048 | case ( txt, | ||
| 5049 | {}, | ||
| 5050 | _ ) | ||
| 5051 | then txt; | ||
| 5052 | |||
| 5053 | case ( txt, | ||
| 5054 | i_subscripts, | ||
| 5055 | a_context ) | ||
| 5056 | algorithm | ||
| 5057 | ✗ | l_sub__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())); | |
| 5058 | ✗ | l_sub__str := lm_170(l_sub__str, i_subscripts, a_context); | |
| 5059 | ✗ | l_sub__str := Tpl.popIter(l_sub__str); | |
| 5060 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("[")); | |
| 5061 | ✗ | txt := Tpl.writeText(txt, l_sub__str); | |
| 5062 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("]")); | |
| 5063 | then txt; | ||
| 5064 | end match; | ||
| 5065 | end dumpSubscripts; | ||
| 5066 | |||
| 5067 | public function dumpSubscript | ||
| 5068 | input Tpl.Text in_txt; | ||
| 5069 | input Absyn.Subscript in_a_subscript; | ||
| 5070 | input MMToJuliaUtil.Context in_a_context; | ||
| 5071 | |||
| 5072 | output Tpl.Text out_txt; | ||
| 5073 | algorithm | ||
| 5074 | out_txt := | ||
| 5075 | match(in_txt, in_a_subscript, in_a_context) | ||
| 5076 | local | ||
| 5077 | Tpl.Text txt; | ||
| 5078 | MMToJuliaUtil.Context a_context; | ||
| 5079 | Absyn.Exp i_subscript; | ||
| 5080 | |||
| 5081 | case ( txt, | ||
| 5082 | Absyn.NOSUB(), | ||
| 5083 | _ ) | ||
| 5084 | algorithm | ||
| 5085 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(":")); | |
| 5086 | then txt; | ||
| 5087 | |||
| 5088 | case ( txt, | ||
| 5089 | Absyn.SUBSCRIPT(subscript = i_subscript), | ||
| 5090 | a_context ) | ||
| 5091 | algorithm | ||
| 5092 | ✗ | txt := dumpExp(txt, i_subscript, a_context); | |
| 5093 | then txt; | ||
| 5094 | |||
| 5095 | case ( txt, | ||
| 5096 | _, | ||
| 5097 | _ ) | ||
| 5098 | then txt; | ||
| 5099 | end match; | ||
| 5100 | end dumpSubscript; | ||
| 5101 | |||
| 5102 | protected function lm_173 | ||
| 5103 | input output Tpl.Text txt; | ||
| 5104 | input list<Absyn.NamedArg> items; | ||
| 5105 | algorithm | ||
| 5106 | ✗ | for lstElt_173 in items loop | |
| 5107 | txt := match lstElt_173 | ||
| 5108 | local | ||
| 5109 | Absyn.NamedArg i_na; | ||
| 5110 | |||
| 5111 | case i_na | ||
| 5112 | algorithm | ||
| 5113 | ✗ | txt := dumpNamedArgPattern3(txt, i_na); | |
| 5114 | ✗ | txt := Tpl.nextIter(txt); | |
| 5115 | then txt; | ||
| 5116 | end match; | ||
| 5117 | end for; | ||
| 5118 | end lm_173; | ||
| 5119 | |||
| 5120 | protected function fun_174 | ||
| 5121 | input Tpl.Text in_txt; | ||
| 5122 | input Absyn.FunctionArgs in_a_functionArgs; | ||
| 5123 | |||
| 5124 | output Tpl.Text out_txt; | ||
| 5125 | algorithm | ||
| 5126 | out_txt := | ||
| 5127 | match(in_txt, in_a_functionArgs) | ||
| 5128 | local | ||
| 5129 | Tpl.Text txt; | ||
| 5130 | list<Absyn.NamedArg> i_argNames; | ||
| 5131 | |||
| 5132 | case ( txt, | ||
| 5133 | Absyn.FUNCTIONARGS(argNames = i_argNames) ) | ||
| 5134 | algorithm | ||
| 5135 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 5136 | ✗ | txt := lm_173(txt, i_argNames); | |
| 5137 | ✗ | txt := Tpl.popIter(txt); | |
| 5138 | then txt; | ||
| 5139 | |||
| 5140 | case ( txt, | ||
| 5141 | _ ) | ||
| 5142 | then txt; | ||
| 5143 | end match; | ||
| 5144 | end fun_174; | ||
| 5145 | |||
| 5146 | protected function lm_175 | ||
| 5147 | input output Tpl.Text txt; | ||
| 5148 | input list<Absyn.Exp> items; | ||
| 5149 | input MMToJuliaUtil.Context a_context; | ||
| 5150 | algorithm | ||
| 5151 | ✗ | for lstElt_175 in items loop | |
| 5152 | txt := match lstElt_175 | ||
| 5153 | local | ||
| 5154 | Absyn.Exp i_e; | ||
| 5155 | |||
| 5156 | case i_e | ||
| 5157 | algorithm | ||
| 5158 | ✗ | txt := dumpExp(txt, i_e, a_context); | |
| 5159 | ✗ | txt := Tpl.nextIter(txt); | |
| 5160 | then txt; | ||
| 5161 | end match; | ||
| 5162 | end for; | ||
| 5163 | end lm_175; | ||
| 5164 | |||
| 5165 | protected function fun_176 | ||
| 5166 | input Tpl.Text in_txt; | ||
| 5167 | input Boolean in_mArg; | ||
| 5168 | input Tpl.Text in_a_array__str; | ||
| 5169 | |||
| 5170 | output Tpl.Text out_txt; | ||
| 5171 | algorithm | ||
| 5172 | out_txt := | ||
| 5173 | match(in_txt, in_mArg, in_a_array__str) | ||
| 5174 | local | ||
| 5175 | Tpl.Text txt; | ||
| 5176 | Tpl.Text a_array__str; | ||
| 5177 | |||
| 5178 | case ( txt, | ||
| 5179 | true, | ||
| 5180 | _ ) | ||
| 5181 | algorithm | ||
| 5182 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("nil")); | |
| 5183 | then txt; | ||
| 5184 | |||
| 5185 | case ( txt, | ||
| 5186 | _, | ||
| 5187 | a_array__str ) | ||
| 5188 | algorithm | ||
| 5189 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("list(")); | |
| 5190 | ✗ | txt := Tpl.writeText(txt, a_array__str); | |
| 5191 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5192 | then txt; | ||
| 5193 | end match; | ||
| 5194 | end fun_176; | ||
| 5195 | |||
| 5196 | protected function lm_177 | ||
| 5197 | input output Tpl.Text txt; | ||
| 5198 | input list<Absyn.Exp> items; | ||
| 5199 | input MMToJuliaUtil.Context a_context; | ||
| 5200 | algorithm | ||
| 5201 | ✗ | for lstElt_177 in items loop | |
| 5202 | txt := match lstElt_177 | ||
| 5203 | local | ||
| 5204 | Absyn.Exp i_e; | ||
| 5205 | |||
| 5206 | case i_e | ||
| 5207 | algorithm | ||
| 5208 | ✗ | txt := dumpExp(txt, i_e, a_context); | |
| 5209 | ✗ | txt := Tpl.nextIter(txt); | |
| 5210 | then txt; | ||
| 5211 | end match; | ||
| 5212 | end for; | ||
| 5213 | end lm_177; | ||
| 5214 | |||
| 5215 | protected function lm_178 | ||
| 5216 | input output Tpl.Text txt; | ||
| 5217 | input list<list<Absyn.Exp>> items; | ||
| 5218 | input MMToJuliaUtil.Context a_context; | ||
| 5219 | algorithm | ||
| 5220 | ✗ | for lstElt_178 in items loop | |
| 5221 | txt := match lstElt_178 | ||
| 5222 | local | ||
| 5223 | list<Absyn.Exp> i_row; | ||
| 5224 | |||
| 5225 | case i_row | ||
| 5226 | algorithm | ||
| 5227 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 5228 | ✗ | txt := lm_177(txt, i_row, a_context); | |
| 5229 | ✗ | txt := Tpl.popIter(txt); | |
| 5230 | ✗ | txt := Tpl.nextIter(txt); | |
| 5231 | then txt; | ||
| 5232 | end match; | ||
| 5233 | end for; | ||
| 5234 | end lm_178; | ||
| 5235 | |||
| 5236 | protected function lm_179 | ||
| 5237 | input output Tpl.Text txt; | ||
| 5238 | input list<Absyn.Exp> items; | ||
| 5239 | input MMToJuliaUtil.Context a_context; | ||
| 5240 | algorithm | ||
| 5241 | ✗ | for lstElt_179 in items loop | |
| 5242 | txt := match lstElt_179 | ||
| 5243 | local | ||
| 5244 | Absyn.Exp i_e; | ||
| 5245 | |||
| 5246 | case i_e | ||
| 5247 | algorithm | ||
| 5248 | ✗ | txt := dumpExp(txt, i_e, a_context); | |
| 5249 | ✗ | txt := Tpl.nextIter(txt); | |
| 5250 | then txt; | ||
| 5251 | end match; | ||
| 5252 | end for; | ||
| 5253 | end lm_179; | ||
| 5254 | |||
| 5255 | protected function fun_180 | ||
| 5256 | input Tpl.Text in_txt; | ||
| 5257 | input Boolean in_mArg; | ||
| 5258 | input Tpl.Text in_a_tuple__str; | ||
| 5259 | |||
| 5260 | output Tpl.Text out_txt; | ||
| 5261 | algorithm | ||
| 5262 | out_txt := | ||
| 5263 | match(in_txt, in_mArg, in_a_tuple__str) | ||
| 5264 | local | ||
| 5265 | Tpl.Text txt; | ||
| 5266 | Tpl.Text a_tuple__str; | ||
| 5267 | |||
| 5268 | case ( txt, | ||
| 5269 | true, | ||
| 5270 | _ ) | ||
| 5271 | algorithm | ||
| 5272 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("()")); | |
| 5273 | then txt; | ||
| 5274 | |||
| 5275 | case ( txt, | ||
| 5276 | _, | ||
| 5277 | a_tuple__str ) | ||
| 5278 | algorithm | ||
| 5279 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 5280 | ✗ | txt := Tpl.writeText(txt, a_tuple__str); | |
| 5281 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5282 | then txt; | ||
| 5283 | end match; | ||
| 5284 | end fun_180; | ||
| 5285 | |||
| 5286 | protected function lm_181 | ||
| 5287 | input output Tpl.Text txt; | ||
| 5288 | input list<Absyn.Exp> items; | ||
| 5289 | input MMToJuliaUtil.Context a_context; | ||
| 5290 | algorithm | ||
| 5291 | ✗ | for lstElt_181 in items loop | |
| 5292 | txt := match lstElt_181 | ||
| 5293 | local | ||
| 5294 | Absyn.Exp i_e; | ||
| 5295 | |||
| 5296 | case i_e | ||
| 5297 | algorithm | ||
| 5298 | ✗ | txt := dumpExp(txt, i_e, a_context); | |
| 5299 | ✗ | txt := Tpl.nextIter(txt); | |
| 5300 | then txt; | ||
| 5301 | end match; | ||
| 5302 | end for; | ||
| 5303 | end lm_181; | ||
| 5304 | |||
| 5305 | public function dumpExp | ||
| 5306 | input Tpl.Text in_txt; | ||
| 5307 | input Absyn.Exp in_a_exp; | ||
| 5308 | input MMToJuliaUtil.Context in_a_context; | ||
| 5309 | |||
| 5310 | output Tpl.Text out_txt; | ||
| 5311 | algorithm | ||
| 5312 | out_txt := | ||
| 5313 | match(in_txt, in_a_exp, in_a_context) | ||
| 5314 | local | ||
| 5315 | Tpl.Text txt; | ||
| 5316 | MMToJuliaUtil.Context a_context; | ||
| 5317 | Absyn.Exp i_index; | ||
| 5318 | list<Absyn.Exp> i_exps; | ||
| 5319 | Absyn.Exp i_rest; | ||
| 5320 | Absyn.Exp i_head; | ||
| 5321 | Absyn.Ident i_id; | ||
| 5322 | Absyn.CodeNode i_code; | ||
| 5323 | list<Absyn.Exp> i_expressions; | ||
| 5324 | Absyn.Exp i_stop; | ||
| 5325 | Absyn.Exp i_step; | ||
| 5326 | Absyn.Exp i_start; | ||
| 5327 | list<list<Absyn.Exp>> i_matrix; | ||
| 5328 | list<Absyn.Exp> i_arrayExp; | ||
| 5329 | Absyn.ComponentRef i_function__; | ||
| 5330 | Absyn.FunctionArgs i_functionArgs; | ||
| 5331 | Absyn.Exp i_exp; | ||
| 5332 | Absyn.Operator i_op; | ||
| 5333 | Absyn.Exp i_exp2; | ||
| 5334 | Absyn.Exp i_e; | ||
| 5335 | Absyn.Exp i_exp1; | ||
| 5336 | Boolean i_value_2; | ||
| 5337 | Absyn.ComponentRef i_componentRef; | ||
| 5338 | String i_value_1; | ||
| 5339 | Integer i_value; | ||
| 5340 | Tpl.Text l_list__str; | ||
| 5341 | Tpl.Text l_rest__str; | ||
| 5342 | Tpl.Text l_head__str; | ||
| 5343 | Boolean ret_15; | ||
| 5344 | Tpl.Text l_tuple__str; | ||
| 5345 | Tpl.Text l_stop__str; | ||
| 5346 | Tpl.Text l_step__str; | ||
| 5347 | Tpl.Text l_start__str; | ||
| 5348 | Tpl.Text l_matrix__str; | ||
| 5349 | Boolean ret_9; | ||
| 5350 | Tpl.Text l_array__str; | ||
| 5351 | Tpl.Text l_args2__str; | ||
| 5352 | Tpl.Text l_func__str; | ||
| 5353 | Tpl.Text l_args__str; | ||
| 5354 | Tpl.Text l_exp__str; | ||
| 5355 | Tpl.Text l_op__str; | ||
| 5356 | Tpl.Text l_rhs__str; | ||
| 5357 | Tpl.Text l_lhs__str; | ||
| 5358 | String ret_0; | ||
| 5359 | |||
| 5360 | case ( txt, | ||
| 5361 | Absyn.INTEGER(value = i_value), | ||
| 5362 | _ ) | ||
| 5363 | algorithm | ||
| 5364 | ✗ | txt := Tpl.writeStr(txt, intString(i_value)); | |
| 5365 | then txt; | ||
| 5366 | |||
| 5367 | case ( txt, | ||
| 5368 | Absyn.REAL(value = i_value_1), | ||
| 5369 | _ ) | ||
| 5370 | algorithm | ||
| 5371 | ✗ | txt := Tpl.writeStr(txt, i_value_1); | |
| 5372 | then txt; | ||
| 5373 | |||
| 5374 | case ( txt, | ||
| 5375 | Absyn.CREF(componentRef = i_componentRef), | ||
| 5376 | a_context ) | ||
| 5377 | algorithm | ||
| 5378 | ✗ | txt := dumpCref(txt, i_componentRef, a_context); | |
| 5379 | then txt; | ||
| 5380 | |||
| 5381 | case ( txt, | ||
| 5382 | Absyn.STRING(value = i_value_1), | ||
| 5383 | _ ) | ||
| 5384 | algorithm | ||
| 5385 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 5386 | ✗ | ret_0 := Util.escapeModelicaStringToJLString(i_value_1); | |
| 5387 | ✗ | txt := Tpl.writeStr(txt, ret_0); | |
| 5388 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 5389 | then txt; | ||
| 5390 | |||
| 5391 | case ( txt, | ||
| 5392 | Absyn.BOOL(value = i_value_2), | ||
| 5393 | _ ) | ||
| 5394 | algorithm | ||
| 5395 | ✗ | txt := Tpl.writeStr(txt, Tpl.booleanString(i_value_2)); | |
| 5396 | then txt; | ||
| 5397 | |||
| 5398 | case ( txt, | ||
| 5399 | (i_e as Absyn.BINARY(exp1 = i_exp1, exp2 = i_exp2, op = i_op)), | ||
| 5400 | a_context ) | ||
| 5401 | algorithm | ||
| 5402 | ✗ | l_lhs__str := dumpOperand(Tpl.emptyTxt, i_exp1, i_e, true, a_context); | |
| 5403 | ✗ | l_rhs__str := dumpOperand(Tpl.emptyTxt, i_exp2, i_e, false, a_context); | |
| 5404 | ✗ | l_op__str := dumpOperator(Tpl.emptyTxt, i_op); | |
| 5405 | ✗ | txt := Tpl.writeText(txt, l_lhs__str); | |
| 5406 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 5407 | ✗ | txt := Tpl.writeText(txt, l_op__str); | |
| 5408 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 5409 | ✗ | txt := Tpl.writeText(txt, l_rhs__str); | |
| 5410 | then txt; | ||
| 5411 | |||
| 5412 | case ( txt, | ||
| 5413 | (i_e as Absyn.UNARY(exp = i_exp, op = i_op)), | ||
| 5414 | a_context ) | ||
| 5415 | algorithm | ||
| 5416 | ✗ | l_exp__str := dumpOperand(Tpl.emptyTxt, i_exp, i_e, false, a_context); | |
| 5417 | ✗ | l_op__str := dumpOperator(Tpl.emptyTxt, i_op); | |
| 5418 | ✗ | txt := Tpl.writeText(txt, l_op__str); | |
| 5419 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 5420 | then txt; | ||
| 5421 | |||
| 5422 | case ( txt, | ||
| 5423 | (i_e as Absyn.LBINARY(exp1 = i_exp1, exp2 = i_exp2, op = i_op)), | ||
| 5424 | a_context ) | ||
| 5425 | algorithm | ||
| 5426 | ✗ | l_lhs__str := dumpOperand(Tpl.emptyTxt, i_exp1, i_e, true, a_context); | |
| 5427 | ✗ | l_rhs__str := dumpOperand(Tpl.emptyTxt, i_exp2, i_e, false, a_context); | |
| 5428 | ✗ | l_op__str := dumpOperator(Tpl.emptyTxt, i_op); | |
| 5429 | ✗ | txt := Tpl.writeText(txt, l_lhs__str); | |
| 5430 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 5431 | ✗ | txt := Tpl.writeText(txt, l_op__str); | |
| 5432 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 5433 | ✗ | txt := Tpl.writeText(txt, l_rhs__str); | |
| 5434 | then txt; | ||
| 5435 | |||
| 5436 | case ( txt, | ||
| 5437 | (i_e as Absyn.LUNARY(exp = i_exp, op = i_op)), | ||
| 5438 | a_context ) | ||
| 5439 | algorithm | ||
| 5440 | ✗ | l_exp__str := dumpOperand(Tpl.emptyTxt, i_exp, i_e, false, a_context); | |
| 5441 | ✗ | l_op__str := dumpOperator(Tpl.emptyTxt, i_op); | |
| 5442 | ✗ | txt := Tpl.writeText(txt, l_op__str); | |
| 5443 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 5444 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 5445 | then txt; | ||
| 5446 | |||
| 5447 | case ( txt, | ||
| 5448 | (i_e as Absyn.RELATION(exp1 = i_exp1, exp2 = i_exp2, op = i_op)), | ||
| 5449 | a_context ) | ||
| 5450 | algorithm | ||
| 5451 | ✗ | l_lhs__str := dumpOperand(Tpl.emptyTxt, i_exp1, i_e, true, a_context); | |
| 5452 | ✗ | l_rhs__str := dumpOperand(Tpl.emptyTxt, i_exp2, i_e, false, a_context); | |
| 5453 | ✗ | l_op__str := dumpOperator(Tpl.emptyTxt, i_op); | |
| 5454 | ✗ | txt := Tpl.writeText(txt, l_lhs__str); | |
| 5455 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 5456 | ✗ | txt := Tpl.writeText(txt, l_op__str); | |
| 5457 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 5458 | ✗ | txt := Tpl.writeText(txt, l_rhs__str); | |
| 5459 | then txt; | ||
| 5460 | |||
| 5461 | case ( txt, | ||
| 5462 | (i_exp as Absyn.IFEXP(ifExp = _)), | ||
| 5463 | a_context ) | ||
| 5464 | algorithm | ||
| 5465 | ✗ | txt := dumpIfExp(txt, i_exp, a_context); | |
| 5466 | then txt; | ||
| 5467 | |||
| 5468 | case ( txt, | ||
| 5469 | Absyn.CALL(function_ = Absyn.CREF_IDENT(name = "$array"), functionArgs = i_functionArgs), | ||
| 5470 | a_context ) | ||
| 5471 | algorithm | ||
| 5472 | ✗ | l_args__str := dumpFunctionArgs(Tpl.emptyTxt, i_functionArgs, a_context); | |
| 5473 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("{")); | |
| 5474 | ✗ | txt := Tpl.writeText(txt, l_args__str); | |
| 5475 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("}")); | |
| 5476 | then txt; | ||
| 5477 | |||
| 5478 | case ( txt, | ||
| 5479 | Absyn.CALL(function_ = i_function__, functionArgs = i_functionArgs), | ||
| 5480 | a_context ) | ||
| 5481 | algorithm | ||
| 5482 | ✗ | l_func__str := dumpCref(Tpl.emptyTxt, i_function__, a_context); | |
| 5483 | ✗ | l_args__str := dumpFunctionArgs(Tpl.emptyTxt, i_functionArgs, a_context); | |
| 5484 | ✗ | txt := Tpl.writeText(txt, l_func__str); | |
| 5485 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 5486 | ✗ | txt := Tpl.writeText(txt, l_args__str); | |
| 5487 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5488 | then txt; | ||
| 5489 | |||
| 5490 | case ( txt, | ||
| 5491 | Absyn.PARTEVALFUNCTION(function_ = i_function__, functionArgs = i_functionArgs), | ||
| 5492 | a_context ) | ||
| 5493 | algorithm | ||
| 5494 | ✗ | l_func__str := dumpCref(Tpl.emptyTxt, i_function__, a_context); | |
| 5495 | ✗ | l_args__str := dumpFunctionArgs(Tpl.emptyTxt, i_functionArgs, a_context); | |
| 5496 | ✗ | l_args2__str := fun_174(Tpl.emptyTxt, i_functionArgs); | |
| 5497 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 5498 | ✗ | txt := Tpl.writeText(txt, l_args2__str); | |
| 5499 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(") -> ")); | |
| 5500 | ✗ | txt := Tpl.writeText(txt, l_func__str); | |
| 5501 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 5502 | ✗ | txt := Tpl.writeText(txt, l_args__str); | |
| 5503 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5504 | then txt; | ||
| 5505 | |||
| 5506 | case ( txt, | ||
| 5507 | Absyn.ARRAY(arrayExp = i_arrayExp), | ||
| 5508 | a_context ) | ||
| 5509 | algorithm | ||
| 5510 | ✗ | l_array__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())); | |
| 5511 | ✗ | l_array__str := lm_175(l_array__str, i_arrayExp, a_context); | |
| 5512 | ✗ | l_array__str := Tpl.popIter(l_array__str); | |
| 5513 | ✗ | ret_9 := Tpl.isEmpty(l_array__str); | |
| 5514 | ✗ | txt := fun_176(txt, ret_9, l_array__str); | |
| 5515 | then txt; | ||
| 5516 | |||
| 5517 | case ( txt, | ||
| 5518 | Absyn.MATRIX(matrix = i_matrix), | ||
| 5519 | a_context ) | ||
| 5520 | algorithm | ||
| 5521 | ✗ | l_matrix__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())); | |
| 5522 | ✗ | l_matrix__str := lm_178(l_matrix__str, i_matrix, a_context); | |
| 5523 | ✗ | l_matrix__str := Tpl.popIter(l_matrix__str); | |
| 5524 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("[")); | |
| 5525 | ✗ | txt := Tpl.writeText(txt, l_matrix__str); | |
| 5526 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("]")); | |
| 5527 | then txt; | ||
| 5528 | |||
| 5529 | case ( txt, | ||
| 5530 | (i_e as Absyn.RANGE(step = SOME(i_step), start = i_start, stop = i_stop)), | ||
| 5531 | a_context ) | ||
| 5532 | algorithm | ||
| 5533 | ✗ | l_start__str := dumpOperand(Tpl.emptyTxt, i_start, i_e, false, a_context); | |
| 5534 | ✗ | l_step__str := dumpOperand(Tpl.emptyTxt, i_step, i_e, false, a_context); | |
| 5535 | ✗ | l_stop__str := dumpOperand(Tpl.emptyTxt, i_stop, i_e, false, a_context); | |
| 5536 | ✗ | txt := Tpl.writeText(txt, l_start__str); | |
| 5537 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(":")); | |
| 5538 | ✗ | txt := Tpl.writeText(txt, l_step__str); | |
| 5539 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(":")); | |
| 5540 | ✗ | txt := Tpl.writeText(txt, l_stop__str); | |
| 5541 | then txt; | ||
| 5542 | |||
| 5543 | case ( txt, | ||
| 5544 | (i_e as Absyn.RANGE(step = NONE(), start = i_start, stop = i_stop)), | ||
| 5545 | a_context ) | ||
| 5546 | algorithm | ||
| 5547 | ✗ | l_start__str := dumpOperand(Tpl.emptyTxt, i_start, i_e, false, a_context); | |
| 5548 | ✗ | l_stop__str := dumpOperand(Tpl.emptyTxt, i_stop, i_e, false, a_context); | |
| 5549 | ✗ | txt := Tpl.writeText(txt, l_start__str); | |
| 5550 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(":")); | |
| 5551 | ✗ | txt := Tpl.writeText(txt, l_stop__str); | |
| 5552 | then txt; | ||
| 5553 | |||
| 5554 | case ( txt, | ||
| 5555 | Absyn.TUPLE(expressions = i_expressions), | ||
| 5556 | a_context ) | ||
| 5557 | algorithm | ||
| 5558 | ✗ | l_tuple__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 5559 | ✗ | l_tuple__str := lm_179(l_tuple__str, i_expressions, a_context); | |
| 5560 | ✗ | l_tuple__str := Tpl.popIter(l_tuple__str); | |
| 5561 | ✗ | ret_15 := Tpl.isEmpty(l_tuple__str); | |
| 5562 | ✗ | txt := fun_180(txt, ret_15, l_tuple__str); | |
| 5563 | then txt; | ||
| 5564 | |||
| 5565 | case ( txt, | ||
| 5566 | Absyn.END(), | ||
| 5567 | _ ) | ||
| 5568 | algorithm | ||
| 5569 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 5570 | then txt; | ||
| 5571 | |||
| 5572 | case ( txt, | ||
| 5573 | Absyn.CODE(code = i_code), | ||
| 5574 | a_context ) | ||
| 5575 | algorithm | ||
| 5576 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("$Code(")); | |
| 5577 | ✗ | txt := dumpCodeNode(txt, i_code, a_context); | |
| 5578 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5579 | then txt; | ||
| 5580 | |||
| 5581 | case ( txt, | ||
| 5582 | Absyn.AS(exp = i_exp, id = i_id), | ||
| 5583 | a_context ) | ||
| 5584 | algorithm | ||
| 5585 | ✗ | l_exp__str := dumpExp(Tpl.emptyTxt, i_exp, a_context); | |
| 5586 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(@match ")); | |
| 5587 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 5588 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 5589 | ✗ | txt := Tpl.writeStr(txt, i_id); | |
| 5590 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5591 | then txt; | ||
| 5592 | |||
| 5593 | case ( txt, | ||
| 5594 | Absyn.CONS(head = i_head, rest = i_rest), | ||
| 5595 | a_context ) | ||
| 5596 | algorithm | ||
| 5597 | ✗ | l_head__str := dumpExp(Tpl.emptyTxt, i_head, a_context); | |
| 5598 | ✗ | l_rest__str := dumpExp(Tpl.emptyTxt, i_rest, a_context); | |
| 5599 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("_cons(")); | |
| 5600 | ✗ | txt := Tpl.writeText(txt, l_head__str); | |
| 5601 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 5602 | ✗ | txt := Tpl.writeText(txt, l_rest__str); | |
| 5603 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5604 | then txt; | ||
| 5605 | |||
| 5606 | case ( txt, | ||
| 5607 | (i_exp as Absyn.MATCHEXP(matchTy = _)), | ||
| 5608 | _ ) | ||
| 5609 | algorithm | ||
| 5610 | ✗ | txt := dumpMatchExp(txt, i_exp); | |
| 5611 | then txt; | ||
| 5612 | |||
| 5613 | case ( txt, | ||
| 5614 | Absyn.LIST(exps = i_exps), | ||
| 5615 | a_context ) | ||
| 5616 | algorithm | ||
| 5617 | ✗ | l_list__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())); | |
| 5618 | ✗ | l_list__str := lm_181(l_list__str, i_exps, a_context); | |
| 5619 | ✗ | l_list__str := Tpl.popIter(l_list__str); | |
| 5620 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("list(")); | |
| 5621 | ✗ | txt := Tpl.writeText(txt, l_list__str); | |
| 5622 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5623 | then txt; | ||
| 5624 | |||
| 5625 | case ( txt, | ||
| 5626 | Absyn.DOT(exp = i_exp, index = i_index), | ||
| 5627 | a_context ) | ||
| 5628 | algorithm | ||
| 5629 | ✗ | txt := dumpExp(txt, i_exp, a_context); | |
| 5630 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 5631 | ✗ | txt := dumpExp(txt, i_index, a_context); | |
| 5632 | then txt; | ||
| 5633 | |||
| 5634 | case ( txt, | ||
| 5635 | _, | ||
| 5636 | _ ) | ||
| 5637 | algorithm | ||
| 5638 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("/* AbsynDumpTpl.dumpExp: UNHANDLED Abyn.Exp */")); | |
| 5639 | then txt; | ||
| 5640 | end match; | ||
| 5641 | end dumpExp; | ||
| 5642 | |||
| 5643 | protected function lm_183 | ||
| 5644 | input output Tpl.Text txt; | ||
| 5645 | input list<Absyn.Exp> items; | ||
| 5646 | input output Tpl.Text a_as__str; | ||
| 5647 | input MMToJuliaUtil.Context a_context; | ||
| 5648 | algorithm | ||
| 5649 | ✗ | for lstElt_183 in items loop | |
| 5650 | (txt, a_as__str) := match lstElt_183 | ||
| 5651 | local | ||
| 5652 | Absyn.Exp i_e; | ||
| 5653 | |||
| 5654 | case i_e | ||
| 5655 | algorithm | ||
| 5656 | ✗ | (txt, a_as__str) := dumpPattern(txt, i_e, a_context, a_as__str); | |
| 5657 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" <| ")); | |
| 5658 | then (txt, a_as__str); | ||
| 5659 | end match; | ||
| 5660 | end for; | ||
| 5661 | end lm_183; | ||
| 5662 | |||
| 5663 | protected function lm_184 | ||
| 5664 | input output Tpl.Text txt; | ||
| 5665 | input list<Absyn.Exp> items; | ||
| 5666 | input output Tpl.Text a_as__str; | ||
| 5667 | input MMToJuliaUtil.Context a_context; | ||
| 5668 | algorithm | ||
| 5669 | ✗ | for lstElt_184 in items loop | |
| 5670 | (txt, a_as__str) := match lstElt_184 | ||
| 5671 | local | ||
| 5672 | Absyn.Exp i_e; | ||
| 5673 | |||
| 5674 | case i_e | ||
| 5675 | algorithm | ||
| 5676 | ✗ | (txt, a_as__str) := dumpPattern(txt, i_e, a_context, a_as__str); | |
| 5677 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" <| ")); | |
| 5678 | then (txt, a_as__str); | ||
| 5679 | end match; | ||
| 5680 | end for; | ||
| 5681 | end lm_184; | ||
| 5682 | |||
| 5683 | protected function lm_185 | ||
| 5684 | input output Tpl.Text txt; | ||
| 5685 | input list<Absyn.Exp> items; | ||
| 5686 | input output Tpl.Text a_as__str; | ||
| 5687 | input MMToJuliaUtil.Context a_context; | ||
| 5688 | algorithm | ||
| 5689 | ✗ | for lstElt_185 in items loop | |
| 5690 | (txt, a_as__str) := match lstElt_185 | ||
| 5691 | local | ||
| 5692 | Absyn.Exp i_e; | ||
| 5693 | |||
| 5694 | case i_e | ||
| 5695 | algorithm | ||
| 5696 | ✗ | (txt, a_as__str) := dumpPattern(txt, i_e, a_context, a_as__str); | |
| 5697 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" <| ")); | |
| 5698 | then (txt, a_as__str); | ||
| 5699 | end match; | ||
| 5700 | end for; | ||
| 5701 | end lm_185; | ||
| 5702 | |||
| 5703 | protected function lm_186 | ||
| 5704 | input output Tpl.Text txt; | ||
| 5705 | input list<Absyn.Exp> items; | ||
| 5706 | input output Tpl.Text a_as__str; | ||
| 5707 | input MMToJuliaUtil.Context a_context; | ||
| 5708 | algorithm | ||
| 5709 | ✗ | for lstElt_186 in items loop | |
| 5710 | (txt, a_as__str) := match lstElt_186 | ||
| 5711 | local | ||
| 5712 | Absyn.Exp i_e; | ||
| 5713 | |||
| 5714 | case i_e | ||
| 5715 | algorithm | ||
| 5716 | ✗ | (txt, a_as__str) := dumpPattern(txt, i_e, a_context, a_as__str); | |
| 5717 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" <| ")); | |
| 5718 | then (txt, a_as__str); | ||
| 5719 | end match; | ||
| 5720 | end for; | ||
| 5721 | end lm_186; | ||
| 5722 | |||
| 5723 | protected function fun_187 | ||
| 5724 | input Tpl.Text in_txt; | ||
| 5725 | input Absyn.Ident in_a_id; | ||
| 5726 | input Absyn.ComponentRef in_a_function__; | ||
| 5727 | |||
| 5728 | output Tpl.Text out_txt; | ||
| 5729 | algorithm | ||
| 5730 | out_txt := | ||
| 5731 | match(in_txt, in_a_id, in_a_function__) | ||
| 5732 | local | ||
| 5733 | Tpl.Text txt; | ||
| 5734 | Absyn.ComponentRef a_function__; | ||
| 5735 | |||
| 5736 | case ( txt, | ||
| 5737 | "list", | ||
| 5738 | _ ) | ||
| 5739 | algorithm | ||
| 5740 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("List")); | |
| 5741 | then txt; | ||
| 5742 | |||
| 5743 | case ( txt, | ||
| 5744 | _, | ||
| 5745 | a_function__ ) | ||
| 5746 | algorithm | ||
| 5747 | ✗ | txt := dumpCref(txt, a_function__, MMToJuliaUtil.functionContext); | |
| 5748 | then txt; | ||
| 5749 | end match; | ||
| 5750 | end fun_187; | ||
| 5751 | |||
| 5752 | protected function fun_188 | ||
| 5753 | input Tpl.Text in_txt; | ||
| 5754 | input String in_mArg; | ||
| 5755 | |||
| 5756 | output Tpl.Text out_txt; | ||
| 5757 | algorithm | ||
| 5758 | out_txt := | ||
| 5759 | match(in_txt, in_mArg) | ||
| 5760 | local | ||
| 5761 | Tpl.Text txt; | ||
| 5762 | |||
| 5763 | case ( txt, | ||
| 5764 | "NONE" ) | ||
| 5765 | algorithm | ||
| 5766 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("NONE")); | |
| 5767 | then txt; | ||
| 5768 | |||
| 5769 | case ( txt, | ||
| 5770 | _ ) | ||
| 5771 | then txt; | ||
| 5772 | end match; | ||
| 5773 | end fun_188; | ||
| 5774 | |||
| 5775 | protected function fun_189 | ||
| 5776 | input Tpl.Text in_txt; | ||
| 5777 | input Boolean in_mArg; | ||
| 5778 | input Tpl.Text in_a_func__str; | ||
| 5779 | |||
| 5780 | output Tpl.Text out_txt; | ||
| 5781 | algorithm | ||
| 5782 | out_txt := | ||
| 5783 | match(in_txt, in_mArg, in_a_func__str) | ||
| 5784 | local | ||
| 5785 | Tpl.Text txt; | ||
| 5786 | Tpl.Text a_func__str; | ||
| 5787 | |||
| 5788 | case ( txt, | ||
| 5789 | true, | ||
| 5790 | a_func__str ) | ||
| 5791 | algorithm | ||
| 5792 | ✗ | txt := Tpl.writeText(txt, a_func__str); | |
| 5793 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(__)")); | |
| 5794 | then txt; | ||
| 5795 | |||
| 5796 | case ( txt, | ||
| 5797 | _, | ||
| 5798 | a_func__str ) | ||
| 5799 | algorithm | ||
| 5800 | ✗ | txt := Tpl.writeText(txt, a_func__str); | |
| 5801 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("()")); | |
| 5802 | then txt; | ||
| 5803 | end match; | ||
| 5804 | end fun_189; | ||
| 5805 | |||
| 5806 | protected function fun_190 | ||
| 5807 | input Tpl.Text in_txt; | ||
| 5808 | input Boolean in_mArg; | ||
| 5809 | input Tpl.Text in_a_args__str; | ||
| 5810 | input Tpl.Text in_a_func__str; | ||
| 5811 | |||
| 5812 | output Tpl.Text out_txt; | ||
| 5813 | algorithm | ||
| 5814 | out_txt := | ||
| 5815 | match(in_txt, in_mArg, in_a_args__str, in_a_func__str) | ||
| 5816 | local | ||
| 5817 | Tpl.Text txt; | ||
| 5818 | Tpl.Text a_args__str; | ||
| 5819 | Tpl.Text a_func__str; | ||
| 5820 | Boolean ret_2; | ||
| 5821 | String str_1; | ||
| 5822 | Tpl.Text l_isNone; | ||
| 5823 | |||
| 5824 | case ( txt, | ||
| 5825 | true, | ||
| 5826 | _, | ||
| 5827 | a_func__str ) | ||
| 5828 | algorithm | ||
| 5829 | ✗ | str_1 := Tpl.textString(a_func__str); | |
| 5830 | ✗ | l_isNone := fun_188(Tpl.emptyTxt, str_1); | |
| 5831 | ✗ | ret_2 := Tpl.isEmpty(l_isNone); | |
| 5832 | ✗ | txt := fun_189(txt, ret_2, a_func__str); | |
| 5833 | then txt; | ||
| 5834 | |||
| 5835 | case ( txt, | ||
| 5836 | _, | ||
| 5837 | a_args__str, | ||
| 5838 | a_func__str ) | ||
| 5839 | algorithm | ||
| 5840 | ✗ | txt := Tpl.writeText(txt, a_func__str); | |
| 5841 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 5842 | ✗ | txt := Tpl.writeText(txt, a_args__str); | |
| 5843 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5844 | then txt; | ||
| 5845 | end match; | ||
| 5846 | end fun_190; | ||
| 5847 | |||
| 5848 | protected function fun_191 | ||
| 5849 | input Tpl.Text in_txt; | ||
| 5850 | input Boolean in_mArg; | ||
| 5851 | input Tpl.Text in_a_args__str; | ||
| 5852 | input Tpl.Text in_a_func__str; | ||
| 5853 | |||
| 5854 | output Tpl.Text out_txt; | ||
| 5855 | algorithm | ||
| 5856 | out_txt := | ||
| 5857 | match(in_txt, in_mArg, in_a_args__str, in_a_func__str) | ||
| 5858 | local | ||
| 5859 | Tpl.Text txt; | ||
| 5860 | Tpl.Text a_args__str; | ||
| 5861 | Tpl.Text a_func__str; | ||
| 5862 | |||
| 5863 | case ( txt, | ||
| 5864 | true, | ||
| 5865 | _, | ||
| 5866 | a_func__str ) | ||
| 5867 | algorithm | ||
| 5868 | ✗ | txt := Tpl.writeText(txt, a_func__str); | |
| 5869 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(__)")); | |
| 5870 | then txt; | ||
| 5871 | |||
| 5872 | case ( txt, | ||
| 5873 | _, | ||
| 5874 | a_args__str, | ||
| 5875 | a_func__str ) | ||
| 5876 | algorithm | ||
| 5877 | ✗ | txt := Tpl.writeText(txt, a_func__str); | |
| 5878 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 5879 | ✗ | txt := Tpl.writeText(txt, a_args__str); | |
| 5880 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 5881 | then txt; | ||
| 5882 | end match; | ||
| 5883 | end fun_191; | ||
| 5884 | |||
| 5885 | protected function lm_192 | ||
| 5886 | input output Tpl.Text txt; | ||
| 5887 | input list<Absyn.Exp> items; | ||
| 5888 | input output Tpl.Text a_as__str; | ||
| 5889 | input MMToJuliaUtil.Context a_context; | ||
| 5890 | algorithm | ||
| 5891 | ✗ | for lstElt_192 in items loop | |
| 5892 | (txt, a_as__str) := match lstElt_192 | ||
| 5893 | local | ||
| 5894 | Absyn.Exp i_e; | ||
| 5895 | |||
| 5896 | case i_e | ||
| 5897 | algorithm | ||
| 5898 | ✗ | (txt, a_as__str) := dumpPattern(txt, i_e, a_context, a_as__str); | |
| 5899 | ✗ | txt := Tpl.nextIter(txt); | |
| 5900 | then (txt, a_as__str); | ||
| 5901 | end match; | ||
| 5902 | end for; | ||
| 5903 | end lm_192; | ||
| 5904 | |||
| 5905 | public function dumpPattern | ||
| 5906 | input Tpl.Text in_txt; | ||
| 5907 | input Absyn.Exp in_a_exp; | ||
| 5908 | input MMToJuliaUtil.Context in_a_context; | ||
| 5909 | input Tpl.Text in_a_as__str; | ||
| 5910 | |||
| 5911 | output Tpl.Text out_txt; | ||
| 5912 | output Tpl.Text out_a_as__str; | ||
| 5913 | algorithm | ||
| 5914 | (out_txt, out_a_as__str) := | ||
| 5915 | match(in_txt, in_a_exp, in_a_context, in_a_as__str) | ||
| 5916 | local | ||
| 5917 | Tpl.Text txt; | ||
| 5918 | MMToJuliaUtil.Context a_context; | ||
| 5919 | Tpl.Text a_as__str; | ||
| 5920 | Absyn.Exp i_rest; | ||
| 5921 | Absyn.Exp i_head; | ||
| 5922 | Absyn.Exp i_exp; | ||
| 5923 | list<Absyn.Exp> i_expressions; | ||
| 5924 | Absyn.ComponentRef i_function__; | ||
| 5925 | Absyn.Ident i_id; | ||
| 5926 | Absyn.FunctionArgs i_functionArgs; | ||
| 5927 | list<Absyn.Exp> i_exps; | ||
| 5928 | Boolean i_value_2; | ||
| 5929 | Absyn.ComponentRef i_componentRef; | ||
| 5930 | String i_value_1; | ||
| 5931 | Integer i_value; | ||
| 5932 | Tpl.Text txt_10; | ||
| 5933 | Tpl.Text txt_9; | ||
| 5934 | Tpl.Text l_consOp; | ||
| 5935 | Tpl.Text l_id__str; | ||
| 5936 | Tpl.Text l_exp__str; | ||
| 5937 | Tpl.Text l_tuple__str; | ||
| 5938 | Boolean ret_4; | ||
| 5939 | Boolean ret_3; | ||
| 5940 | Tpl.Text l_func__str; | ||
| 5941 | Tpl.Text l_args__str; | ||
| 5942 | String ret_0; | ||
| 5943 | |||
| 5944 | case ( txt, | ||
| 5945 | Absyn.INTEGER(value = i_value), | ||
| 5946 | _, | ||
| 5947 | a_as__str ) | ||
| 5948 | algorithm | ||
| 5949 | ✗ | txt := Tpl.writeStr(txt, intString(i_value)); | |
| 5950 | ✗ | then (txt, a_as__str); | |
| 5951 | |||
| 5952 | case ( txt, | ||
| 5953 | Absyn.REAL(value = i_value_1), | ||
| 5954 | _, | ||
| 5955 | a_as__str ) | ||
| 5956 | algorithm | ||
| 5957 | ✗ | txt := Tpl.writeStr(txt, i_value_1); | |
| 5958 | ✗ | then (txt, a_as__str); | |
| 5959 | |||
| 5960 | case ( txt, | ||
| 5961 | Absyn.CREF(componentRef = i_componentRef), | ||
| 5962 | _, | ||
| 5963 | a_as__str ) | ||
| 5964 | algorithm | ||
| 5965 | ✗ | txt := dumpCref(txt, i_componentRef, MMToJuliaUtil.functionContext); | |
| 5966 | ✗ | then (txt, a_as__str); | |
| 5967 | |||
| 5968 | case ( txt, | ||
| 5969 | Absyn.STRING(value = i_value_1), | ||
| 5970 | _, | ||
| 5971 | a_as__str ) | ||
| 5972 | algorithm | ||
| 5973 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 5974 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_ABS_INDENT(0)); | |
| 5975 | ✗ | ret_0 := System.stringReplace(i_value_1, "\\$", "\\$"); | |
| 5976 | ✗ | txt := Tpl.writeStr(txt, ret_0); | |
| 5977 | ✗ | txt := Tpl.popBlock(txt); | |
| 5978 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 5979 | ✗ | then (txt, a_as__str); | |
| 5980 | |||
| 5981 | case ( txt, | ||
| 5982 | Absyn.BOOL(value = i_value_2), | ||
| 5983 | _, | ||
| 5984 | a_as__str ) | ||
| 5985 | algorithm | ||
| 5986 | ✗ | txt := Tpl.writeStr(txt, Tpl.booleanString(i_value_2)); | |
| 5987 | ✗ | then (txt, a_as__str); | |
| 5988 | |||
| 5989 | case ( txt, | ||
| 5990 | Absyn.ARRAY(arrayExp = i_exps), | ||
| 5991 | a_context, | ||
| 5992 | a_as__str ) | ||
| 5993 | algorithm | ||
| 5994 | ✗ | (txt, a_as__str) := lm_183(txt, i_exps, a_as__str, a_context); | |
| 5995 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" nil()")); | |
| 5996 | ✗ | then (txt, a_as__str); | |
| 5997 | |||
| 5998 | case ( txt, | ||
| 5999 | Absyn.LIST(exps = i_exps), | ||
| 6000 | a_context, | ||
| 6001 | a_as__str ) | ||
| 6002 | algorithm | ||
| 6003 | ✗ | (txt, a_as__str) := lm_184(txt, i_exps, a_as__str, a_context); | |
| 6004 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" nil()")); | |
| 6005 | ✗ | then (txt, a_as__str); | |
| 6006 | |||
| 6007 | case ( txt, | ||
| 6008 | Absyn.CALL(function_ = Absyn.CREF_IDENT(name = "list"), functionArgs = Absyn.FUNCTIONARGS(args = i_exps)), | ||
| 6009 | a_context, | ||
| 6010 | a_as__str ) | ||
| 6011 | algorithm | ||
| 6012 | ✗ | (txt, a_as__str) := lm_185(txt, i_exps, a_as__str, a_context); | |
| 6013 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" nil()")); | |
| 6014 | ✗ | then (txt, a_as__str); | |
| 6015 | |||
| 6016 | case ( txt, | ||
| 6017 | Absyn.CALL(function_ = Absyn.CREF_IDENT(name = "$array"), functionArgs = Absyn.FUNCTIONARGS(args = i_exps)), | ||
| 6018 | a_context, | ||
| 6019 | a_as__str ) | ||
| 6020 | algorithm | ||
| 6021 | ✗ | (txt, a_as__str) := lm_186(txt, i_exps, a_as__str, a_context); | |
| 6022 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" nil()")); | |
| 6023 | ✗ | then (txt, a_as__str); | |
| 6024 | |||
| 6025 | case ( txt, | ||
| 6026 | Absyn.CALL(function_ = (i_function__ as Absyn.CREF_IDENT(name = i_id)), functionArgs = i_functionArgs), | ||
| 6027 | _, | ||
| 6028 | a_as__str ) | ||
| 6029 | algorithm | ||
| 6030 | ✗ | l_args__str := dumpFunctionArgsPattern(Tpl.emptyTxt, i_functionArgs); | |
| 6031 | ✗ | l_func__str := fun_187(Tpl.emptyTxt, i_id, i_function__); | |
| 6032 | ✗ | ret_3 := Tpl.isEmpty(l_args__str); | |
| 6033 | ✗ | txt := fun_190(txt, ret_3, l_args__str, l_func__str); | |
| 6034 | ✗ | then (txt, a_as__str); | |
| 6035 | |||
| 6036 | case ( txt, | ||
| 6037 | Absyn.CALL(function_ = i_function__, functionArgs = i_functionArgs), | ||
| 6038 | _, | ||
| 6039 | a_as__str ) | ||
| 6040 | algorithm | ||
| 6041 | ✗ | l_func__str := dumpCref(Tpl.emptyTxt, i_function__, MMToJuliaUtil.functionContext); | |
| 6042 | ✗ | l_args__str := dumpFunctionArgsPattern(Tpl.emptyTxt, i_functionArgs); | |
| 6043 | ✗ | ret_4 := Tpl.isEmpty(l_args__str); | |
| 6044 | ✗ | txt := fun_191(txt, ret_4, l_args__str, l_func__str); | |
| 6045 | ✗ | then (txt, a_as__str); | |
| 6046 | |||
| 6047 | case ( txt, | ||
| 6048 | Absyn.TUPLE(expressions = i_expressions), | ||
| 6049 | a_context, | ||
| 6050 | a_as__str ) | ||
| 6051 | algorithm | ||
| 6052 | ✗ | l_tuple__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 6053 | ✗ | (l_tuple__str, a_as__str) := lm_192(l_tuple__str, i_expressions, a_as__str, a_context); | |
| 6054 | ✗ | l_tuple__str := Tpl.popIter(l_tuple__str); | |
| 6055 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 6056 | ✗ | txt := Tpl.writeText(txt, l_tuple__str); | |
| 6057 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 6058 | ✗ | then (txt, a_as__str); | |
| 6059 | |||
| 6060 | case ( txt, | ||
| 6061 | Absyn.AS(exp = i_exp, id = i_id), | ||
| 6062 | a_context, | ||
| 6063 | a_as__str ) | ||
| 6064 | algorithm | ||
| 6065 | ✗ | (l_exp__str, a_as__str) := dumpPattern(Tpl.emptyTxt, i_exp, a_context, a_as__str); | |
| 6066 | ✗ | l_id__str := Tpl.writeStr(Tpl.emptyTxt, i_id); | |
| 6067 | ✗ | txt := Tpl.writeText(txt, l_id__str); | |
| 6068 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" && ")); | |
| 6069 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 6070 | ✗ | then (txt, a_as__str); | |
| 6071 | |||
| 6072 | case ( txt, | ||
| 6073 | Absyn.CONS(head = i_head, rest = i_rest), | ||
| 6074 | a_context, | ||
| 6075 | a_as__str ) | ||
| 6076 | algorithm | ||
| 6077 | ✗ | (txt_9, a_as__str) := dumpPattern(Tpl.emptyTxt, i_head, a_context, a_as__str); | |
| 6078 | ✗ | (txt_10, a_as__str) := dumpPattern(Tpl.emptyTxt, i_rest, a_context, a_as__str); | |
| 6079 | ✗ | l_consOp := dumpCons(Tpl.emptyTxt, Tpl.textString(txt_9), Tpl.textString(txt_10)); | |
| 6080 | ✗ | txt := Tpl.writeText(txt, l_consOp); | |
| 6081 | ✗ | then (txt, a_as__str); | |
| 6082 | |||
| 6083 | case ( txt, | ||
| 6084 | _, | ||
| 6085 | _, | ||
| 6086 | a_as__str ) | ||
| 6087 | algorithm | ||
| 6088 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("#= AbsynDumpTpl.dumpPattern: UNHANDLED Abyn.Exp =#")); | |
| 6089 | ✗ | then (txt, a_as__str); | |
| 6090 | end match; | ||
| 6091 | end dumpPattern; | ||
| 6092 | |||
| 6093 | public function dumpCons | ||
| 6094 | input Tpl.Text txt; | ||
| 6095 | input String a_headString; | ||
| 6096 | input String a_tailString; | ||
| 6097 | |||
| 6098 | output Tpl.Text out_txt; | ||
| 6099 | algorithm | ||
| 6100 | ✗ | out_txt := Tpl.writeStr(txt, a_headString); | |
| 6101 | ✗ | out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING(" <| ")); | |
| 6102 | ✗ | out_txt := Tpl.writeStr(out_txt, a_tailString); | |
| 6103 | end dumpCons; | ||
| 6104 | |||
| 6105 | protected function lm_195 | ||
| 6106 | input output Tpl.Text txt; | ||
| 6107 | input list<Absyn.Exp> items; | ||
| 6108 | algorithm | ||
| 6109 | ✗ | for lstElt_195 in items loop | |
| 6110 | txt := match lstElt_195 | ||
| 6111 | local | ||
| 6112 | Absyn.Exp i_arg; | ||
| 6113 | |||
| 6114 | case i_arg | ||
| 6115 | algorithm | ||
| 6116 | ✗ | (txt, _) := dumpPattern(txt, i_arg, MMToJuliaUtil.functionContext, Tpl.emptyTxt); | |
| 6117 | ✗ | txt := Tpl.nextIter(txt); | |
| 6118 | then txt; | ||
| 6119 | end match; | ||
| 6120 | end for; | ||
| 6121 | end lm_195; | ||
| 6122 | |||
| 6123 | protected function lm_196 | ||
| 6124 | input output Tpl.Text txt; | ||
| 6125 | input list<Absyn.NamedArg> items; | ||
| 6126 | algorithm | ||
| 6127 | ✗ | for lstElt_196 in items loop | |
| 6128 | txt := match lstElt_196 | ||
| 6129 | local | ||
| 6130 | Absyn.NamedArg i_narg; | ||
| 6131 | |||
| 6132 | case i_narg | ||
| 6133 | algorithm | ||
| 6134 | ✗ | txt := dumpNamedArgPattern(txt, i_narg); | |
| 6135 | ✗ | txt := Tpl.nextIter(txt); | |
| 6136 | then txt; | ||
| 6137 | end match; | ||
| 6138 | end for; | ||
| 6139 | end lm_196; | ||
| 6140 | |||
| 6141 | protected function fun_197 | ||
| 6142 | input Tpl.Text in_txt; | ||
| 6143 | input list<Absyn.NamedArg> in_a_argNames; | ||
| 6144 | |||
| 6145 | output Tpl.Text out_txt; | ||
| 6146 | algorithm | ||
| 6147 | out_txt := | ||
| 6148 | match(in_txt, in_a_argNames) | ||
| 6149 | local | ||
| 6150 | Tpl.Text txt; | ||
| 6151 | |||
| 6152 | case ( txt, | ||
| 6153 | {} ) | ||
| 6154 | then txt; | ||
| 6155 | |||
| 6156 | case ( txt, | ||
| 6157 | _ ) | ||
| 6158 | algorithm | ||
| 6159 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 6160 | then txt; | ||
| 6161 | end match; | ||
| 6162 | end fun_197; | ||
| 6163 | |||
| 6164 | protected function fun_198 | ||
| 6165 | input Tpl.Text in_txt; | ||
| 6166 | input Boolean in_mArg; | ||
| 6167 | input list<Absyn.NamedArg> in_a_argNames; | ||
| 6168 | |||
| 6169 | output Tpl.Text out_txt; | ||
| 6170 | algorithm | ||
| 6171 | out_txt := | ||
| 6172 | match(in_txt, in_mArg, in_a_argNames) | ||
| 6173 | local | ||
| 6174 | Tpl.Text txt; | ||
| 6175 | list<Absyn.NamedArg> a_argNames; | ||
| 6176 | |||
| 6177 | case ( txt, | ||
| 6178 | true, | ||
| 6179 | _ ) | ||
| 6180 | then txt; | ||
| 6181 | |||
| 6182 | case ( txt, | ||
| 6183 | _, | ||
| 6184 | a_argNames ) | ||
| 6185 | algorithm | ||
| 6186 | ✗ | txt := fun_197(txt, a_argNames); | |
| 6187 | then txt; | ||
| 6188 | end match; | ||
| 6189 | end fun_198; | ||
| 6190 | |||
| 6191 | public function dumpFunctionArgsPattern | ||
| 6192 | input Tpl.Text in_txt; | ||
| 6193 | input Absyn.FunctionArgs in_a_args; | ||
| 6194 | |||
| 6195 | output Tpl.Text out_txt; | ||
| 6196 | algorithm | ||
| 6197 | out_txt := | ||
| 6198 | match(in_txt, in_a_args) | ||
| 6199 | local | ||
| 6200 | Tpl.Text txt; | ||
| 6201 | list<Absyn.NamedArg> i_argNames; | ||
| 6202 | list<Absyn.Exp> i_args; | ||
| 6203 | Boolean ret_3; | ||
| 6204 | Tpl.Text l_separator; | ||
| 6205 | Tpl.Text l_namedargs__str; | ||
| 6206 | Tpl.Text l_args__str; | ||
| 6207 | |||
| 6208 | case ( txt, | ||
| 6209 | Absyn.FUNCTIONARGS(args = i_args, argNames = i_argNames) ) | ||
| 6210 | algorithm | ||
| 6211 | ✗ | 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())); | |
| 6212 | ✗ | l_args__str := lm_195(l_args__str, i_args); | |
| 6213 | ✗ | l_args__str := Tpl.popIter(l_args__str); | |
| 6214 | ✗ | l_namedargs__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())); | |
| 6215 | ✗ | l_namedargs__str := lm_196(l_namedargs__str, i_argNames); | |
| 6216 | ✗ | l_namedargs__str := Tpl.popIter(l_namedargs__str); | |
| 6217 | ✗ | ret_3 := Tpl.isEmpty(l_args__str); | |
| 6218 | ✗ | l_separator := fun_198(Tpl.emptyTxt, ret_3, i_argNames); | |
| 6219 | ✗ | txt := Tpl.writeText(txt, l_args__str); | |
| 6220 | ✗ | txt := Tpl.writeText(txt, l_separator); | |
| 6221 | ✗ | txt := Tpl.writeText(txt, l_namedargs__str); | |
| 6222 | then txt; | ||
| 6223 | |||
| 6224 | case ( txt, | ||
| 6225 | _ ) | ||
| 6226 | algorithm | ||
| 6227 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("ERROR FOR_ITER_FARG in pattern")); | |
| 6228 | then txt; | ||
| 6229 | end match; | ||
| 6230 | end dumpFunctionArgsPattern; | ||
| 6231 | |||
| 6232 | public function dumpNamedArgPattern | ||
| 6233 | input Tpl.Text in_txt; | ||
| 6234 | input Absyn.NamedArg in_a_narg; | ||
| 6235 | |||
| 6236 | output Tpl.Text out_txt; | ||
| 6237 | algorithm | ||
| 6238 | out_txt := | ||
| 6239 | match(in_txt, in_a_narg) | ||
| 6240 | local | ||
| 6241 | Tpl.Text txt; | ||
| 6242 | Absyn.Exp i_argValue; | ||
| 6243 | Absyn.Ident i_argName; | ||
| 6244 | |||
| 6245 | case ( txt, | ||
| 6246 | Absyn.NAMEDARG(argName = i_argName, argValue = i_argValue) ) | ||
| 6247 | algorithm | ||
| 6248 | ✗ | txt := Tpl.writeStr(txt, i_argName); | |
| 6249 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 6250 | ✗ | (txt, _) := dumpPattern(txt, i_argValue, MMToJuliaUtil.functionContext, Tpl.emptyTxt); | |
| 6251 | then txt; | ||
| 6252 | |||
| 6253 | case ( txt, | ||
| 6254 | _ ) | ||
| 6255 | then txt; | ||
| 6256 | end match; | ||
| 6257 | end dumpNamedArgPattern; | ||
| 6258 | |||
| 6259 | public function dumpNamedArgPattern2 | ||
| 6260 | input Tpl.Text in_txt; | ||
| 6261 | input Absyn.NamedArg in_a_narg; | ||
| 6262 | |||
| 6263 | output Tpl.Text out_txt; | ||
| 6264 | algorithm | ||
| 6265 | out_txt := | ||
| 6266 | match(in_txt, in_a_narg) | ||
| 6267 | local | ||
| 6268 | Tpl.Text txt; | ||
| 6269 | |||
| 6270 | case ( txt, | ||
| 6271 | Absyn.NAMEDARG(argName = _) ) | ||
| 6272 | algorithm | ||
| 6273 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<%argName%>")); | |
| 6274 | then txt; | ||
| 6275 | |||
| 6276 | case ( txt, | ||
| 6277 | _ ) | ||
| 6278 | then txt; | ||
| 6279 | end match; | ||
| 6280 | end dumpNamedArgPattern2; | ||
| 6281 | |||
| 6282 | public function dumpNamedArgPattern3 | ||
| 6283 | input Tpl.Text in_txt; | ||
| 6284 | input Absyn.NamedArg in_a_narg; | ||
| 6285 | |||
| 6286 | output Tpl.Text out_txt; | ||
| 6287 | algorithm | ||
| 6288 | out_txt := | ||
| 6289 | match(in_txt, in_a_narg) | ||
| 6290 | local | ||
| 6291 | Tpl.Text txt; | ||
| 6292 | Absyn.Exp i_argValue; | ||
| 6293 | |||
| 6294 | case ( txt, | ||
| 6295 | Absyn.NAMEDARG(argValue = i_argValue) ) | ||
| 6296 | algorithm | ||
| 6297 | ✗ | (txt, _) := dumpPattern(txt, i_argValue, MMToJuliaUtil.functionContext, Tpl.emptyTxt); | |
| 6298 | then txt; | ||
| 6299 | |||
| 6300 | case ( txt, | ||
| 6301 | _ ) | ||
| 6302 | then txt; | ||
| 6303 | end match; | ||
| 6304 | end dumpNamedArgPattern3; | ||
| 6305 | |||
| 6306 | public function dumpLhsExp | ||
| 6307 | input Tpl.Text in_txt; | ||
| 6308 | input Absyn.Exp in_a_lhs; | ||
| 6309 | input MMToJuliaUtil.Context in_a_context; | ||
| 6310 | |||
| 6311 | output Tpl.Text out_txt; | ||
| 6312 | algorithm | ||
| 6313 | out_txt := | ||
| 6314 | match(in_txt, in_a_lhs, in_a_context) | ||
| 6315 | local | ||
| 6316 | Tpl.Text txt; | ||
| 6317 | MMToJuliaUtil.Context a_context; | ||
| 6318 | Absyn.Exp i_lhs; | ||
| 6319 | |||
| 6320 | case ( txt, | ||
| 6321 | (i_lhs as Absyn.IFEXP(ifExp = _)), | ||
| 6322 | a_context ) | ||
| 6323 | algorithm | ||
| 6324 | ✗ | txt := dumpExp(txt, i_lhs, a_context); | |
| 6325 | then txt; | ||
| 6326 | |||
| 6327 | case ( txt, | ||
| 6328 | i_lhs, | ||
| 6329 | a_context ) | ||
| 6330 | algorithm | ||
| 6331 | ✗ | txt := dumpExp(txt, i_lhs, a_context); | |
| 6332 | then txt; | ||
| 6333 | end match; | ||
| 6334 | end dumpLhsExp; | ||
| 6335 | |||
| 6336 | protected function fun_204 | ||
| 6337 | input Tpl.Text in_txt; | ||
| 6338 | input Boolean in_mArg; | ||
| 6339 | input Tpl.Text in_a_op__str; | ||
| 6340 | |||
| 6341 | output Tpl.Text out_txt; | ||
| 6342 | algorithm | ||
| 6343 | out_txt := | ||
| 6344 | match(in_txt, in_mArg, in_a_op__str) | ||
| 6345 | local | ||
| 6346 | Tpl.Text txt; | ||
| 6347 | Tpl.Text a_op__str; | ||
| 6348 | |||
| 6349 | case ( txt, | ||
| 6350 | false, | ||
| 6351 | a_op__str ) | ||
| 6352 | algorithm | ||
| 6353 | ✗ | txt := Tpl.writeText(txt, a_op__str); | |
| 6354 | then txt; | ||
| 6355 | |||
| 6356 | case ( txt, | ||
| 6357 | _, | ||
| 6358 | a_op__str ) | ||
| 6359 | algorithm | ||
| 6360 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("(")); | |
| 6361 | ✗ | txt := Tpl.writeText(txt, a_op__str); | |
| 6362 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 6363 | then txt; | ||
| 6364 | end match; | ||
| 6365 | end fun_204; | ||
| 6366 | |||
| 6367 | public function dumpOperand | ||
| 6368 | input Tpl.Text txt; | ||
| 6369 | input Absyn.Exp a_operand; | ||
| 6370 | input Absyn.Exp a_operation; | ||
| 6371 | input Boolean a_lhs; | ||
| 6372 | input MMToJuliaUtil.Context a_context; | ||
| 6373 | |||
| 6374 | output Tpl.Text out_txt; | ||
| 6375 | protected | ||
| 6376 | Boolean ret_1; | ||
| 6377 | Tpl.Text l_op__str; | ||
| 6378 | algorithm | ||
| 6379 | ✗ | l_op__str := dumpExp(Tpl.emptyTxt, a_operand, a_context); | |
| 6380 | ✗ | ret_1 := Dump.shouldParenthesize(a_operand, a_operation, a_lhs); | |
| 6381 | ✗ | out_txt := fun_204(txt, ret_1, l_op__str); | |
| 6382 | end dumpOperand; | ||
| 6383 | |||
| 6384 | public function dumpIfExp | ||
| 6385 | input Tpl.Text in_txt; | ||
| 6386 | input Absyn.Exp in_a_if__exp; | ||
| 6387 | input MMToJuliaUtil.Context in_a_context; | ||
| 6388 | |||
| 6389 | output Tpl.Text out_txt; | ||
| 6390 | algorithm | ||
| 6391 | out_txt := | ||
| 6392 | match(in_txt, in_a_if__exp, in_a_context) | ||
| 6393 | local | ||
| 6394 | Tpl.Text txt; | ||
| 6395 | MMToJuliaUtil.Context a_context; | ||
| 6396 | list<tuple<Absyn.Exp, Absyn.Exp>> i_elseIfBranch; | ||
| 6397 | Absyn.Exp i_elseBranch; | ||
| 6398 | Absyn.Exp i_trueBranch; | ||
| 6399 | Absyn.Exp i_ifExp; | ||
| 6400 | Tpl.Text l_else__if__str; | ||
| 6401 | Tpl.Text l_else__branch__str; | ||
| 6402 | Tpl.Text l_true__branch__str; | ||
| 6403 | Tpl.Text l_cond__str; | ||
| 6404 | |||
| 6405 | case ( txt, | ||
| 6406 | Absyn.IFEXP(ifExp = i_ifExp, trueBranch = i_trueBranch, elseBranch = i_elseBranch, elseIfBranch = i_elseIfBranch), | ||
| 6407 | a_context ) | ||
| 6408 | algorithm | ||
| 6409 | ✗ | l_cond__str := dumpExp(Tpl.emptyTxt, i_ifExp, a_context); | |
| 6410 | ✗ | l_true__branch__str := dumpExp(Tpl.emptyTxt, i_trueBranch, a_context); | |
| 6411 | ✗ | l_else__branch__str := dumpExp(Tpl.emptyTxt, i_elseBranch, a_context); | |
| 6412 | ✗ | l_else__if__str := dumpElseIfExp(Tpl.emptyTxt, i_elseIfBranch, a_context); | |
| 6413 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("if ")); | |
| 6414 | ✗ | txt := Tpl.writeText(txt, l_cond__str); | |
| 6415 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6416 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6)); | |
| 6417 | ✗ | txt := Tpl.writeText(txt, l_true__branch__str); | |
| 6418 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6419 | ✗ | txt := Tpl.popBlock(txt); | |
| 6420 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4)); | |
| 6421 | ✗ | txt := Tpl.writeText(txt, l_else__if__str); | |
| 6422 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6423 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("else\n")); | |
| 6424 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6425 | ✗ | txt := Tpl.writeText(txt, l_else__branch__str); | |
| 6426 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6427 | ✗ | txt := Tpl.popBlock(txt); | |
| 6428 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 6429 | ✗ | txt := Tpl.popBlock(txt); | |
| 6430 | then txt; | ||
| 6431 | |||
| 6432 | case ( txt, | ||
| 6433 | _, | ||
| 6434 | _ ) | ||
| 6435 | then txt; | ||
| 6436 | end match; | ||
| 6437 | end dumpIfExp; | ||
| 6438 | |||
| 6439 | protected function lm_207 | ||
| 6440 | input output Tpl.Text txt; | ||
| 6441 | input list<tuple<Absyn.Exp, Absyn.Exp>> items; | ||
| 6442 | input MMToJuliaUtil.Context a_context; | ||
| 6443 | algorithm | ||
| 6444 | ✗ | for lstElt_207 in items loop | |
| 6445 | txt := match lstElt_207 | ||
| 6446 | local | ||
| 6447 | Absyn.Exp i_branch; | ||
| 6448 | Absyn.Exp i_cond; | ||
| 6449 | Tpl.Text l_branch__str; | ||
| 6450 | Tpl.Text l_cond__str; | ||
| 6451 | |||
| 6452 | case (i_cond, i_branch) | ||
| 6453 | algorithm | ||
| 6454 | ✗ | l_cond__str := dumpExp(Tpl.emptyTxt, i_cond, a_context); | |
| 6455 | ✗ | l_branch__str := dumpExp(Tpl.emptyTxt, i_branch, a_context); | |
| 6456 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("elseif (")); | |
| 6457 | ✗ | txt := Tpl.writeText(txt, l_cond__str); | |
| 6458 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE(")\n")); | |
| 6459 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6)); | |
| 6460 | ✗ | txt := Tpl.writeText(txt, l_branch__str); | |
| 6461 | ✗ | txt := Tpl.popBlock(txt); | |
| 6462 | ✗ | txt := Tpl.nextIter(txt); | |
| 6463 | then txt; | ||
| 6464 | end match; | ||
| 6465 | end for; | ||
| 6466 | end lm_207; | ||
| 6467 | |||
| 6468 | public function dumpElseIfExp | ||
| 6469 | input Tpl.Text txt; | ||
| 6470 | input list<tuple<Absyn.Exp, Absyn.Exp>> a_else__if; | ||
| 6471 | input MMToJuliaUtil.Context a_context; | ||
| 6472 | |||
| 6473 | output Tpl.Text out_txt; | ||
| 6474 | algorithm | ||
| 6475 | ✗ | 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())); | |
| 6476 | ✗ | out_txt := lm_207(out_txt, a_else__if, a_context); | |
| 6477 | ✗ | out_txt := Tpl.popIter(out_txt); | |
| 6478 | end dumpElseIfExp; | ||
| 6479 | |||
| 6480 | public function dumpCodeNode | ||
| 6481 | input Tpl.Text in_txt; | ||
| 6482 | input Absyn.CodeNode in_a_code; | ||
| 6483 | input MMToJuliaUtil.Context in_a_context; | ||
| 6484 | |||
| 6485 | output Tpl.Text out_txt; | ||
| 6486 | algorithm | ||
| 6487 | out_txt := | ||
| 6488 | match(in_txt, in_a_code, in_a_context) | ||
| 6489 | local | ||
| 6490 | Tpl.Text txt; | ||
| 6491 | MMToJuliaUtil.Context a_context; | ||
| 6492 | Absyn.Modification i_modification; | ||
| 6493 | Absyn.Exp i_exp; | ||
| 6494 | Absyn.Element i_element; | ||
| 6495 | Absyn.ComponentRef i_componentRef; | ||
| 6496 | Absyn.Path i_path; | ||
| 6497 | |||
| 6498 | case ( txt, | ||
| 6499 | Absyn.C_TYPENAME(path = i_path), | ||
| 6500 | _ ) | ||
| 6501 | algorithm | ||
| 6502 | ✗ | txt := dumpPathJL(txt, i_path); | |
| 6503 | then txt; | ||
| 6504 | |||
| 6505 | case ( txt, | ||
| 6506 | Absyn.C_VARIABLENAME(componentRef = i_componentRef), | ||
| 6507 | a_context ) | ||
| 6508 | algorithm | ||
| 6509 | ✗ | txt := dumpCref(txt, i_componentRef, a_context); | |
| 6510 | then txt; | ||
| 6511 | |||
| 6512 | case ( txt, | ||
| 6513 | Absyn.C_CONSTRAINTSECTION(boolean = _), | ||
| 6514 | _ ) | ||
| 6515 | algorithm | ||
| 6516 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpCodeNode: C_CONSTRAINTSECTION not supported"); | |
| 6517 | then txt; | ||
| 6518 | |||
| 6519 | case ( txt, | ||
| 6520 | Absyn.C_EQUATIONSECTION(boolean = _), | ||
| 6521 | _ ) | ||
| 6522 | algorithm | ||
| 6523 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpCodeNode: C_CONSTRAINTSECTION not supported"); | |
| 6524 | then txt; | ||
| 6525 | |||
| 6526 | case ( txt, | ||
| 6527 | Absyn.C_ALGORITHMSECTION(boolean = _), | ||
| 6528 | _ ) | ||
| 6529 | algorithm | ||
| 6530 | ✗ | txt := AbsynDumpTpl.errorMsg(txt, "AbsynToJulia.dumpCodeNode: C_ALGORITHMSECTION not supported"); | |
| 6531 | then txt; | ||
| 6532 | |||
| 6533 | case ( txt, | ||
| 6534 | Absyn.C_ELEMENT(element = i_element), | ||
| 6535 | a_context ) | ||
| 6536 | algorithm | ||
| 6537 | ✗ | txt := dumpElement(txt, i_element, Dump.defaultDumpOptions, a_context); | |
| 6538 | then txt; | ||
| 6539 | |||
| 6540 | case ( txt, | ||
| 6541 | Absyn.C_EXPRESSION(exp = i_exp), | ||
| 6542 | a_context ) | ||
| 6543 | algorithm | ||
| 6544 | ✗ | txt := dumpExp(txt, i_exp, a_context); | |
| 6545 | then txt; | ||
| 6546 | |||
| 6547 | case ( txt, | ||
| 6548 | Absyn.C_MODIFICATION(modification = i_modification), | ||
| 6549 | a_context ) | ||
| 6550 | algorithm | ||
| 6551 | ✗ | txt := dumpModification(txt, i_modification, a_context); | |
| 6552 | then txt; | ||
| 6553 | |||
| 6554 | case ( txt, | ||
| 6555 | _, | ||
| 6556 | _ ) | ||
| 6557 | then txt; | ||
| 6558 | end match; | ||
| 6559 | end dumpCodeNode; | ||
| 6560 | |||
| 6561 | protected function lm_210 | ||
| 6562 | input output Tpl.Text txt; | ||
| 6563 | input list<Absyn.Case> items; | ||
| 6564 | input Absyn.Exp a_inputExp; | ||
| 6565 | algorithm | ||
| 6566 | ✗ | for lstElt_210 in items loop | |
| 6567 | txt := match lstElt_210 | ||
| 6568 | local | ||
| 6569 | Absyn.Case i_c; | ||
| 6570 | MMToJuliaUtil.Context ret_0; | ||
| 6571 | |||
| 6572 | case i_c | ||
| 6573 | algorithm | ||
| 6574 | ✗ | ret_0 := MMToJuliaUtil.makeMatchContext(a_inputExp); | |
| 6575 | ✗ | txt := dumpMatchCase(txt, i_c, ret_0); | |
| 6576 | ✗ | txt := Tpl.nextIter(txt); | |
| 6577 | then txt; | ||
| 6578 | end match; | ||
| 6579 | end for; | ||
| 6580 | end lm_210; | ||
| 6581 | |||
| 6582 | public function dumpMatchExp | ||
| 6583 | input Tpl.Text in_txt; | ||
| 6584 | input Absyn.Exp in_a_match__exp; | ||
| 6585 | |||
| 6586 | output Tpl.Text out_txt; | ||
| 6587 | algorithm | ||
| 6588 | out_txt := | ||
| 6589 | match(in_txt, in_a_match__exp) | ||
| 6590 | local | ||
| 6591 | Tpl.Text txt; | ||
| 6592 | Option<String> i_comment; | ||
| 6593 | list<Absyn.Case> i_cases; | ||
| 6594 | list<Absyn.ElementItem> i_localDecls; | ||
| 6595 | Absyn.Exp i_inputExp; | ||
| 6596 | Absyn.MatchType i_matchTy; | ||
| 6597 | Tpl.Text l_cmt__str; | ||
| 6598 | Tpl.Text l_cases__str; | ||
| 6599 | Tpl.Text l_locals__str; | ||
| 6600 | Tpl.Text l_input__str; | ||
| 6601 | Tpl.Text l_match__ty__str; | ||
| 6602 | |||
| 6603 | case ( txt, | ||
| 6604 | Absyn.MATCHEXP(matchTy = i_matchTy, inputExp = i_inputExp, localDecls = i_localDecls, cases = i_cases, comment = i_comment) ) | ||
| 6605 | algorithm | ||
| 6606 | ✗ | l_match__ty__str := dumpMatchType(Tpl.emptyTxt, i_matchTy); | |
| 6607 | ✗ | l_input__str := dumpExp(Tpl.emptyTxt, i_inputExp, MMToJuliaUtil.functionContext); | |
| 6608 | ✗ | l_locals__str := dumpMatchLocals(Tpl.emptyTxt, i_localDecls); | |
| 6609 | ✗ | l_cases__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING_LIST({ | |
| 6610 | "\n", | ||
| 6611 | "\n" | ||
| 6612 | }, true)), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | ||
| 6613 | ✗ | l_cases__str := lm_210(l_cases__str, i_cases, i_inputExp); | |
| 6614 | ✗ | l_cases__str := Tpl.popIter(l_cases__str); | |
| 6615 | ✗ | l_cmt__str := dumpCommentStrOpt(Tpl.emptyTxt, i_comment); | |
| 6616 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("begin\n")); | |
| 6617 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6618 | ✗ | txt := Tpl.writeText(txt, l_locals__str); | |
| 6619 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6620 | ✗ | txt := Tpl.writeText(txt, l_match__ty__str); | |
| 6621 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 6622 | ✗ | txt := Tpl.writeText(txt, l_input__str); | |
| 6623 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE(" begin\n")); | |
| 6624 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6625 | ✗ | txt := Tpl.writeText(txt, l_cases__str); | |
| 6626 | ✗ | txt := Tpl.writeText(txt, l_cmt__str); | |
| 6627 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6628 | ✗ | txt := Tpl.popBlock(txt); | |
| 6629 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("end\n")); | |
| 6630 | ✗ | txt := Tpl.popBlock(txt); | |
| 6631 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 6632 | then txt; | ||
| 6633 | |||
| 6634 | case ( txt, | ||
| 6635 | _ ) | ||
| 6636 | then txt; | ||
| 6637 | end match; | ||
| 6638 | end dumpMatchExp; | ||
| 6639 | |||
| 6640 | public function dumpMatchType | ||
| 6641 | input Tpl.Text in_txt; | ||
| 6642 | input Absyn.MatchType in_a_match__type; | ||
| 6643 | |||
| 6644 | output Tpl.Text out_txt; | ||
| 6645 | algorithm | ||
| 6646 | out_txt := | ||
| 6647 | match(in_txt, in_a_match__type) | ||
| 6648 | local | ||
| 6649 | Tpl.Text txt; | ||
| 6650 | |||
| 6651 | case ( txt, | ||
| 6652 | Absyn.MATCH() ) | ||
| 6653 | algorithm | ||
| 6654 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@match")); | |
| 6655 | then txt; | ||
| 6656 | |||
| 6657 | case ( txt, | ||
| 6658 | Absyn.MATCHCONTINUE() ) | ||
| 6659 | algorithm | ||
| 6660 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@matchcontinue")); | |
| 6661 | then txt; | ||
| 6662 | |||
| 6663 | case ( txt, | ||
| 6664 | _ ) | ||
| 6665 | then txt; | ||
| 6666 | end match; | ||
| 6667 | end dumpMatchType; | ||
| 6668 | |||
| 6669 | protected function lm_213 | ||
| 6670 | input output Tpl.Text txt; | ||
| 6671 | input list<Absyn.AlgorithmItem> items; | ||
| 6672 | algorithm | ||
| 6673 | ✗ | for lstElt_213 in items loop | |
| 6674 | txt := match lstElt_213 | ||
| 6675 | local | ||
| 6676 | Absyn.AlgorithmItem i_alg; | ||
| 6677 | |||
| 6678 | case i_alg | ||
| 6679 | algorithm | ||
| 6680 | ✗ | txt := dumpAlgorithmItem(txt, i_alg, MMToJuliaUtil.functionContext); | |
| 6681 | ✗ | txt := Tpl.nextIter(txt); | |
| 6682 | then txt; | ||
| 6683 | end match; | ||
| 6684 | end for; | ||
| 6685 | end lm_213; | ||
| 6686 | |||
| 6687 | protected function lm_214 | ||
| 6688 | input output Tpl.Text txt; | ||
| 6689 | input list<Absyn.AlgorithmItem> items; | ||
| 6690 | algorithm | ||
| 6691 | ✗ | for lstElt_214 in items loop | |
| 6692 | txt := match lstElt_214 | ||
| 6693 | local | ||
| 6694 | Absyn.AlgorithmItem i_alg; | ||
| 6695 | |||
| 6696 | case i_alg | ||
| 6697 | algorithm | ||
| 6698 | ✗ | txt := dumpAlgorithmItem(txt, i_alg, MMToJuliaUtil.functionContext); | |
| 6699 | ✗ | txt := Tpl.nextIter(txt); | |
| 6700 | then txt; | ||
| 6701 | end match; | ||
| 6702 | end for; | ||
| 6703 | end lm_214; | ||
| 6704 | |||
| 6705 | public function dumpMatchContents | ||
| 6706 | input Tpl.Text in_txt; | ||
| 6707 | input Absyn.ClassPart in_a_cp; | ||
| 6708 | |||
| 6709 | output Tpl.Text out_txt; | ||
| 6710 | algorithm | ||
| 6711 | out_txt := | ||
| 6712 | match(in_txt, in_a_cp) | ||
| 6713 | local | ||
| 6714 | Tpl.Text txt; | ||
| 6715 | list<Absyn.AlgorithmItem> i_algs; | ||
| 6716 | Absyn.ClassPart i_cp; | ||
| 6717 | list<Absyn.AlgorithmItem> ret_0; | ||
| 6718 | |||
| 6719 | case ( txt, | ||
| 6720 | Absyn.EQUATIONS(contents = {}) ) | ||
| 6721 | then txt; | ||
| 6722 | |||
| 6723 | case ( txt, | ||
| 6724 | (i_cp as Absyn.EQUATIONS(contents = _)) ) | ||
| 6725 | algorithm | ||
| 6726 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6727 | ✗ | ret_0 := Static.fromEquationsToAlgAssignments(i_cp); | |
| 6728 | ✗ | 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())); | |
| 6729 | ✗ | txt := lm_213(txt, ret_0); | |
| 6730 | ✗ | txt := Tpl.popIter(txt); | |
| 6731 | ✗ | txt := Tpl.popBlock(txt); | |
| 6732 | then txt; | ||
| 6733 | |||
| 6734 | case ( txt, | ||
| 6735 | Absyn.ALGORITHMS(contents = {}) ) | ||
| 6736 | then txt; | ||
| 6737 | |||
| 6738 | case ( txt, | ||
| 6739 | Absyn.ALGORITHMS(contents = i_algs) ) | ||
| 6740 | algorithm | ||
| 6741 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6742 | ✗ | 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())); | |
| 6743 | ✗ | txt := lm_214(txt, i_algs); | |
| 6744 | ✗ | txt := Tpl.popIter(txt); | |
| 6745 | ✗ | txt := Tpl.popBlock(txt); | |
| 6746 | then txt; | ||
| 6747 | |||
| 6748 | case ( txt, | ||
| 6749 | _ ) | ||
| 6750 | then txt; | ||
| 6751 | end match; | ||
| 6752 | end dumpMatchContents; | ||
| 6753 | |||
| 6754 | protected function lm_216 | ||
| 6755 | input output Tpl.Text txt; | ||
| 6756 | input list<Absyn.ElementItem> items; | ||
| 6757 | algorithm | ||
| 6758 | ✗ | for lstElt_216 in items loop | |
| 6759 | txt := match lstElt_216 | ||
| 6760 | local | ||
| 6761 | Absyn.ElementItem i_decl; | ||
| 6762 | |||
| 6763 | case i_decl | ||
| 6764 | algorithm | ||
| 6765 | ✗ | txt := dumpElementItem(txt, i_decl, Dump.defaultDumpOptions, MMToJuliaUtil.functionContext); | |
| 6766 | ✗ | txt := Tpl.nextIter(txt); | |
| 6767 | then txt; | ||
| 6768 | end match; | ||
| 6769 | end for; | ||
| 6770 | end lm_216; | ||
| 6771 | |||
| 6772 | public function dumpMatchLocals | ||
| 6773 | input Tpl.Text in_txt; | ||
| 6774 | input list<Absyn.ElementItem> in_a_locals; | ||
| 6775 | |||
| 6776 | output Tpl.Text out_txt; | ||
| 6777 | algorithm | ||
| 6778 | out_txt := | ||
| 6779 | match(in_txt, in_a_locals) | ||
| 6780 | local | ||
| 6781 | Tpl.Text txt; | ||
| 6782 | list<Absyn.ElementItem> i_locals; | ||
| 6783 | |||
| 6784 | case ( txt, | ||
| 6785 | {} ) | ||
| 6786 | then txt; | ||
| 6787 | |||
| 6788 | case ( txt, | ||
| 6789 | i_locals ) | ||
| 6790 | algorithm | ||
| 6791 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6792 | ✗ | 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())); | |
| 6793 | ✗ | txt := lm_216(txt, i_locals); | |
| 6794 | ✗ | txt := Tpl.popIter(txt); | |
| 6795 | ✗ | txt := Tpl.popBlock(txt); | |
| 6796 | then txt; | ||
| 6797 | end match; | ||
| 6798 | end dumpMatchLocals; | ||
| 6799 | |||
| 6800 | protected function fun_218 | ||
| 6801 | input Tpl.Text in_txt; | ||
| 6802 | input Option<Absyn.Exp> in_a_patternGuard; | ||
| 6803 | input MMToJuliaUtil.Context in_a_context; | ||
| 6804 | |||
| 6805 | output Tpl.Text out_txt; | ||
| 6806 | algorithm | ||
| 6807 | out_txt := | ||
| 6808 | match(in_txt, in_a_patternGuard, in_a_context) | ||
| 6809 | local | ||
| 6810 | Tpl.Text txt; | ||
| 6811 | MMToJuliaUtil.Context a_context; | ||
| 6812 | Absyn.Exp i_g; | ||
| 6813 | |||
| 6814 | case ( txt, | ||
| 6815 | SOME(i_g), | ||
| 6816 | a_context ) | ||
| 6817 | algorithm | ||
| 6818 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("where (")); | |
| 6819 | ✗ | txt := dumpExp(txt, i_g, a_context); | |
| 6820 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(") ")); | |
| 6821 | then txt; | ||
| 6822 | |||
| 6823 | case ( txt, | ||
| 6824 | _, | ||
| 6825 | _ ) | ||
| 6826 | then txt; | ||
| 6827 | end match; | ||
| 6828 | end fun_218; | ||
| 6829 | |||
| 6830 | protected function fun_219 | ||
| 6831 | input Tpl.Text in_txt; | ||
| 6832 | input MMToJuliaUtil.Context in_a_context; | ||
| 6833 | |||
| 6834 | output Tpl.Text out_txt; | ||
| 6835 | algorithm | ||
| 6836 | out_txt := | ||
| 6837 | match(in_txt, in_a_context) | ||
| 6838 | local | ||
| 6839 | Tpl.Text txt; | ||
| 6840 | MMToJuliaUtil.Context i_context; | ||
| 6841 | Absyn.Exp i_inputExp; | ||
| 6842 | |||
| 6843 | case ( txt, | ||
| 6844 | (i_context as MMToJuliaUtil.MATCH_CONTEXT(inputExp = i_inputExp)) ) | ||
| 6845 | algorithm | ||
| 6846 | ✗ | txt := dumpExp(txt, i_inputExp, i_context); | |
| 6847 | then txt; | ||
| 6848 | |||
| 6849 | case ( txt, | ||
| 6850 | _ ) | ||
| 6851 | then txt; | ||
| 6852 | end match; | ||
| 6853 | end fun_219; | ||
| 6854 | |||
| 6855 | protected function fun_220 | ||
| 6856 | input Tpl.Text in_txt; | ||
| 6857 | input Boolean in_mArg; | ||
| 6858 | input Tpl.Text in_a_as__str; | ||
| 6859 | input Tpl.Text in_a_result__str; | ||
| 6860 | input Tpl.Text in_a_eql__str; | ||
| 6861 | input Tpl.Text in_a_cmt__str; | ||
| 6862 | input Tpl.Text in_a_guard__str; | ||
| 6863 | input Tpl.Text in_a_pattern__str; | ||
| 6864 | |||
| 6865 | output Tpl.Text out_txt; | ||
| 6866 | algorithm | ||
| 6867 | out_txt := | ||
| 6868 | match(in_txt, in_mArg, in_a_as__str, in_a_result__str, in_a_eql__str, in_a_cmt__str, in_a_guard__str, in_a_pattern__str) | ||
| 6869 | local | ||
| 6870 | Tpl.Text txt; | ||
| 6871 | Tpl.Text a_as__str; | ||
| 6872 | Tpl.Text a_result__str; | ||
| 6873 | Tpl.Text a_eql__str; | ||
| 6874 | Tpl.Text a_cmt__str; | ||
| 6875 | Tpl.Text a_guard__str; | ||
| 6876 | Tpl.Text a_pattern__str; | ||
| 6877 | |||
| 6878 | case ( txt, | ||
| 6879 | true, | ||
| 6880 | _, | ||
| 6881 | a_result__str, | ||
| 6882 | a_eql__str, | ||
| 6883 | a_cmt__str, | ||
| 6884 | a_guard__str, | ||
| 6885 | a_pattern__str ) | ||
| 6886 | algorithm | ||
| 6887 | ✗ | txt := Tpl.writeText(txt, a_pattern__str); | |
| 6888 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 6889 | ✗ | txt := Tpl.writeText(txt, a_guard__str); | |
| 6890 | ✗ | txt := Tpl.writeText(txt, a_cmt__str); | |
| 6891 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE(" => begin\n")); | |
| 6892 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6893 | ✗ | txt := Tpl.writeText(txt, a_eql__str); | |
| 6894 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6895 | ✗ | txt := Tpl.writeText(txt, a_result__str); | |
| 6896 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6897 | ✗ | txt := Tpl.popBlock(txt); | |
| 6898 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 6899 | then txt; | ||
| 6900 | |||
| 6901 | case ( txt, | ||
| 6902 | _, | ||
| 6903 | a_as__str, | ||
| 6904 | a_result__str, | ||
| 6905 | a_eql__str, | ||
| 6906 | a_cmt__str, | ||
| 6907 | a_guard__str, | ||
| 6908 | a_pattern__str ) | ||
| 6909 | algorithm | ||
| 6910 | ✗ | txt := Tpl.writeText(txt, a_pattern__str); | |
| 6911 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 6912 | ✗ | txt := Tpl.writeText(txt, a_guard__str); | |
| 6913 | ✗ | txt := Tpl.writeText(txt, a_cmt__str); | |
| 6914 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE(" => begin\n")); | |
| 6915 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 6916 | ✗ | txt := Tpl.writeText(txt, a_as__str); | |
| 6917 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6918 | ✗ | txt := Tpl.writeText(txt, a_eql__str); | |
| 6919 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6920 | ✗ | txt := Tpl.writeText(txt, a_result__str); | |
| 6921 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6922 | ✗ | txt := Tpl.popBlock(txt); | |
| 6923 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 6924 | then txt; | ||
| 6925 | end match; | ||
| 6926 | end fun_220; | ||
| 6927 | |||
| 6928 | public function dumpMatchCase | ||
| 6929 | input Tpl.Text in_txt; | ||
| 6930 | input Absyn.Case in_a_c; | ||
| 6931 | input MMToJuliaUtil.Context in_a_context; | ||
| 6932 | |||
| 6933 | output Tpl.Text out_txt; | ||
| 6934 | algorithm | ||
| 6935 | out_txt := | ||
| 6936 | match(in_txt, in_a_c, in_a_context) | ||
| 6937 | local | ||
| 6938 | Tpl.Text txt; | ||
| 6939 | MMToJuliaUtil.Context a_context; | ||
| 6940 | Option<String> i_comment; | ||
| 6941 | Absyn.Exp i_result; | ||
| 6942 | Absyn.ClassPart i_classPart; | ||
| 6943 | Option<Absyn.Exp> i_patternGuard; | ||
| 6944 | Absyn.Exp i_pattern; | ||
| 6945 | Boolean ret_7; | ||
| 6946 | Tpl.Text l_input__str; | ||
| 6947 | Tpl.Text l_cmt__str; | ||
| 6948 | Tpl.Text l_result__str; | ||
| 6949 | Tpl.Text l_eql__str; | ||
| 6950 | Tpl.Text l_guard__str; | ||
| 6951 | Tpl.Text l_pattern__str; | ||
| 6952 | Tpl.Text l_as__str; | ||
| 6953 | |||
| 6954 | case ( txt, | ||
| 6955 | Absyn.CASE(pattern = i_pattern, patternGuard = i_patternGuard, classPart = i_classPart, result = i_result, comment = i_comment), | ||
| 6956 | a_context ) | ||
| 6957 | algorithm | ||
| 6958 | ✗ | l_as__str := Tpl.emptyTxt; | |
| 6959 | ✗ | (l_pattern__str, l_as__str) := dumpPattern(Tpl.emptyTxt, i_pattern, a_context, l_as__str); | |
| 6960 | ✗ | l_guard__str := fun_218(Tpl.emptyTxt, i_patternGuard, a_context); | |
| 6961 | ✗ | l_eql__str := dumpMatchContents(Tpl.emptyTxt, i_classPart); | |
| 6962 | ✗ | l_result__str := dumpExp(Tpl.emptyTxt, i_result, a_context); | |
| 6963 | ✗ | l_cmt__str := dumpCommentStrOpt(Tpl.emptyTxt, i_comment); | |
| 6964 | ✗ | l_input__str := fun_219(Tpl.emptyTxt, a_context); | |
| 6965 | ✗ | ret_7 := Tpl.isEmpty(l_as__str); | |
| 6966 | ✗ | txt := fun_220(txt, ret_7, l_as__str, l_result__str, l_eql__str, l_cmt__str, l_guard__str, l_pattern__str); | |
| 6967 | then txt; | ||
| 6968 | |||
| 6969 | case ( txt, | ||
| 6970 | Absyn.ELSE(classPart = i_classPart, result = i_result, comment = i_comment), | ||
| 6971 | a_context ) | ||
| 6972 | algorithm | ||
| 6973 | ✗ | l_eql__str := dumpMatchContents(Tpl.emptyTxt, i_classPart); | |
| 6974 | ✗ | l_result__str := dumpExp(Tpl.emptyTxt, i_result, a_context); | |
| 6975 | ✗ | l_cmt__str := dumpCommentStrOpt(Tpl.emptyTxt, i_comment); | |
| 6976 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("_ ")); | |
| 6977 | ✗ | txt := Tpl.writeText(txt, l_cmt__str); | |
| 6978 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE(" => begin\n")); | |
| 6979 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4)); | |
| 6980 | ✗ | txt := Tpl.writeText(txt, l_eql__str); | |
| 6981 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6982 | ✗ | txt := Tpl.writeText(txt, l_result__str); | |
| 6983 | ✗ | txt := Tpl.softNewLine(txt); | |
| 6984 | ✗ | txt := Tpl.popBlock(txt); | |
| 6985 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end")); | |
| 6986 | then txt; | ||
| 6987 | |||
| 6988 | case ( txt, | ||
| 6989 | _, | ||
| 6990 | _ ) | ||
| 6991 | then txt; | ||
| 6992 | end match; | ||
| 6993 | end dumpMatchCase; | ||
| 6994 | |||
| 6995 | public function dumpOperator | ||
| 6996 | input Tpl.Text in_txt; | ||
| 6997 | input Absyn.Operator in_a_op; | ||
| 6998 | |||
| 6999 | output Tpl.Text out_txt; | ||
| 7000 | algorithm | ||
| 7001 | out_txt := | ||
| 7002 | match(in_txt, in_a_op) | ||
| 7003 | local | ||
| 7004 | Tpl.Text txt; | ||
| 7005 | Absyn.Operator i_op; | ||
| 7006 | |||
| 7007 | case ( txt, | ||
| 7008 | Absyn.AND() ) | ||
| 7009 | algorithm | ||
| 7010 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("&&")); | |
| 7011 | then txt; | ||
| 7012 | |||
| 7013 | case ( txt, | ||
| 7014 | Absyn.OR() ) | ||
| 7015 | algorithm | ||
| 7016 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("||")); | |
| 7017 | then txt; | ||
| 7018 | |||
| 7019 | case ( txt, | ||
| 7020 | Absyn.NOT() ) | ||
| 7021 | algorithm | ||
| 7022 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("!")); | |
| 7023 | then txt; | ||
| 7024 | |||
| 7025 | case ( txt, | ||
| 7026 | Absyn.NEQUAL() ) | ||
| 7027 | algorithm | ||
| 7028 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("!=")); | |
| 7029 | then txt; | ||
| 7030 | |||
| 7031 | case ( txt, | ||
| 7032 | i_op ) | ||
| 7033 | algorithm | ||
| 7034 | ✗ | txt := AbsynDumpTpl.dumpOperator(txt, i_op); | |
| 7035 | then txt; | ||
| 7036 | end match; | ||
| 7037 | end dumpOperator; | ||
| 7038 | |||
| 7039 | protected function fun_223 | ||
| 7040 | input Tpl.Text in_txt; | ||
| 7041 | input Absyn.Ident in_a_name; | ||
| 7042 | input Tpl.Text in_a_c__str; | ||
| 7043 | input Tpl.Text in_a_ss__str; | ||
| 7044 | |||
| 7045 | output Tpl.Text out_txt; | ||
| 7046 | algorithm | ||
| 7047 | out_txt := | ||
| 7048 | match(in_txt, in_a_name, in_a_c__str, in_a_ss__str) | ||
| 7049 | local | ||
| 7050 | Tpl.Text txt; | ||
| 7051 | Tpl.Text a_c__str; | ||
| 7052 | Tpl.Text a_ss__str; | ||
| 7053 | Absyn.Ident i_name; | ||
| 7054 | |||
| 7055 | case ( txt, | ||
| 7056 | "List", | ||
| 7057 | a_c__str, | ||
| 7058 | a_ss__str ) | ||
| 7059 | algorithm | ||
| 7060 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("ListUtil")); | |
| 7061 | ✗ | txt := Tpl.writeText(txt, a_ss__str); | |
| 7062 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 7063 | ✗ | txt := Tpl.writeText(txt, a_c__str); | |
| 7064 | then txt; | ||
| 7065 | |||
| 7066 | case ( txt, | ||
| 7067 | "Array", | ||
| 7068 | a_c__str, | ||
| 7069 | a_ss__str ) | ||
| 7070 | algorithm | ||
| 7071 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("ArrayUtil")); | |
| 7072 | ✗ | txt := Tpl.writeText(txt, a_ss__str); | |
| 7073 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 7074 | ✗ | txt := Tpl.writeText(txt, a_c__str); | |
| 7075 | then txt; | ||
| 7076 | |||
| 7077 | case ( txt, | ||
| 7078 | i_name, | ||
| 7079 | a_c__str, | ||
| 7080 | _ ) | ||
| 7081 | algorithm | ||
| 7082 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 7083 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 7084 | ✗ | txt := Tpl.writeText(txt, a_c__str); | |
| 7085 | then txt; | ||
| 7086 | end match; | ||
| 7087 | end fun_223; | ||
| 7088 | |||
| 7089 | protected function fun_224 | ||
| 7090 | input Tpl.Text in_txt; | ||
| 7091 | input Boolean in_mArg; | ||
| 7092 | |||
| 7093 | output Tpl.Text out_txt; | ||
| 7094 | algorithm | ||
| 7095 | out_txt := | ||
| 7096 | match(in_txt, in_mArg) | ||
| 7097 | local | ||
| 7098 | Tpl.Text txt; | ||
| 7099 | |||
| 7100 | case ( txt, | ||
| 7101 | false ) | ||
| 7102 | then txt; | ||
| 7103 | |||
| 7104 | case ( txt, | ||
| 7105 | _ ) | ||
| 7106 | algorithm | ||
| 7107 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("_")); | |
| 7108 | then txt; | ||
| 7109 | end match; | ||
| 7110 | end fun_224; | ||
| 7111 | |||
| 7112 | public function dumpCref | ||
| 7113 | input Tpl.Text in_txt; | ||
| 7114 | input Absyn.ComponentRef in_a_cref; | ||
| 7115 | input MMToJuliaUtil.Context in_a_context; | ||
| 7116 | |||
| 7117 | output Tpl.Text out_txt; | ||
| 7118 | algorithm | ||
| 7119 | out_txt := | ||
| 7120 | match(in_txt, in_a_cref, in_a_context) | ||
| 7121 | local | ||
| 7122 | Tpl.Text txt; | ||
| 7123 | MMToJuliaUtil.Context a_context; | ||
| 7124 | Absyn.Ident i_name; | ||
| 7125 | Absyn.ComponentRef i_componentRef; | ||
| 7126 | list<Absyn.Subscript> i_subscripts; | ||
| 7127 | Boolean ret_2; | ||
| 7128 | Tpl.Text l_c__str; | ||
| 7129 | Tpl.Text l_ss__str; | ||
| 7130 | |||
| 7131 | case ( txt, | ||
| 7132 | Absyn.CREF_QUAL(subscripts = i_subscripts, componentRef = i_componentRef, name = i_name), | ||
| 7133 | a_context ) | ||
| 7134 | algorithm | ||
| 7135 | ✗ | l_ss__str := dumpSubscripts(Tpl.emptyTxt, i_subscripts, a_context); | |
| 7136 | ✗ | l_c__str := dumpCref(Tpl.emptyTxt, i_componentRef, a_context); | |
| 7137 | ✗ | txt := fun_223(txt, i_name, l_c__str, l_ss__str); | |
| 7138 | then txt; | ||
| 7139 | |||
| 7140 | case ( txt, | ||
| 7141 | Absyn.CREF_IDENT(name = i_name, subscripts = i_subscripts), | ||
| 7142 | a_context ) | ||
| 7143 | algorithm | ||
| 7144 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 7145 | ✗ | txt := dumpSubscripts(txt, i_subscripts, a_context); | |
| 7146 | then txt; | ||
| 7147 | |||
| 7148 | case ( txt, | ||
| 7149 | Absyn.CREF_FULLYQUALIFIED(componentRef = i_componentRef), | ||
| 7150 | a_context ) | ||
| 7151 | algorithm | ||
| 7152 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 7153 | ✗ | txt := dumpCref(txt, i_componentRef, a_context); | |
| 7154 | then txt; | ||
| 7155 | |||
| 7156 | case ( txt, | ||
| 7157 | Absyn.WILD(), | ||
| 7158 | _ ) | ||
| 7159 | algorithm | ||
| 7160 | ✗ | ret_2 := Config.acceptMetaModelicaGrammar(); | |
| 7161 | ✗ | txt := fun_224(txt, ret_2); | |
| 7162 | then txt; | ||
| 7163 | |||
| 7164 | case ( txt, | ||
| 7165 | Absyn.ALLWILD(), | ||
| 7166 | _ ) | ||
| 7167 | algorithm | ||
| 7168 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("__")); | |
| 7169 | then txt; | ||
| 7170 | |||
| 7171 | case ( txt, | ||
| 7172 | _, | ||
| 7173 | _ ) | ||
| 7174 | then txt; | ||
| 7175 | end match; | ||
| 7176 | end dumpCref; | ||
| 7177 | |||
| 7178 | protected function lm_226 | ||
| 7179 | input output Tpl.Text txt; | ||
| 7180 | input list<Absyn.Exp> items; | ||
| 7181 | input MMToJuliaUtil.Context a_context; | ||
| 7182 | algorithm | ||
| 7183 | ✗ | for lstElt_226 in items loop | |
| 7184 | txt := match lstElt_226 | ||
| 7185 | local | ||
| 7186 | Absyn.Exp i_arg; | ||
| 7187 | |||
| 7188 | case i_arg | ||
| 7189 | algorithm | ||
| 7190 | ✗ | txt := dumpExp(txt, i_arg, a_context); | |
| 7191 | ✗ | txt := Tpl.nextIter(txt); | |
| 7192 | then txt; | ||
| 7193 | end match; | ||
| 7194 | end for; | ||
| 7195 | end lm_226; | ||
| 7196 | |||
| 7197 | protected function lm_227 | ||
| 7198 | input output Tpl.Text txt; | ||
| 7199 | input list<Absyn.NamedArg> items; | ||
| 7200 | input MMToJuliaUtil.Context a_context; | ||
| 7201 | algorithm | ||
| 7202 | ✗ | for lstElt_227 in items loop | |
| 7203 | txt := match lstElt_227 | ||
| 7204 | local | ||
| 7205 | Absyn.NamedArg i_narg; | ||
| 7206 | |||
| 7207 | case i_narg | ||
| 7208 | algorithm | ||
| 7209 | ✗ | txt := dumpNamedArg(txt, i_narg, a_context); | |
| 7210 | ✗ | txt := Tpl.nextIter(txt); | |
| 7211 | then txt; | ||
| 7212 | end match; | ||
| 7213 | end for; | ||
| 7214 | end lm_227; | ||
| 7215 | |||
| 7216 | protected function fun_228 | ||
| 7217 | input Tpl.Text in_txt; | ||
| 7218 | input list<Absyn.NamedArg> in_a_argNames; | ||
| 7219 | |||
| 7220 | output Tpl.Text out_txt; | ||
| 7221 | algorithm | ||
| 7222 | out_txt := | ||
| 7223 | match(in_txt, in_a_argNames) | ||
| 7224 | local | ||
| 7225 | Tpl.Text txt; | ||
| 7226 | |||
| 7227 | case ( txt, | ||
| 7228 | {} ) | ||
| 7229 | then txt; | ||
| 7230 | |||
| 7231 | case ( txt, | ||
| 7232 | _ ) | ||
| 7233 | algorithm | ||
| 7234 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 7235 | then txt; | ||
| 7236 | end match; | ||
| 7237 | end fun_228; | ||
| 7238 | |||
| 7239 | protected function fun_229 | ||
| 7240 | input Tpl.Text in_txt; | ||
| 7241 | input Boolean in_mArg; | ||
| 7242 | input list<Absyn.NamedArg> in_a_argNames; | ||
| 7243 | |||
| 7244 | output Tpl.Text out_txt; | ||
| 7245 | algorithm | ||
| 7246 | out_txt := | ||
| 7247 | match(in_txt, in_mArg, in_a_argNames) | ||
| 7248 | local | ||
| 7249 | Tpl.Text txt; | ||
| 7250 | list<Absyn.NamedArg> a_argNames; | ||
| 7251 | |||
| 7252 | case ( txt, | ||
| 7253 | true, | ||
| 7254 | _ ) | ||
| 7255 | then txt; | ||
| 7256 | |||
| 7257 | case ( txt, | ||
| 7258 | _, | ||
| 7259 | a_argNames ) | ||
| 7260 | algorithm | ||
| 7261 | ✗ | txt := fun_228(txt, a_argNames); | |
| 7262 | then txt; | ||
| 7263 | end match; | ||
| 7264 | end fun_229; | ||
| 7265 | |||
| 7266 | protected function lm_230 | ||
| 7267 | input output Tpl.Text txt; | ||
| 7268 | input Absyn.ForIterators items; | ||
| 7269 | input MMToJuliaUtil.Context a_context; | ||
| 7270 | algorithm | ||
| 7271 | ✗ | for lstElt_230 in items loop | |
| 7272 | txt := match lstElt_230 | ||
| 7273 | local | ||
| 7274 | Absyn.ForIterator i_i; | ||
| 7275 | |||
| 7276 | case i_i | ||
| 7277 | algorithm | ||
| 7278 | ✗ | txt := dumpForIterator(txt, i_i, a_context); | |
| 7279 | ✗ | txt := Tpl.nextIter(txt); | |
| 7280 | then txt; | ||
| 7281 | end match; | ||
| 7282 | end for; | ||
| 7283 | end lm_230; | ||
| 7284 | |||
| 7285 | protected function lm_231 | ||
| 7286 | input output Tpl.Text txt; | ||
| 7287 | input Absyn.ForIterators items; | ||
| 7288 | input MMToJuliaUtil.Context a_context; | ||
| 7289 | algorithm | ||
| 7290 | ✗ | for lstElt_231 in items loop | |
| 7291 | txt := match lstElt_231 | ||
| 7292 | local | ||
| 7293 | Absyn.ForIterator i_i; | ||
| 7294 | |||
| 7295 | case i_i | ||
| 7296 | algorithm | ||
| 7297 | ✗ | txt := dumpForIteratorName(txt, i_i, a_context); | |
| 7298 | ✗ | txt := Tpl.nextIter(txt); | |
| 7299 | then txt; | ||
| 7300 | end match; | ||
| 7301 | end for; | ||
| 7302 | end lm_231; | ||
| 7303 | |||
| 7304 | protected function lm_232 | ||
| 7305 | input output Tpl.Text txt; | ||
| 7306 | input Absyn.ForIterators items; | ||
| 7307 | input MMToJuliaUtil.Context a_context; | ||
| 7308 | algorithm | ||
| 7309 | ✗ | for lstElt_232 in items loop | |
| 7310 | txt := match lstElt_232 | ||
| 7311 | local | ||
| 7312 | Absyn.ForIterator i_i; | ||
| 7313 | |||
| 7314 | case i_i | ||
| 7315 | algorithm | ||
| 7316 | ✗ | txt := dumpForIteratorRanges(txt, i_i, a_context); | |
| 7317 | ✗ | txt := Tpl.nextIter(txt); | |
| 7318 | then txt; | ||
| 7319 | end match; | ||
| 7320 | end for; | ||
| 7321 | end lm_232; | ||
| 7322 | |||
| 7323 | protected function fun_233 | ||
| 7324 | input Tpl.Text in_txt; | ||
| 7325 | input Absyn.ReductionIterType in_a_iterType; | ||
| 7326 | input Tpl.Text in_a_iter__str; | ||
| 7327 | input Tpl.Text in_a_iter__ranges; | ||
| 7328 | input Tpl.Text in_a_iter__names; | ||
| 7329 | input Tpl.Text in_a_exp__str; | ||
| 7330 | |||
| 7331 | output Tpl.Text out_txt; | ||
| 7332 | algorithm | ||
| 7333 | out_txt := | ||
| 7334 | match(in_txt, in_a_iterType, in_a_iter__str, in_a_iter__ranges, in_a_iter__names, in_a_exp__str) | ||
| 7335 | local | ||
| 7336 | Tpl.Text txt; | ||
| 7337 | Tpl.Text a_iter__str; | ||
| 7338 | Tpl.Text a_iter__ranges; | ||
| 7339 | Tpl.Text a_iter__names; | ||
| 7340 | Tpl.Text a_exp__str; | ||
| 7341 | |||
| 7342 | case ( txt, | ||
| 7343 | Absyn.THREAD(), | ||
| 7344 | _, | ||
| 7345 | a_iter__ranges, | ||
| 7346 | a_iter__names, | ||
| 7347 | a_exp__str ) | ||
| 7348 | algorithm | ||
| 7349 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("@do_threaded_for ")); | |
| 7350 | ✗ | txt := Tpl.writeText(txt, a_exp__str); | |
| 7351 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" (")); | |
| 7352 | ✗ | txt := Tpl.writeText(txt, a_iter__names); | |
| 7353 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(") (")); | |
| 7354 | ✗ | txt := Tpl.writeText(txt, a_iter__ranges); | |
| 7355 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 7356 | then txt; | ||
| 7357 | |||
| 7358 | case ( txt, | ||
| 7359 | _, | ||
| 7360 | a_iter__str, | ||
| 7361 | _, | ||
| 7362 | _, | ||
| 7363 | a_exp__str ) | ||
| 7364 | algorithm | ||
| 7365 | ✗ | txt := Tpl.writeText(txt, a_exp__str); | |
| 7366 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" for ")); | |
| 7367 | ✗ | txt := Tpl.writeText(txt, a_iter__str); | |
| 7368 | then txt; | ||
| 7369 | end match; | ||
| 7370 | end fun_233; | ||
| 7371 | |||
| 7372 | public function dumpFunctionArgs | ||
| 7373 | input Tpl.Text in_txt; | ||
| 7374 | input Absyn.FunctionArgs in_a_args; | ||
| 7375 | input MMToJuliaUtil.Context in_a_context; | ||
| 7376 | |||
| 7377 | output Tpl.Text out_txt; | ||
| 7378 | algorithm | ||
| 7379 | out_txt := | ||
| 7380 | match(in_txt, in_a_args, in_a_context) | ||
| 7381 | local | ||
| 7382 | Tpl.Text txt; | ||
| 7383 | MMToJuliaUtil.Context a_context; | ||
| 7384 | Absyn.ReductionIterType i_iterType; | ||
| 7385 | Absyn.ForIterators i_iterators; | ||
| 7386 | Absyn.Exp i_exp; | ||
| 7387 | list<Absyn.NamedArg> i_argNames; | ||
| 7388 | list<Absyn.Exp> i_args; | ||
| 7389 | Tpl.Text l_iter__ranges; | ||
| 7390 | Tpl.Text l_iter__names; | ||
| 7391 | Tpl.Text l_iter__str; | ||
| 7392 | Tpl.Text l_exp__str; | ||
| 7393 | Boolean ret_3; | ||
| 7394 | Tpl.Text l_separator; | ||
| 7395 | Tpl.Text l_namedargs__str; | ||
| 7396 | Tpl.Text l_args__str; | ||
| 7397 | |||
| 7398 | case ( txt, | ||
| 7399 | Absyn.FUNCTIONARGS(args = i_args, argNames = i_argNames), | ||
| 7400 | a_context ) | ||
| 7401 | algorithm | ||
| 7402 | ✗ | 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())); | |
| 7403 | ✗ | l_args__str := lm_226(l_args__str, i_args, a_context); | |
| 7404 | ✗ | l_args__str := Tpl.popIter(l_args__str); | |
| 7405 | ✗ | l_namedargs__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())); | |
| 7406 | ✗ | l_namedargs__str := lm_227(l_namedargs__str, i_argNames, a_context); | |
| 7407 | ✗ | l_namedargs__str := Tpl.popIter(l_namedargs__str); | |
| 7408 | ✗ | ret_3 := Tpl.isEmpty(l_args__str); | |
| 7409 | ✗ | l_separator := fun_229(Tpl.emptyTxt, ret_3, i_argNames); | |
| 7410 | ✗ | txt := Tpl.writeText(txt, l_args__str); | |
| 7411 | ✗ | txt := Tpl.writeText(txt, l_separator); | |
| 7412 | ✗ | txt := Tpl.writeText(txt, l_namedargs__str); | |
| 7413 | then txt; | ||
| 7414 | |||
| 7415 | case ( txt, | ||
| 7416 | Absyn.FOR_ITER_FARG(exp = i_exp, iterators = i_iterators, iterType = i_iterType), | ||
| 7417 | a_context ) | ||
| 7418 | algorithm | ||
| 7419 | ✗ | l_exp__str := dumpExp(Tpl.emptyTxt, i_exp, a_context); | |
| 7420 | ✗ | l_iter__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())); | |
| 7421 | ✗ | l_iter__str := lm_230(l_iter__str, i_iterators, a_context); | |
| 7422 | ✗ | l_iter__str := Tpl.popIter(l_iter__str); | |
| 7423 | ✗ | l_iter__names := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 7424 | ✗ | l_iter__names := lm_231(l_iter__names, i_iterators, a_context); | |
| 7425 | ✗ | l_iter__names := Tpl.popIter(l_iter__names); | |
| 7426 | ✗ | l_iter__ranges := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 7427 | ✗ | l_iter__ranges := lm_232(l_iter__ranges, i_iterators, a_context); | |
| 7428 | ✗ | l_iter__ranges := Tpl.popIter(l_iter__ranges); | |
| 7429 | ✗ | txt := fun_233(txt, i_iterType, l_iter__str, l_iter__ranges, l_iter__names, l_exp__str); | |
| 7430 | then txt; | ||
| 7431 | |||
| 7432 | case ( txt, | ||
| 7433 | _, | ||
| 7434 | _ ) | ||
| 7435 | then txt; | ||
| 7436 | end match; | ||
| 7437 | end dumpFunctionArgs; | ||
| 7438 | |||
| 7439 | public function dumpNamedArg | ||
| 7440 | input Tpl.Text in_txt; | ||
| 7441 | input Absyn.NamedArg in_a_narg; | ||
| 7442 | input MMToJuliaUtil.Context in_a_context; | ||
| 7443 | |||
| 7444 | output Tpl.Text out_txt; | ||
| 7445 | algorithm | ||
| 7446 | out_txt := | ||
| 7447 | match(in_txt, in_a_narg, in_a_context) | ||
| 7448 | local | ||
| 7449 | Tpl.Text txt; | ||
| 7450 | MMToJuliaUtil.Context a_context; | ||
| 7451 | Absyn.Exp i_argValue; | ||
| 7452 | Absyn.Ident i_argName; | ||
| 7453 | |||
| 7454 | case ( txt, | ||
| 7455 | Absyn.NAMEDARG(argName = i_argName, argValue = i_argValue), | ||
| 7456 | a_context ) | ||
| 7457 | algorithm | ||
| 7458 | ✗ | txt := Tpl.writeStr(txt, i_argName); | |
| 7459 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = ")); | |
| 7460 | ✗ | txt := dumpExp(txt, i_argValue, a_context); | |
| 7461 | then txt; | ||
| 7462 | |||
| 7463 | case ( txt, | ||
| 7464 | _, | ||
| 7465 | _ ) | ||
| 7466 | then txt; | ||
| 7467 | end match; | ||
| 7468 | end dumpNamedArg; | ||
| 7469 | |||
| 7470 | protected function lm_236 | ||
| 7471 | input output Tpl.Text txt; | ||
| 7472 | input Absyn.ForIterators items; | ||
| 7473 | input MMToJuliaUtil.Context a_context; | ||
| 7474 | algorithm | ||
| 7475 | ✗ | for lstElt_236 in items loop | |
| 7476 | txt := match lstElt_236 | ||
| 7477 | local | ||
| 7478 | Absyn.ForIterator i_i; | ||
| 7479 | |||
| 7480 | case i_i | ||
| 7481 | algorithm | ||
| 7482 | ✗ | txt := dumpForIterator(txt, i_i, a_context); | |
| 7483 | ✗ | txt := Tpl.nextIter(txt); | |
| 7484 | then txt; | ||
| 7485 | end match; | ||
| 7486 | end for; | ||
| 7487 | end lm_236; | ||
| 7488 | |||
| 7489 | public function dumpForIterators | ||
| 7490 | input Tpl.Text txt; | ||
| 7491 | input Absyn.ForIterators a_iters; | ||
| 7492 | input MMToJuliaUtil.Context a_context; | ||
| 7493 | |||
| 7494 | output Tpl.Text out_txt; | ||
| 7495 | algorithm | ||
| 7496 | ✗ | out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 7497 | ✗ | out_txt := lm_236(out_txt, a_iters, a_context); | |
| 7498 | ✗ | out_txt := Tpl.popIter(out_txt); | |
| 7499 | end dumpForIterators; | ||
| 7500 | |||
| 7501 | protected function fun_238 | ||
| 7502 | input Tpl.Text in_txt; | ||
| 7503 | input Option<Absyn.Exp> in_a_range; | ||
| 7504 | input MMToJuliaUtil.Context in_a_context; | ||
| 7505 | |||
| 7506 | output Tpl.Text out_txt; | ||
| 7507 | algorithm | ||
| 7508 | out_txt := | ||
| 7509 | match(in_txt, in_a_range, in_a_context) | ||
| 7510 | local | ||
| 7511 | Tpl.Text txt; | ||
| 7512 | MMToJuliaUtil.Context a_context; | ||
| 7513 | Absyn.Exp i_r; | ||
| 7514 | |||
| 7515 | case ( txt, | ||
| 7516 | SOME(i_r), | ||
| 7517 | a_context ) | ||
| 7518 | algorithm | ||
| 7519 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 7520 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("in ")); | |
| 7521 | ✗ | txt := dumpExp(txt, i_r, a_context); | |
| 7522 | ✗ | txt := Tpl.popBlock(txt); | |
| 7523 | then txt; | ||
| 7524 | |||
| 7525 | case ( txt, | ||
| 7526 | _, | ||
| 7527 | _ ) | ||
| 7528 | then txt; | ||
| 7529 | end match; | ||
| 7530 | end fun_238; | ||
| 7531 | |||
| 7532 | protected function fun_239 | ||
| 7533 | input Tpl.Text in_txt; | ||
| 7534 | input Option<Absyn.Exp> in_a_guardExp; | ||
| 7535 | input MMToJuliaUtil.Context in_a_context; | ||
| 7536 | |||
| 7537 | output Tpl.Text out_txt; | ||
| 7538 | algorithm | ||
| 7539 | out_txt := | ||
| 7540 | match(in_txt, in_a_guardExp, in_a_context) | ||
| 7541 | local | ||
| 7542 | Tpl.Text txt; | ||
| 7543 | MMToJuliaUtil.Context a_context; | ||
| 7544 | Absyn.Exp i_g; | ||
| 7545 | |||
| 7546 | case ( txt, | ||
| 7547 | SOME(i_g), | ||
| 7548 | a_context ) | ||
| 7549 | algorithm | ||
| 7550 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 7551 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("if ")); | |
| 7552 | ✗ | txt := dumpExp(txt, i_g, a_context); | |
| 7553 | ✗ | txt := Tpl.popBlock(txt); | |
| 7554 | then txt; | ||
| 7555 | |||
| 7556 | case ( txt, | ||
| 7557 | _, | ||
| 7558 | _ ) | ||
| 7559 | then txt; | ||
| 7560 | end match; | ||
| 7561 | end fun_239; | ||
| 7562 | |||
| 7563 | public function dumpForIterator | ||
| 7564 | input Tpl.Text in_txt; | ||
| 7565 | input Absyn.ForIterator in_a_iterator; | ||
| 7566 | input MMToJuliaUtil.Context in_a_context; | ||
| 7567 | |||
| 7568 | output Tpl.Text out_txt; | ||
| 7569 | algorithm | ||
| 7570 | out_txt := | ||
| 7571 | match(in_txt, in_a_iterator, in_a_context) | ||
| 7572 | local | ||
| 7573 | Tpl.Text txt; | ||
| 7574 | MMToJuliaUtil.Context a_context; | ||
| 7575 | String i_name; | ||
| 7576 | Option<Absyn.Exp> i_guardExp; | ||
| 7577 | Option<Absyn.Exp> i_range; | ||
| 7578 | Tpl.Text l_guard__str; | ||
| 7579 | Tpl.Text l_range__str; | ||
| 7580 | |||
| 7581 | case ( txt, | ||
| 7582 | Absyn.ITERATOR(range = i_range, guardExp = i_guardExp, name = i_name), | ||
| 7583 | a_context ) | ||
| 7584 | algorithm | ||
| 7585 | ✗ | l_range__str := fun_238(Tpl.emptyTxt, i_range, a_context); | |
| 7586 | ✗ | l_guard__str := fun_239(Tpl.emptyTxt, i_guardExp, a_context); | |
| 7587 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 7588 | ✗ | txt := Tpl.writeText(txt, l_range__str); | |
| 7589 | ✗ | txt := Tpl.writeText(txt, l_guard__str); | |
| 7590 | then txt; | ||
| 7591 | |||
| 7592 | case ( txt, | ||
| 7593 | _, | ||
| 7594 | _ ) | ||
| 7595 | then txt; | ||
| 7596 | end match; | ||
| 7597 | end dumpForIterator; | ||
| 7598 | |||
| 7599 | protected function fun_241 | ||
| 7600 | input Tpl.Text in_txt; | ||
| 7601 | input Option<Absyn.Exp> in_a_range; | ||
| 7602 | input MMToJuliaUtil.Context in_a_context; | ||
| 7603 | |||
| 7604 | output Tpl.Text out_txt; | ||
| 7605 | algorithm | ||
| 7606 | out_txt := | ||
| 7607 | match(in_txt, in_a_range, in_a_context) | ||
| 7608 | local | ||
| 7609 | Tpl.Text txt; | ||
| 7610 | MMToJuliaUtil.Context a_context; | ||
| 7611 | Absyn.Exp i_r; | ||
| 7612 | |||
| 7613 | case ( txt, | ||
| 7614 | SOME(i_r), | ||
| 7615 | a_context ) | ||
| 7616 | algorithm | ||
| 7617 | ✗ | txt := dumpExp(txt, i_r, a_context); | |
| 7618 | then txt; | ||
| 7619 | |||
| 7620 | case ( txt, | ||
| 7621 | _, | ||
| 7622 | _ ) | ||
| 7623 | then txt; | ||
| 7624 | end match; | ||
| 7625 | end fun_241; | ||
| 7626 | |||
| 7627 | protected function fun_242 | ||
| 7628 | input Tpl.Text in_txt; | ||
| 7629 | input Option<Absyn.Exp> in_a_guardExp; | ||
| 7630 | input MMToJuliaUtil.Context in_a_context; | ||
| 7631 | |||
| 7632 | output Tpl.Text out_txt; | ||
| 7633 | algorithm | ||
| 7634 | out_txt := | ||
| 7635 | match(in_txt, in_a_guardExp, in_a_context) | ||
| 7636 | local | ||
| 7637 | Tpl.Text txt; | ||
| 7638 | MMToJuliaUtil.Context a_context; | ||
| 7639 | Absyn.Exp i_g; | ||
| 7640 | |||
| 7641 | case ( txt, | ||
| 7642 | SOME(i_g), | ||
| 7643 | a_context ) | ||
| 7644 | algorithm | ||
| 7645 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 7646 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("if ")); | |
| 7647 | ✗ | txt := dumpExp(txt, i_g, a_context); | |
| 7648 | ✗ | txt := Tpl.popBlock(txt); | |
| 7649 | then txt; | ||
| 7650 | |||
| 7651 | case ( txt, | ||
| 7652 | _, | ||
| 7653 | _ ) | ||
| 7654 | then txt; | ||
| 7655 | end match; | ||
| 7656 | end fun_242; | ||
| 7657 | |||
| 7658 | public function dumpForIteratorRanges | ||
| 7659 | input Tpl.Text in_txt; | ||
| 7660 | input Absyn.ForIterator in_a_iterator; | ||
| 7661 | input MMToJuliaUtil.Context in_a_context; | ||
| 7662 | |||
| 7663 | output Tpl.Text out_txt; | ||
| 7664 | algorithm | ||
| 7665 | out_txt := | ||
| 7666 | match(in_txt, in_a_iterator, in_a_context) | ||
| 7667 | local | ||
| 7668 | Tpl.Text txt; | ||
| 7669 | MMToJuliaUtil.Context a_context; | ||
| 7670 | Option<Absyn.Exp> i_guardExp; | ||
| 7671 | Option<Absyn.Exp> i_range; | ||
| 7672 | Tpl.Text l_guard__str; | ||
| 7673 | Tpl.Text l_range__str; | ||
| 7674 | |||
| 7675 | case ( txt, | ||
| 7676 | Absyn.ITERATOR(range = i_range, guardExp = i_guardExp), | ||
| 7677 | a_context ) | ||
| 7678 | algorithm | ||
| 7679 | ✗ | l_range__str := fun_241(Tpl.emptyTxt, i_range, a_context); | |
| 7680 | ✗ | l_guard__str := fun_242(Tpl.emptyTxt, i_guardExp, a_context); | |
| 7681 | ✗ | txt := Tpl.writeText(txt, l_range__str); | |
| 7682 | ✗ | txt := Tpl.writeText(txt, l_guard__str); | |
| 7683 | then txt; | ||
| 7684 | |||
| 7685 | case ( txt, | ||
| 7686 | _, | ||
| 7687 | _ ) | ||
| 7688 | then txt; | ||
| 7689 | end match; | ||
| 7690 | end dumpForIteratorRanges; | ||
| 7691 | |||
| 7692 | protected function fun_244 | ||
| 7693 | input Tpl.Text in_txt; | ||
| 7694 | input Absyn.ForIterator in_a_iterator; | ||
| 7695 | |||
| 7696 | output Tpl.Text out_txt; | ||
| 7697 | algorithm | ||
| 7698 | out_txt := | ||
| 7699 | match(in_txt, in_a_iterator) | ||
| 7700 | local | ||
| 7701 | Tpl.Text txt; | ||
| 7702 | String i_name; | ||
| 7703 | |||
| 7704 | case ( txt, | ||
| 7705 | Absyn.ITERATOR(name = i_name) ) | ||
| 7706 | algorithm | ||
| 7707 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 7708 | then txt; | ||
| 7709 | |||
| 7710 | case ( txt, | ||
| 7711 | _ ) | ||
| 7712 | then txt; | ||
| 7713 | end match; | ||
| 7714 | end fun_244; | ||
| 7715 | |||
| 7716 | public function dumpForIteratorName | ||
| 7717 | input Tpl.Text txt; | ||
| 7718 | input Absyn.ForIterator a_iterator; | ||
| 7719 | input MMToJuliaUtil.Context a_context; | ||
| 7720 | |||
| 7721 | output Tpl.Text out_txt; | ||
| 7722 | algorithm | ||
| 7723 | ✗ | out_txt := fun_244(txt, a_iterator); | |
| 7724 | end dumpForIteratorName; | ||
| 7725 | |||
| 7726 | protected function lm_246 | ||
| 7727 | input output Tpl.Text txt; | ||
| 7728 | input list<Absyn.ElementItem> items; | ||
| 7729 | algorithm | ||
| 7730 | ✗ | for lstElt_246 in items loop | |
| 7731 | txt := match lstElt_246 | ||
| 7732 | local | ||
| 7733 | Absyn.ElementItem i_e; | ||
| 7734 | Option<Absyn.TypeSpec> ret_0; | ||
| 7735 | |||
| 7736 | case i_e | ||
| 7737 | algorithm | ||
| 7738 | ✗ | ret_0 := AbsynUtil.getTypeSpecFromElementItemOpt(i_e); | |
| 7739 | ✗ | txt := dumpTypeSpecOpt(txt, ret_0, MMToJuliaUtil.functionContext); | |
| 7740 | ✗ | txt := Tpl.nextIter(txt); | |
| 7741 | then txt; | ||
| 7742 | end match; | ||
| 7743 | end for; | ||
| 7744 | end lm_246; | ||
| 7745 | |||
| 7746 | public function dumpOutputsJL | ||
| 7747 | input Tpl.Text txt; | ||
| 7748 | input list<Absyn.ElementItem> a_elements; | ||
| 7749 | |||
| 7750 | output Tpl.Text out_txt; | ||
| 7751 | protected | ||
| 7752 | list<Absyn.ElementItem> ret_1; | ||
| 7753 | Tpl.Text l_outputStr; | ||
| 7754 | algorithm | ||
| 7755 | ✗ | ret_1 := listReverse(a_elements); | |
| 7756 | ✗ | l_outputStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 7757 | ✗ | l_outputStr := lm_246(l_outputStr, ret_1); | |
| 7758 | ✗ | l_outputStr := Tpl.popIter(l_outputStr); | |
| 7759 | ✗ | out_txt := Tpl.writeText(txt, l_outputStr); | |
| 7760 | end dumpOutputsJL; | ||
| 7761 | |||
| 7762 | annotation(__OpenModelica_Interface="backend_tools"); | ||
| 7763 | end AbsynToJulia; | ||
| 7764 |