-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentity.tx
41 lines (34 loc) · 841 Bytes
/
entity.tx
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
/*
Entity DSL grammar.
*/
EntityModel:
types*=SimpleType // At the beginning of model we can define
// zero or more simple types.
entities+=Entity // Each model has one or more entities.
;
Entity:
'entity' name=ID '{'
properties+=Property // Each entity has one or more properties.
'}'
;
Array:
'array' name=ID '['
values*=[Type]
']'
;
Property:
name=ID ':' type=[Type] // type is a reference to Type instance.
// There are two built-in simple types
// registered on meta-model in entity_test.py
;
// Type can be SimpleType or Entity
Type:
SimpleType | Entity
;
SimpleType:
'type' name=ID
;
// Special rule for comments. Comments start with //
Comment:
/\/\/.*$/
;