File tree Expand file tree Collapse file tree 1 file changed +29
-12
lines changed Expand file tree Collapse file tree 1 file changed +29
-12
lines changed Original file line number Diff line number Diff line change 1
1
;; Statements
2
2
3
- [
4
- (binding)
5
- ] @statement
3
+ ;; Any top-level expression that isn't a comment is a statement
4
+ (
5
+ (source_code
6
+ (_) @statement
7
+ ) @_.iteration
8
+ (#not-type? @statement comment)
9
+ )
10
+ (source_code) @comment.iteration
11
+
12
+ ;; Any foo = <expression> anywhere is a statement
13
+ (binding) @statement
14
+ (binding_set) @map.iteration @list.iteration @ifStatement.iteration
15
+
6
16
;; This matches assert statements as stand-alone statements. This
7
17
;; is because it's common to have a series of assert statements in a file, which
8
18
;; would otherwise all match as a single statement. See the playground/nix/asserts.nix
9
19
;; file for an example.
10
- (assert_expression
11
- "assert" @statement.start
12
- condition: (_) @condition
13
- ";" @statement.end
14
- ) @_.domain
15
- (binding_set) @map.iteration @list.iteration @ifStatement.iteration
16
- (source_code) @statement.iteration @map.iteration @comment.iteration
20
+ (
21
+ (assert_expression
22
+ "assert" @statement.start
23
+ condition: (_) @condition
24
+ ";" @statement.end
25
+ body: (_)
26
+ ) @_.domain
27
+ (#not-parent-type? @_.domain binding)
28
+ )
17
29
18
30
;; !! let
19
31
;; !! a = 1;
95
107
;; ! ^^^^^^^^ Func1 due to currying
96
108
;; ! ^^^^^^^^^^^ Func2 due to currying
97
109
(function_expression
98
- universal: (identifier) @argumentOrParameter
110
+ [
111
+ ;; Match a: style arg
112
+ (identifier)
113
+ ;; Match { a, b }: style
114
+ (formals)
115
+ ] @argumentOrParameter
99
116
body: (_) @anonymousFunction.interior
100
- ) @anonymousFunction @argumentOrParameter.iteration
117
+ ) @_.domain @ anonymousFunction @argumentOrParameter.iteration
101
118
102
119
;; We define the named function as the full assignment of the lambda
103
120
;; This means funk name becomes the variable holding the lambda
You can’t perform that action at this time.
0 commit comments