-
Notifications
You must be signed in to change notification settings - Fork 0
/
RM.ohm.js
119 lines (97 loc) · 2.59 KB
/
RM.ohm.js
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
export default
`RM {
Model = name AttributeList? Contained<Schema*>
Schema = name AttributeList? Contained<Table*>
Table = name AttributeList? Dependency*
AttributeList = Contained<ListOf<Attribute, ",">>
Dependency = arity? dependency_glyph arity? PrimaryKeyOrUnique? Reference Optional? RoundContained<ReferenceName>?
Attribute = RegularAttribute
| Dependency
RegularAttribute = PrimaryKeyOrUnique? name Optional? Type? Constraint?
PrimaryKeyOrUnique = PrimaryKey
| Unique
PrimaryKey = "@"
Unique = "!"
Optional = "?"
Type = List
| Set
List = SquareContained<ListOf<Value, ",">>
Set = Contained<ListOf<Value, ",">>
Value = digit+
| CContained<"'", name, "'">
Constraint = Operator Check
Operator = ">"
| "<"
| ">="
| "<="
| "=="
| "<>"
| "!="
Check = CheckName
| CheckNumber
CheckName = name
CheckNumber = number
Reference = SchemaTableName
| TableName
ReferenceName = name
SchemaTableName = name "." name
TableName = name
Contained<element> = CContained<"{", element, "}">
SquareContained<element> = CContained<"[", element, "]">
RoundContained<element> = CContained<"(", element, ")">
CContained<open, element, close> = open element close
name = first_character additional_character*
first_character = letter | "_"
additional_character = first_character | alnum
arity = "*" | "+" | number
dependency_glyph = "->"
number = digit+
}
RM_PGSQL <: RM {
Type := List
| Set
| SQLType
SQLType = "bigint"
| "smallint"
| "integer"
| "real"
| "double precision"
| "smallserial"
| "serial"
| "bigserial"
| "money"
| "blob"
| "bytea"
| "boolean"
| "text"
| "timestamp"
| "date"
| "time"
| "interval"
| "point"
| "line"
| "lseq"
| "box"
| "path"
| "polygon"
| "circle"
| "cidr"
| "inet"
| "macaddr"
| "json"
| "jsonb"
| "int4range"
| "int8range"
| "numrange"
| "tsrange"
| "tstzrange"
| "daterange"
| Numeric
| VarChar
Numeric = numeric RoundContained<NumericParameters>?
NumericParameters = Precision OptionalScale?
Precision = number
OptionalScale = "," number
numeric = "numeric" | "decimal"
VarChar = "varchar" RoundContained<number>?
}`;