|
1 |
| -((exp_apply |
| 1 | +((apply |
2 | 2 | .
|
3 |
| - (exp_name) |
| 3 | + function: (_) |
4 | 4 | .
|
5 | 5 | (_) @call.inner._start
|
6 | 6 | .
|
|
9 | 9 | (_)? @call.inner._end .)
|
10 | 10 | ) @call.outer
|
11 | 11 |
|
12 |
| -(exp_infix |
| 12 | +(infix |
13 | 13 | (_)
|
14 |
| - (variable) |
| 14 | + [ |
| 15 | + (infix_id |
| 16 | + (variable)) ; x `plus` y |
| 17 | + (operator) ; x + y |
| 18 | + ] |
15 | 19 | (_)) @call.outer
|
16 | 20 |
|
17 |
| -(function |
18 |
| - rhs: (_) @function.inner) @function.outer |
| 21 | +(decl/function) @function.outer |
| 22 | + |
| 23 | +(decl/function |
| 24 | + patterns: (_) |
| 25 | + . |
| 26 | + match: (_) @function.inner._start |
| 27 | + match: (_)? @function.inner._end |
| 28 | + . |
| 29 | + ) |
19 | 30 |
|
20 | 31 | ; also treat function signature as @function.outer
|
21 | 32 | (signature) @function.outer
|
22 | 33 |
|
| 34 | +; treat signature with function as @function.outer |
| 35 | +(((decl/signature |
| 36 | + name: (_) @_sig_name) @function.outer._start |
| 37 | + . |
| 38 | + (decl/function |
| 39 | + name: (_) @_func_name) @function.outer._end) |
| 40 | + (#eq? @_sig_name @_func_name) |
| 41 | + ) |
| 42 | + |
23 | 43 | (class) @class.outer
|
24 | 44 |
|
25 | 45 | (class
|
26 |
| - (class_body |
27 |
| - (where) |
28 |
| - _ @class.inner)) |
| 46 | + "where" |
| 47 | + _ @class.inner) |
29 | 48 |
|
30 | 49 | (instance
|
31 |
| - (where)? |
| 50 | + "where"? |
32 | 51 | .
|
33 | 52 | _ @class.inner) @class.outer
|
34 | 53 |
|
35 | 54 | (comment) @comment.outer
|
36 | 55 |
|
37 |
| -(exp_cond) @conditional.outer |
| 56 | +(haddock) @comment.outer |
38 | 57 |
|
39 |
| -(exp_cond |
| 58 | +(expression/conditional) @conditional.outer |
| 59 | + |
| 60 | +(expression/conditional |
40 | 61 | (_) @conditional.inner)
|
41 | 62 |
|
42 | 63 | ; e.g. forM [1..10] $ \i -> do...
|
43 |
| -(exp_infix |
44 |
| - (exp_apply |
45 |
| - (exp_name) @_name |
| 64 | +(infix |
| 65 | + (apply |
| 66 | + (name) @_name |
46 | 67 | (#any-of? @_name "for" "for_" "forM" "forM_"))
|
47 | 68 | (operator) @_op
|
48 | 69 | (#eq? @_op "$")
|
49 |
| - (exp_lambda |
| 70 | + (lambda |
50 | 71 | (_)
|
51 | 72 | (_) @loop.inner)) @loop.outer
|
52 | 73 |
|
53 | 74 | ; e.g. forM [1..10] print
|
54 |
| -(exp_apply |
55 |
| - (exp_name) @_name |
| 75 | +(apply |
| 76 | + (name) @_name |
56 | 77 | (#any-of? @_name "for" "for_" "forM" "forM_")
|
57 | 78 | (_)
|
58 | 79 | (_) @loop.inner) @loop.outer
|
|
65 | 86 | ; e.g. func mb@(Just x)
|
66 | 87 | (function
|
67 | 88 | (patterns
|
68 |
| - (pat_parens |
| 89 | + (parens |
69 | 90 | (_) @parameter.inner)))
|
70 | 91 |
|
71 | 92 | (function
|
72 | 93 | (patterns
|
73 |
| - (pat_as |
74 |
| - (pat_parens |
| 94 | + (as |
| 95 | + (parens |
75 | 96 | (_) @parameter.inner))))
|
76 | 97 |
|
77 | 98 | (signature
|
78 | 99 | (context
|
79 |
| - (fun |
80 |
| - (type_apply) @parameter.inner))) |
| 100 | + (function |
| 101 | + (type/apply) @parameter.inner))) |
81 | 102 |
|
82 | 103 | (signature
|
83 | 104 | (context
|
84 |
| - (fun |
85 |
| - (type_name) @parameter.inner))) |
| 105 | + (function |
| 106 | + (type/name) @parameter.inner))) |
86 | 107 |
|
87 | 108 | (signature
|
88 |
| - (fun |
89 |
| - (type_apply) @parameter.inner)) |
| 109 | + (function |
| 110 | + (type/apply) @parameter.inner)) |
90 | 111 |
|
91 | 112 | (signature
|
92 |
| - (fun |
93 |
| - (type_name) @parameter.inner)) |
| 113 | + (function |
| 114 | + (type/name) @parameter.inner)) |
94 | 115 |
|
95 | 116 | (signature
|
96 |
| - (type_apply) @parameter.inner) |
| 117 | + (type/apply) @parameter.inner) |
97 | 118 |
|
98 | 119 | (signature
|
99 |
| - (type_name) @parameter.inner) |
| 120 | + (type/name) @parameter.inner) |
| 121 | + |
0 commit comments