Changeset fc625e4 in OpenModelica
- Timestamp:
- 2014-05-26T16:32:51+02:00 (10 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 768e0be4
- Parents:
- 6166857e
- Location:
- Compiler/Template
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Compiler/Template/AbsynDumpTpl.mo
r52852791 rfc625e4 3721 3721 Absyn.EQ_EQUALS(leftSide = i_leftSide, rightSide = i_rightSide) ) 3722 3722 equation 3723 l_lhs = dump Exp(Tpl.emptyTxt, i_leftSide);3723 l_lhs = dumpLhsExp(Tpl.emptyTxt, i_leftSide); 3724 3724 l_rhs = dumpExp(Tpl.emptyTxt, i_rightSide); 3725 3725 txt = Tpl.writeText(txt, l_lhs); … … 4077 4077 Absyn.ALG_ASSIGN(assignComponent = i_assignComponent, value = i_value) ) 4078 4078 equation 4079 l_lhs__str = dump Exp(Tpl.emptyTxt, i_assignComponent);4079 l_lhs__str = dumpLhsExp(Tpl.emptyTxt, i_assignComponent); 4080 4080 l_rhs__str = dumpExp(Tpl.emptyTxt, i_value); 4081 4081 txt = Tpl.writeText(txt, l_lhs__str); … … 4942 4942 end dumpExp; 4943 4943 4944 protected function fun_142 4944 public function dumpLhsExp 4945 input Tpl.Text in_txt; 4946 input Absyn.Exp in_a_lhs; 4947 4948 output Tpl.Text out_txt; 4949 algorithm 4950 out_txt := 4951 match(in_txt, in_a_lhs) 4952 local 4953 Tpl.Text txt; 4954 Absyn.Exp i_lhs; 4955 4956 case ( txt, 4957 (i_lhs as Absyn.IFEXP(ifExp = _)) ) 4958 equation 4959 txt = Tpl.writeTok(txt, Tpl.ST_STRING("(")); 4960 txt = dumpExp(txt, i_lhs); 4961 txt = Tpl.writeTok(txt, Tpl.ST_STRING(")")); 4962 then txt; 4963 4964 case ( txt, 4965 i_lhs ) 4966 equation 4967 txt = dumpExp(txt, i_lhs); 4968 then txt; 4969 end match; 4970 end dumpLhsExp; 4971 4972 protected function fun_143 4945 4973 input Tpl.Text in_txt; 4946 4974 input Boolean in_mArg; … … 4971 4999 then txt; 4972 5000 end match; 4973 end fun_14 2;5001 end fun_143; 4974 5002 4975 5003 public function dumpOperand … … 4986 5014 l_op__str := dumpExp(Tpl.emptyTxt, a_operand); 4987 5015 ret_1 := Dump.shouldParenthesize(a_operand, a_operation, a_lhs); 4988 out_txt := fun_14 2(txt, ret_1, l_op__str);5016 out_txt := fun_143(txt, ret_1, l_op__str); 4989 5017 end dumpOperand; 4990 5018 … … 5030 5058 end dumpIfExp; 5031 5059 5032 protected function lm_14 55060 protected function lm_146 5033 5061 input Tpl.Text in_txt; 5034 5062 input list<tuple<Absyn.Exp, Absyn.Exp>> in_items; … … 5062 5090 txt = Tpl.popBlock(txt); 5063 5091 txt = Tpl.nextIter(txt); 5064 txt = lm_14 5(txt, rest);5065 then txt; 5066 end match; 5067 end lm_14 5;5092 txt = lm_146(txt, rest); 5093 then txt; 5094 end match; 5095 end lm_146; 5068 5096 5069 5097 public function dumpElseIfExp … … 5074 5102 algorithm 5075 5103 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())); 5076 out_txt := lm_14 5(out_txt, a_else__if);5104 out_txt := lm_146(out_txt, a_else__if); 5077 5105 out_txt := Tpl.popIter(out_txt); 5078 5106 end dumpElseIfExp; 5079 5107 5080 protected function fun_14 75108 protected function fun_148 5081 5109 input Tpl.Text in_txt; 5082 5110 input Boolean in_a_boolean; … … 5099 5127 then txt; 5100 5128 end match; 5101 end fun_14 7;5102 5103 protected function fun_14 85129 end fun_148; 5130 5131 protected function fun_149 5104 5132 input Tpl.Text in_txt; 5105 5133 input Boolean in_a_boolean; … … 5122 5150 then txt; 5123 5151 end match; 5124 end fun_14 8;5125 5126 protected function fun_1 495152 end fun_149; 5153 5154 protected function fun_150 5127 5155 input Tpl.Text in_txt; 5128 5156 input Boolean in_a_boolean; … … 5145 5173 then txt; 5146 5174 end match; 5147 end fun_1 49;5175 end fun_150; 5148 5176 5149 5177 public function dumpCodeNode … … 5184 5212 Absyn.C_CONSTRAINTSECTION(boolean = i_boolean, equationItemLst = i_equationItemLst) ) 5185 5213 equation 5186 l_initial__str = fun_14 7(Tpl.emptyTxt, i_boolean);5214 l_initial__str = fun_148(Tpl.emptyTxt, i_boolean); 5187 5215 l_eql__str = dumpEquationItems(Tpl.emptyTxt, i_equationItemLst); 5188 5216 txt = Tpl.writeText(txt, l_initial__str); … … 5196 5224 Absyn.C_EQUATIONSECTION(boolean = i_boolean, equationItemLst = i_equationItemLst) ) 5197 5225 equation 5198 l_initial__str = fun_14 8(Tpl.emptyTxt, i_boolean);5226 l_initial__str = fun_149(Tpl.emptyTxt, i_boolean); 5199 5227 l_eql__str = dumpEquationItems(Tpl.emptyTxt, i_equationItemLst); 5200 5228 txt = Tpl.writeText(txt, l_initial__str); … … 5208 5236 Absyn.C_ALGORITHMSECTION(boolean = i_boolean, algorithmItemLst = i_algorithmItemLst) ) 5209 5237 equation 5210 l_initial__str = fun_1 49(Tpl.emptyTxt, i_boolean);5238 l_initial__str = fun_150(Tpl.emptyTxt, i_boolean); 5211 5239 l_algs__str = dumpAlgorithmItems(Tpl.emptyTxt, i_algorithmItemLst); 5212 5240 txt = Tpl.writeText(txt, l_initial__str); … … 5241 5269 end dumpCodeNode; 5242 5270 5243 protected function lm_15 15271 protected function lm_152 5244 5272 input Tpl.Text in_txt; 5245 5273 input list<Absyn.Case> in_items; … … 5263 5291 txt = dumpMatchCase(txt, i_c); 5264 5292 txt = Tpl.nextIter(txt); 5265 txt = lm_15 1(txt, rest);5266 then txt; 5267 end match; 5268 end lm_15 1;5293 txt = lm_152(txt, rest); 5294 then txt; 5295 end match; 5296 end lm_152; 5269 5297 5270 5298 public function dumpMatchExp … … 5299 5327 "\n" 5300 5328 }, true)), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); 5301 l_cases__str = lm_15 1(l_cases__str, i_cases);5329 l_cases__str = lm_152(l_cases__str, i_cases); 5302 5330 l_cases__str = Tpl.popIter(l_cases__str); 5303 5331 l_cmt__str = dumpStringCommentOption(Tpl.emptyTxt, i_comment); … … 5352 5380 end dumpMatchType; 5353 5381 5354 protected function lm_15 45382 protected function lm_155 5355 5383 input Tpl.Text in_txt; 5356 5384 input list<Absyn.ElementItem> in_items; … … 5374 5402 txt = dumpElementItem(txt, i_decl); 5375 5403 txt = Tpl.nextIter(txt); 5376 txt = lm_15 4(txt, rest);5377 then txt; 5378 end match; 5379 end lm_15 4;5404 txt = lm_155(txt, rest); 5405 then txt; 5406 end match; 5407 end lm_155; 5380 5408 5381 5409 public function dumpMatchLocals … … 5401 5429 txt = Tpl.pushBlock(txt, Tpl.BT_INDENT(4)); 5402 5430 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())); 5403 txt = lm_15 4(txt, i_locals);5431 txt = lm_155(txt, i_locals); 5404 5432 txt = Tpl.popIter(txt); 5405 5433 txt = Tpl.softNewLine(txt); … … 5410 5438 end dumpMatchLocals; 5411 5439 5412 protected function lm_15 65440 protected function lm_157 5413 5441 input Tpl.Text in_txt; 5414 5442 input list<Absyn.EquationItem> in_items; … … 5432 5460 txt = dumpEquationItem(txt, i_eq); 5433 5461 txt = Tpl.nextIter(txt); 5434 txt = lm_15 6(txt, rest);5435 then txt; 5436 end match; 5437 end lm_15 6;5462 txt = lm_157(txt, rest); 5463 then txt; 5464 end match; 5465 end lm_157; 5438 5466 5439 5467 public function dumpMatchEquations … … 5462 5490 txt = Tpl.pushBlock(txt, Tpl.BT_INDENT(4)); 5463 5491 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())); 5464 txt = lm_15 6(txt, i_eql);5492 txt = lm_157(txt, i_eql); 5465 5493 txt = Tpl.popIter(txt); 5466 5494 txt = Tpl.popBlock(txt); … … 5469 5497 end dumpMatchEquations; 5470 5498 5471 protected function fun_15 85499 protected function fun_159 5472 5500 input Tpl.Text in_txt; 5473 5501 input Option<Absyn.Exp> in_a_patternGuard; … … 5493 5521 then txt; 5494 5522 end match; 5495 end fun_15 8;5496 5497 protected function fun_1 595523 end fun_159; 5524 5525 protected function fun_160 5498 5526 input Tpl.Text in_txt; 5499 5527 input Tpl.Text in_a_eql__str; … … 5529 5557 then txt; 5530 5558 end match; 5531 end fun_1 59;5559 end fun_160; 5532 5560 5533 5561 public function dumpMatchCase … … 5557 5585 equation 5558 5586 l_pattern__str = dumpExp(Tpl.emptyTxt, i_pattern); 5559 l_guard__str = fun_15 8(Tpl.emptyTxt, i_patternGuard);5587 l_guard__str = fun_159(Tpl.emptyTxt, i_patternGuard); 5560 5588 l_eql__str = dumpMatchEquations(Tpl.emptyTxt, i_equations); 5561 5589 l_result__str = dumpExp(Tpl.emptyTxt, i_result); 5562 l_then__str = fun_1 59(Tpl.emptyTxt, l_eql__str, l_result__str);5590 l_then__str = fun_160(Tpl.emptyTxt, l_eql__str, l_result__str); 5563 5591 l_cmt__str = dumpStringCommentOption(Tpl.emptyTxt, i_comment); 5564 5592 txt = Tpl.writeTok(txt, Tpl.ST_STRING("case ")); … … 5732 5760 end dumpOperator; 5733 5761 5734 protected function fun_16 25762 protected function fun_163 5735 5763 input Tpl.Text in_txt; 5736 5764 input Boolean in_mArg; … … 5753 5781 then txt; 5754 5782 end match; 5755 end fun_16 2;5783 end fun_163; 5756 5784 5757 5785 public function dumpCref … … 5797 5825 equation 5798 5826 ret_0 = Config.acceptMetaModelicaGrammar(); 5799 txt = fun_16 2(txt, ret_0);5827 txt = fun_163(txt, ret_0); 5800 5828 then txt; 5801 5829 … … 5812 5840 end dumpCref; 5813 5841 5814 protected function lm_16 45842 protected function lm_165 5815 5843 input Tpl.Text in_txt; 5816 5844 input list<Absyn.Exp> in_items; … … 5834 5862 txt = dumpExp(txt, i_arg); 5835 5863 txt = Tpl.nextIter(txt); 5836 txt = lm_16 4(txt, rest);5837 then txt; 5838 end match; 5839 end lm_16 4;5840 5841 protected function lm_16 55864 txt = lm_165(txt, rest); 5865 then txt; 5866 end match; 5867 end lm_165; 5868 5869 protected function lm_166 5842 5870 input Tpl.Text in_txt; 5843 5871 input list<Absyn.NamedArg> in_items; … … 5861 5889 txt = dumpNamedArg(txt, i_narg); 5862 5890 txt = Tpl.nextIter(txt); 5863 txt = lm_16 5(txt, rest);5864 then txt; 5865 end match; 5866 end lm_16 5;5867 5868 protected function fun_16 65891 txt = lm_166(txt, rest); 5892 then txt; 5893 end match; 5894 end lm_166; 5895 5896 protected function fun_167 5869 5897 input Tpl.Text in_txt; 5870 5898 input list<Absyn.NamedArg> in_a_argNames; … … 5887 5915 then txt; 5888 5916 end match; 5889 end fun_16 6;5890 5891 protected function fun_16 75917 end fun_167; 5918 5919 protected function fun_168 5892 5920 input Tpl.Text in_txt; 5893 5921 input Tpl.Text in_a_args__str; … … 5911 5939 a_argNames ) 5912 5940 equation 5913 txt = fun_16 6(txt, a_argNames);5914 then txt; 5915 end match; 5916 end fun_16 7;5917 5918 protected function lm_16 85941 txt = fun_167(txt, a_argNames); 5942 then txt; 5943 end match; 5944 end fun_168; 5945 5946 protected function lm_169 5919 5947 input Tpl.Text in_txt; 5920 5948 input Absyn.ForIterators in_items; … … 5938 5966 txt = dumpForIterator(txt, i_i); 5939 5967 txt = Tpl.nextIter(txt); 5940 txt = lm_16 8(txt, rest);5941 then txt; 5942 end match; 5943 end lm_16 8;5968 txt = lm_169(txt, rest); 5969 then txt; 5970 end match; 5971 end lm_169; 5944 5972 5945 5973 public function dumpFunctionArgs … … 5967 5995 equation 5968 5996 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())); 5969 l_args__str = lm_16 4(l_args__str, i_args);5997 l_args__str = lm_165(l_args__str, i_args); 5970 5998 l_args__str = Tpl.popIter(l_args__str); 5971 5999 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())); 5972 l_namedargs__str = lm_16 5(l_namedargs__str, i_argNames);6000 l_namedargs__str = lm_166(l_namedargs__str, i_argNames); 5973 6001 l_namedargs__str = Tpl.popIter(l_namedargs__str); 5974 l_separator = fun_16 7(Tpl.emptyTxt, l_args__str, i_argNames);6002 l_separator = fun_168(Tpl.emptyTxt, l_args__str, i_argNames); 5975 6003 txt = Tpl.writeText(txt, l_args__str); 5976 6004 txt = Tpl.writeText(txt, l_separator); … … 5983 6011 l_exp__str = dumpExp(Tpl.emptyTxt, i_exp); 5984 6012 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())); 5985 l_iter__str = lm_16 8(l_iter__str, i_iterators);6013 l_iter__str = lm_169(l_iter__str, i_iterators); 5986 6014 l_iter__str = Tpl.popIter(l_iter__str); 5987 6015 txt = Tpl.writeText(txt, l_exp__str); … … 6023 6051 end dumpNamedArg; 6024 6052 6025 protected function lm_17 16053 protected function lm_172 6026 6054 input Tpl.Text in_txt; 6027 6055 input Absyn.ForIterators in_items; … … 6045 6073 txt = dumpForIterator(txt, i_i); 6046 6074 txt = Tpl.nextIter(txt); 6047 txt = lm_17 1(txt, rest);6048 then txt; 6049 end match; 6050 end lm_17 1;6075 txt = lm_172(txt, rest); 6076 then txt; 6077 end match; 6078 end lm_172; 6051 6079 6052 6080 public function dumpForIterators … … 6057 6085 algorithm 6058 6086 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())); 6059 out_txt := lm_17 1(out_txt, a_iters);6087 out_txt := lm_172(out_txt, a_iters); 6060 6088 out_txt := Tpl.popIter(out_txt); 6061 6089 end dumpForIterators; 6062 6090 6063 protected function fun_17 36091 protected function fun_174 6064 6092 input Tpl.Text in_txt; 6065 6093 input Option<Absyn.Exp> in_a_range; … … 6086 6114 then txt; 6087 6115 end match; 6088 end fun_17 3;6089 6090 protected function fun_17 46116 end fun_174; 6117 6118 protected function fun_175 6091 6119 input Tpl.Text in_txt; 6092 6120 input Option<Absyn.Exp> in_a_guardExp; … … 6113 6141 then txt; 6114 6142 end match; 6115 end fun_17 4;6143 end fun_175; 6116 6144 6117 6145 public function dumpForIterator … … 6134 6162 Absyn.ITERATOR(range = i_range, guardExp = i_guardExp, name = i_name) ) 6135 6163 equation 6136 l_range__str = fun_17 3(Tpl.emptyTxt, i_range);6137 l_guard__str = fun_17 4(Tpl.emptyTxt, i_guardExp);6164 l_range__str = fun_174(Tpl.emptyTxt, i_range); 6165 l_guard__str = fun_175(Tpl.emptyTxt, i_guardExp); 6138 6166 txt = Tpl.writeStr(txt, i_name); 6139 6167 txt = Tpl.writeText(txt, l_guard__str); -
Compiler/Template/AbsynDumpTpl.tpl
rf30c28d rfc625e4 539 539 >> 540 540 case EQ_EQUALS(__) then 541 let lhs = dump Exp(leftSide)541 let lhs = dumpLhsExp(leftSide) 542 542 let rhs = dumpExp(rightSide) 543 543 '<%lhs%> = <%rhs%>' … … 600 600 match alg 601 601 case ALG_ASSIGN(__) then 602 let lhs_str = dump Exp(assignComponent)602 let lhs_str = dumpLhsExp(assignComponent) 603 603 let rhs_str = dumpExp(value) 604 604 '<%lhs_str%> := <%rhs_str%>' … … 803 803 end dumpExp; 804 804 805 template dumpLhsExp(Absyn.Exp lhs) 806 ::= 807 match lhs 808 case IFEXP(__) then '(<%dumpExp(lhs)%>)' 809 else dumpExp(lhs) 810 end dumpLhsExp; 811 805 812 template dumpOperand(Absyn.Exp operand, Absyn.Exp operation, Boolean lhs) 806 813 ::= -
Compiler/Template/DAEDumpTpl.tpl
rffd0ca1 rfc625e4 612 612 template dumpEquation(DAE.Exp lhs, DAE.Exp rhs, DAE.ElementSource src) 613 613 ::= 614 let lhs_str = dumpExp(lhs)614 let lhs_str = match lhs case IFEXP(__) then '(<%dumpExp(lhs)%>)' else dumpExp(lhs) 615 615 let rhs_str = dumpExp(rhs) 616 616 let src_str = dumpSource(src) … … 813 813 template dumpAssignment(DAE.Exp lhs, DAE.Exp rhs, DAE.ElementSource src) 814 814 ::= 815 let lhs_str = dumpExp(lhs)815 let lhs_str = match lhs case IFEXP(__) then '(<%dumpExp(lhs)%>)' else dumpExp(lhs) 816 816 let rhs_str = dumpExp(rhs) 817 817 let src_str = dumpSource(src) -
Compiler/Template/SCodeDumpTpl.tpl
rf30c28d rfc625e4 279 279 case EQ_IF(__) then dumpIfEEquation(equation, options) 280 280 case EQ_EQUALS(__) then 281 let lhs_str = AbsynDumpTpl.dump Exp(expLeft)281 let lhs_str = AbsynDumpTpl.dumpLhsExp(expLeft) 282 282 let rhs_str = AbsynDumpTpl.dumpExp(expRight) 283 283 let cmt_str = dumpComment(comment, options) … … 416 416 match statement 417 417 case ALG_ASSIGN(__) then 418 let lhs_str = AbsynDumpTpl.dump Exp(assignComponent)418 let lhs_str = AbsynDumpTpl.dumpLhsExp(assignComponent) 419 419 let rhs_str = AbsynDumpTpl.dumpExp(value) 420 420 let cmt_str = dumpComment(comment, options)
Note: See TracChangeset
for help on using the changeset viewer.