-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathmatchup.scm
46 lines (37 loc) · 1.42 KB
/
matchup.scm
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
; inherits: quote
; --------------- types ---------------
(type_arguments
"<" @open.typeargs
">" @close.typeargs) @scope.typeargs
(type_parameters
"<" @open.typeparams
">" @open.typeparams) @scope.typeparams
; --------------- if/else ---------------
(block (if_expression "if" @open.if_) @scope.if_)
(expression_statement (if_expression "if" @open.if_) @scope.if_)
(let_declaration (if_expression "if" @open.if_) @scope.if_)
(else_clause "else" @mid.if_.1 (block))
(else_clause
"else" @_start (if_expression "if" @_end)
(#make-range! "mid.if_.2" @_start @_end))
; --------------- async/await ---------------
(function_item (function_modifiers "async" @open.async)) @scope.async
(async_block "async" @open.async) @scope.async
(await_expression "await" @mid.async.1)
; --------------- fn/return ---------------
(function_item
"fn" @open.function) @scope.function
(closure_expression) @scope.function
(return_expression
"return" @mid.function.1)
; --------------- closures ---------------
(closure_parameters
"|" @open.closureparams
"|" @close.closureparams) @scope.closureparams
; --------------- while/loop/for + break/continue ---------------
(for_expression . "for" @open.loop) @scope.loop
(while_expression . "while" @open.loop) @scope.loop
(loop_expression . "loop" @open.loop) @scope.loop
(break_expression "break" @mid.loop.1 .)
(break_expression "break" @mid.loop.1 .)
(continue_expression "continue" @mid.loop.1 .)