Skip to content

Commit 3d55452

Browse files
authored
Improved scripts
1 parent 9d72b9c commit 3d55452

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

cg/cobol2UML.cstl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,6 +2318,7 @@ MOVE _1 |-->_1
23182318

23192319
moveToStatement::
23202320
_1 TO _2 |--> _2 := StringLib.leftAlignInto("" + _1, _2`fieldWidth);\n<when> _1 String
2321+
_1 TO _2 |--> _2 := StringLib.padLeftWithInto("" + _1, " ", _2`fieldWidth);\n<when> _1 real, _2 String
23212322
_1 TO _2 |--> _2 := _1 ;\n
23222323
_1 TO _2 _* |--> (var _moveTmp : OclAny ; _moveTmp := _1;\n _2 := _moveTmp;\n_*`moveAssignments skip) ; \n
23232324

cg/mathocl2mamba.cstl

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ formula::
4949
Define _1 |-->
5050
Define _1 = _2 |-->\n\n function double _1`operationName(_1`operationParameters)\n { return _2; }
5151
Define _1 ~ _2 |-->
52+
Define _1 : _2 |-->
53+
Define _1 : _2 = _3 |-->\n\n function _2 _1`operationName(_1`operationParameters)\n { return _3; }
5254

5355

5456
operationName::
@@ -101,15 +103,18 @@ _1 , _* |-->_1,_*`recurse
101103

102104

103105
type::
104-
Sequence ( _1 ) |-->Sequence(_1)
105-
Set ( _1 ) |-->Set(_1)
106-
OrderedSet ( _1 ) |-->OrderedSet(_1)
107-
Bag ( _1 ) |-->Bag(_1)
108-
Map ( _1 , _2 ) |-->Map(_1,_2)
109-
Function ( _1 , _2 ) |-->Function(_1,_2)
106+
Sequence ( _1 ) |-->Array[_1]
107+
Set ( _1 ) |-->Collection[_1]
108+
OrderedSet ( _1 ) |-->Array[_1]
109+
Bag ( _1 ) |-->Array[_1]
110+
Map ( _1 , _2 ) |-->Dictionary[_1,_2]
111+
Function ( _1 , _2 ) |-->Func[_1,_2]
110112
� |-->int
111113
� |-->int
112114
� |-->double
115+
boolean |-->bool
116+
String |-->string
117+
Date |-->OclDate
113118
_1 |-->_1
114119

115120

@@ -351,6 +356,13 @@ max ( _1 ) |-->(_1).Max(x => x)
351356
Binomial ( _1 ) |-->excel.Binom_Dist_Range(_1`third,_1`last,_1`first,_1`third)
352357

353358
var ( _1 ) |-->_1.variance()
359+
Date ( _1 ) |-->OclDate.newOclDate_String(_1)
360+
Time ( _1 ) |-->OclDate.newOclDate_Time(_1)
361+
362+
accumulatedInterest ( _1 ) |-->financeLib.accumulatedInterest(_1)
363+
Binomial ( _1 ) |-->excel.Binom_Dist_Range(_1`third,_1`last,_1`first,_1`third)
364+
bondPrice ( _1 ) |-->financeLib.bondPrice(_1)
365+
bondPriceClean ( _1 ) |-->financeLib.bondPriceClean(_1)
354366

355367
_1 ( _2 ) |-->_1(_2)
356368
_1 ( ) |-->_1()

cg/python2UML.cstl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,11 +1786,13 @@ _* |-->
17861786

17871787

17881788
classdef::
1789-
class _1 ( _2 ) : _3 |-->class _1 extends _2 {\n static operation new_1() : _1\n pre: true post: true\n activity: var $x : _1 := create_1(); return $x;\n\n_3`classcontent}\n\n<action> _1 Class
1789+
class _1 ( Enum ) : _3 |-->class _1 {\n static operation new_1() : _1\n pre: true post: true\n activity: var _x : _1 := create_1(); return _x;\n\n_3`classcontent}\n\n<action> _1 Class
17901790

1791-
class _1 ( ) : _2 |-->class _1 {\n static operation new_1() : _1\n pre: true post: true\n activity: var $x : _1 := create_1(); return $x;\n\n_2`classcontent}\n\n<action> _1 Class
1791+
class _1 ( _2 ) : _3 |-->class _1 extends _2 {\n static operation new_1() : _1\n pre: true post: true\n activity: var _x : _1 := create_1(); return _x;\n\n_3`classcontent}\n\n<action> _1 Class
17921792

1793-
class _1 : _2 |-->class _1 {\n static operation new_1() : _1\n pre: true post: true\n activity: var $x : _1 := create_1(); return $x;\n\n_2`classcontent}\n\n<action> _1 Class
1793+
class _1 ( ) : _2 |-->class _1 {\n static operation new_1() : _1\n pre: true post: true\n activity: var _x : _1 := create_1(); return _x;\n\n_2`classcontent}\n\n<action> _1 Class
1794+
1795+
class _1 : _2 |-->class _1 {\n static operation new_1() : _1\n pre: true post: true\n activity: var _x : _1 := create_1(); return _x;\n\n_2`classcontent}\n\n<action> _1 Class
17941796

17951797

17961798
classcontent::

cg/restructure.cstl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,36 @@ return |-->return
88
continue |-->continue
99
break |-->break
1010
var _1 : _2 |-->var _1 : _2
11+
var _1 : _2 := _3 |-->var _1 : _2 := _3
12+
13+
if true then _1 else _2 |-->_1
14+
if false then _1 else _2 |-->_2
15+
if _1 then _2 else _2 |-->_2
1116

1217
if _1 then _2 else skip |-->if _1 then _2 else skip
1318
if _1 then _2 else _3 |-->if _1 then _2 else skip; _3<when> _2`endsWithReturn true
1419
if _1 then _2 else _3 |-->if _1 then _2 else _3
1520

16-
21+
while false do _1 |-->skip
1722
while _1 do _2 |-->while _1 do _2
1823
for _1 : _2 do _3 |-->for _1 : _2 do _3
1924
return _1 |-->return _1
2025
_1 := _2 |-->_1 := _2
26+
27+
skip ; _1 |-->_1
28+
_1 ; skip |-->_1
29+
return ; _1 |-->return
30+
continue ; _1 |-->continue
31+
break ; _1 |-->break
32+
2133
_1 ; _2 |-->_1 ; _2
2234
execute _1 |-->execute _1
2335
call _1 |-->call _1
36+
( skip ) |-->skip
2437
( _1 ) |-->(_1)
2538

39+
40+
2641
recursiveCall::
2742
skip |-->
2843
return |-->

0 commit comments

Comments
 (0)