forked from CBothwell/language-ocaml
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
45 lines (30 loc) · 953 Bytes
/
main.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
exports.activate = function() {
if (!atom.grammars.addInjectionPoint) return
atom.grammars.addInjectionPoint('source.menhir', {
type: 'ocaml',
language: (node) => 'ocaml',
content: (node) => node
})
atom.grammars.addInjectionPoint('source.menhir', {
type: 'ocaml_type',
language: (node) => 'ocaml',
content: (node) => node
})
atom.grammars.addInjectionPoint('source.ocamllex', {
type: 'lexer_definition',
language: (node) => 'ocaml',
content: (node) => node.children
.filter((child) => child.type == 'action')
.map((node) => node.children[1])
})
atom.grammars.addInjectionPoint('source.ocamllex', {
type: 'refill_handler',
language: (node) => 'ocaml',
content: (node) => node.children[2]
})
atom.grammars.addInjectionPoint('source.ocamllex', {
type: 'lexer_case',
language: (node) => 'ocaml',
content: (node) => node.lastChild.children[1]
})
}