-
Notifications
You must be signed in to change notification settings - Fork 0
/
Append.atl
67 lines (59 loc) · 1.27 KB
/
Append.atl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-- @path append=/fma.interpreter.atl/src/test/resources/fma/atl/inplace/append/Append.ecore
module append;
create OUT: append refining IN: append;
rule Append {
from a1 : append!Append (
a1.active and a1.this.val <> a1.x
and a1.this.next.oclIsUndefined()
) using {
c1 : append!Cell = a1.this;
} to a1__ref : append!Append (
x <- '',
active <- false,
return <- true
),
c2 : append!Cell (
val <- a1.x
),
c1__ref : append!Cell (
next <- c2
)
}
rule Next {
from a1 : append!Append (
a1.active=true and a1.x <> a1.this.val
and a1.callee.oclIsUndefined()
) using {
c : append!Cell = a1.this.next;
} to a1__ref : append!Append (
active <- false,
x <- '',
callee <- a2
),
a2 : append!Append (
active <- true,
x <- a1.x,
this <- c
)
}
rule Found {
from a1 : append!Append (
a1.active and a1.x = a1.this.val
) to a1__ref : append!Append (
x <- '',
active <- false,
return <- true
)
}
rule Return {
from a1 : append!Append (
a1.return = true and
not(a1.caller.oclIsUndefined())
and a1.callee.oclIsUndefined()
) using {
caller : append!Append = a1.caller;
} to caller__ref : append!Append (
return <- true,
callee__unset <- a1
)
}