-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgrammar.json
52 lines (52 loc) · 1.75 KB
/
grammar.json
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
{ "name": "toylang"
, "scopeName": "source.toy"
, "fileTypes": [ ".toy" ]
, "patterns":
[ { "include": "#comment" }
, { "include": "#colon" }
, { "include": "#eqdef" }
, { "include": "#type" }
, { "include": "#expression" }
]
, "repository":
{ "expression":
{ "patterns":
[ { "include": "#type" }
, { "include": "#number" }
, { "include": "#plus" }
, { "include": "#boolean" }
, { "include": "#color" }
, { "include": "#paren-expression" }
, { "include": "#variable" }
]
}
, "type":
{ "patterns":
[ { "include": "#arrow" }
, { "include": "#basetype" }
]
}
, "colon": { "match": "[:]" , "name": "keyword.other" }
, "eqdef": { "match": "[=]" , "name": "keyword.other" }
, "color": { "match": "#[a-zA-Z-]*" , "name": "constant.other" }
, "number": { "match": "\\b([0-9]+)" , "name": "constant.numeric" }
, "arrow": { "match": "->" , "name": "keyword.operator" }
, "plus": { "match": "[+]" , "name": "keyword.operator" }
, "variable": { "match": "\\b([a-zA-Z_][a-zA-Z_'-]*)" , "name": "variable" }
, "basetype": { "match": "\\b((Nat)|(Bool)|(Color))" , "name": "storage.type" }
, "boolean": { "match": "\\b((True)|(False))" , "name": "constant.language" }
, "comment":
{ "name": "comment.line.double-dash"
, "begin": "--"
, "end": "\n"
}
, "paren-expression":
{ "begin": "\\("
, "end": "\\)"
, "beginCaptures": { "0": { "name": "punctuation.paren.open" } }
, "endCaptures": { "0": { "name": "punctuation.paren.close" } }
, "name": "expression.group"
, "patterns": [ { "include": "#expression" } ]
}
}
}