Errors.connect 2.66 KB
Newer Older
René Schöne's avatar
René Schöne committed
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
68
69
70
71
72
// --- update read definitions ---
// Error: there must not be two read definitions for the same token
read B.DoubledValue ;
read B.DoubledValue using IntToInt ;

// NOT HANDLED \\ Error: the token must be resolvable within the parent type
// NOT HANDLED \\ read B.NonExisting ;

// Error: the Token must not be a TokenNTA (i.e., check for !Token.getNTA())
read B.ErrorNTA ;

// Error: from-type of first mapping must be byte[] or a supported primitive type
read B.ErrorTypeOfFirstMapping using ListToList ;

// Error: to-type of last mapping must be type of the Token
read B.ErrorTypeOfLastMapping using StringToList ;

// Error: types of mappings must match (modulo inheritance)
read B.ErrorTypeMismatch using StringToList, IntToInt ;

// --- update write definitions ---
// NOT HANDLED \\ Error: the token must be resolvable within the parent type
// NOT HANDLED \\ read C.NonExisting ;

// Error: Token must be a TokenNTA (i.e., check for Token.getNTA())
write C.ErrorNotNTA ;

// Error: from-type of first mapping must be type of Token
write C.ErrorTypeOfFirstMapping using IntToInt ;

// Error: to-type of last mapping must be byte[] or a supported primitive type
write C.ErrorTypeOfLastMapping1 using StringToList ;
write C.ErrorTypeOfLastMapping2 ;

// Error: types of mappings must match (modulo inheritance)
write C.ErrorTypeMismatch using StringToList, IntToInt ;

// Error: no more than one write mapping for each TokenComponent
write C.DoubledValue ;
write C.DoubledValue using IntToInt ;

// --- dependency definitions ---
// NOT HANDLED \\ Error: Both, source and target must be resolvable within the parent type
// NOT HANDLED \\ D.SourceNonExistingTarget canDependOn D.NonExisting as NonExistingTarget ;
// NOT HANDLED \\ D.NonExisting canDependOn D.TargetNonExistingSource as NonExistingSource ;

// Error: There must be a write update definition for the target token
D.SourceNoWriteDef canDependOn D.TargetNoWriteDef as NoWriteDef ;

// Error: The name of a dependency definition must not be equal to a list-node on the source
D.SourceSameAsListNode canDependOn D.TargetSameAsListNode as MyList ;
write D.TargetSameAsListNode;

// Error: There must not be two dependency definitions with the same name
D.SourceDoubledValue canDependOn D.TargetDoubledValue as DoubledValue ;
D.SourceDoubledValue canDependOn D.TargetDoubledValue as DoubledValue ;
write D.TargetDoubledValue;

// --- mapping definitions ---
ListToList maps java.util.List<String> list to java.util.List<String> {:
  return list;
:}

StringToList maps String s to List<String> {:
  java.util.List<String> result = new java.util.ArrayList<>();
  result.add(s);
  return result;
:}

IntToInt maps int number to int {:
  return number + 1;
:}