forked from eclipse-archived/triquetrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTqcl.xtext
91 lines (58 loc) · 1.46 KB
/
Tqcl.xtext
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
grammar org.eclipse.triquetrum.commands.Tqcl with org.eclipse.xtext.common.Terminals
generate tqcl "http://www.eclipse.org/triquetrum/commands/Tqcl"
TriquetrumScript:
libraries+=Library*
commands+=Command*
;
CompositeCommand:
start = GoInto commands+=Command* (end = (GoOut|GoTop))
;
SimpleCommand returns Command:
(Insert|Connect|Set|Include)";"
;
Command returns Command:
SimpleCommand|CompositeCommand
;
Include:
"include" filename=STRING ";"
;
Library:
"library" name=ID ";"
;
Insert:
"insert" (category=Category)? entityClass=ENTITY_CLASS 'as' name=STRING ("with" parameters+=(Parameter) ("," parameters+=Parameter)*)? ;
Set:
"set" param = Parameter
;
Connect:
"connect" from+=ConnectionPort(',' from+=ConnectionPort)* "to" to+=ConnectionPort(',' to+=ConnectionPort)*;
ConnectionPort:
actor=[Insert] '.' port=NamedObj;
GoInto returns Go:
"go" direction="into" actor = [Insert]
;
GoOut returns Go:
"go" direction="out"
;
GoTop returns Go:
"go" direction="top"
;
enum Category:
actor | parameter | port | director;
Parameter:
id=Parameter_id "=" value=STRING;
Parameter_id:
PARAMETER_NAME|STRING
;
terminal PARAMETER_NAME:
'$'('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
;
NamedObj:
(ID | STRING)
;
terminal ENTITY_CLASS:
('<'->'>')
;
//terminal fragment ESCAPED_CHAR:
// '\\' ('n'|'t'|'r'|'\\');
//terminal ENTITY_INSTANCE_NAME: '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|ESCAPED_CHAR)*;