forked from Beuchey/OCL_Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reader.py
34 lines (25 loc) · 1.19 KB
/
reader.py
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
from pyecoreocl.compiler import dummy_compiler
expression = "let x = Set{0, 1..15} in x->select(e | e > 0)->collect(e | e + 4)"
print(dummy_compiler(expression))
expression = "Sequence{0, 1..15}->select(e | e > 0)->collect(e | e + 4)"
print(dummy_compiler(expression))
expression = "Set{}->isEmpty(4)"
print(dummy_compiler(expression))
expression = "len(x, (y+4) * 3)"
print(dummy_compiler(expression))
expression = "a.b.c.d(45)"
print(dummy_compiler(expression))
expression = "let x = Tuple{foo='abc'} in x.foo"
print(dummy_compiler(expression))
expression = "ParameterDirectionKind::inout"
print(dummy_compiler(expression))
expression = """(if nestingClass > null then null
else
let b:BehavioredClassifier = self.behavioredClassifier(self.owner) in
if b.oclIsKindOf(Behavior) and b.oclAsType(Behavior).context > null then
b.oclAsType(Behavior).context
else b endif endif)"""
print(dummy_compiler(expression))
expression = """Extension.allInstances()->select(ext | let endTypes : Sequence(Classifier) = ext.memberEnd->collect(e | e.type.oclAsType(Classifier)) in
endTypes->includes(self) or endTypes.allParents()->includes(self))"""
print(dummy_compiler(expression))