Skip to content

Commit 30bbad8

Browse files
committed
Changes
1 parent 0cf5739 commit 30bbad8

File tree

2 files changed

+124
-120
lines changed

2 files changed

+124
-120
lines changed

queries/haskell.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ module Main where
44
main :: IO ()
55
main = putStrLn "Hello, World!"
66

7+
-- RFC: What should `argumentOrParameter` match?
8+
fst :: (a, b) -> a
9+
fst tup@(x, y) = x
10+
-- ^^^^^^^^^^ <- 1️⃣ the whole pattern
11+
-- ^^^ <- 2️⃣ only the name of the whole argument, if given
12+
-- ^^^ ^ ^ <- 3️⃣ all names in the pattern

queries/haskell.scm

Lines changed: 118 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
; argumentOrParameter
22
; "arg" function parameter or function call argument
3-
;;!! sum xs = foldr (+) 0 xs
4-
;;! ^^
53
(haskell
64
(function
75
patterns: (patterns
@@ -46,15 +44,25 @@
4644

4745
; className
4846
; "class name" the name in a class declaration
49-
(haskell
50-
(class
51-
(class_head
52-
class: (class_name
53-
(type) @className
54-
)
55-
)
56-
)
57-
)
47+
; (haskell
48+
; (class
49+
; (class_head
50+
; class: (class_name
51+
; (type) @className
52+
; )
53+
; )
54+
; )
55+
; )
56+
; instance name
57+
; (haskell
58+
; (instance
59+
; (instance_head
60+
; (class_name
61+
; (type) @name
62+
; )
63+
; )
64+
; )
65+
; )
5866

5967
; class
6068
; "class" class definition
@@ -68,33 +76,33 @@
6876
; functionName
6977
; "funk name" the name in a function declaration
7078
; function name
71-
(haskell
72-
(function
73-
name: (_) @functionName
74-
)
75-
)
79+
; (haskell
80+
; (function
81+
; name: (_) @functionName
82+
; )
83+
; )
7684
; foreign import name
77-
(haskell
78-
(foreign_import
79-
(signature
80-
(_) @name
81-
)
82-
)
83-
)
85+
; (haskell
86+
; (foreign_import
87+
; (signature
88+
; (_) @name
89+
; )
90+
; )
91+
; )
8492
; foreign export name
85-
(haskell
86-
(foreign_export
87-
(signature
88-
(_) @name
89-
)
90-
)
91-
)
93+
; (haskell
94+
; (foreign_export
95+
; (signature
96+
; (_) @name
97+
; )
98+
; )
99+
; )
92100

93101
; namedFunction
94102
; "funk" name function declaration
95-
(haskell
96-
(function) @namedFunction
97-
)
103+
(function
104+
rhs: (_) @namedFunction.interior
105+
) @namedFunction
98106

99107
; ifStatement
100108
; "if state" if statement
@@ -120,112 +128,97 @@
120128
; collectionItem
121129
; "item" an entry in a map / object / list
122130
; record item
123-
(exp_field
124-
field: (_)
125-
(_) @collectionItem
126-
)
131+
; (exp_field
132+
; field: (_)
133+
; (_) @collectionItem
134+
; )
127135

128136
; collectionKey
129137
; "key" key in a map / object
130138
; record key
131-
(exp_field
132-
field: (_) @collectionKey
133-
; TODO: handle subfields
134-
)
135-
(exp_projection_selector
136-
(_) @collectionKey
137-
; TODO: handle subfields
138-
)
139+
; (exp_field
140+
; field: (_) @collectionKey
141+
; ; TODO: handle subfields
142+
; )
143+
; (exp_projection_selector
144+
; (_) @collectionKey
145+
; ; TODO: handle subfields
146+
; )
139147

140148
; name
141149
; "name" the name in a declaration (eg function name)
142150
; function name
143-
(haskell
144-
(function
145-
name: (_) @name
146-
)
147-
)
151+
; (haskell
152+
; (function
153+
; name: (_) @name
154+
; )
155+
; )
148156
; foreign function import
149-
(haskell
150-
(foreign_import
151-
(signature
152-
(_) @name
153-
)
154-
)
155-
)
157+
; (haskell
158+
; (foreign_import
159+
; (signature
160+
; (_) @name
161+
; )
162+
; )
163+
; )
156164
; foreign function export
157-
(haskell
158-
(foreign_export
159-
(signature
160-
(_) @name
161-
)
162-
)
163-
)
165+
; (haskell
166+
; (foreign_export
167+
; (signature
168+
; (_) @name
169+
; )
170+
; )
171+
; )
164172
; data type name
165-
(haskell
166-
(adt
167-
(type) @name
168-
)
169-
)
173+
; (haskell
174+
; (adt
175+
; (type) @name
176+
; )
177+
; )
170178
; new type name
171-
(haskell
172-
(newtype
173-
(type) @name
174-
)
175-
)
179+
; (haskell
180+
; (newtype
181+
; (type) @name
182+
; )
183+
; )
176184
; type alias name
177-
(haskell
178-
(type_alias
179-
(type) @name
180-
)
181-
)
185+
; (haskell
186+
; (type_alias
187+
; (type) @name
188+
; )
189+
; )
182190
; type family name
183-
(haskell
184-
(type_family
185-
(head
186-
(type) @name
187-
)
188-
)
189-
)
191+
; (haskell
192+
; (type_family
193+
; (head
194+
; (type) @name
195+
; )
196+
; )
197+
; )
190198
; class name
191-
(haskell
192-
(class
193-
(class_head
194-
class: (class_name
195-
(type) @name
196-
)
197-
)
198-
)
199-
)
199+
; (haskell
200+
; (class
201+
; (class_head
202+
; class: (class_name
203+
; (type) @name
204+
; )
205+
; )
206+
; )
207+
; )
200208
; instance name
201-
(haskell
202-
(instance
203-
(instance_head
204-
(class_name
205-
(type) @name
206-
)
207-
)
208-
)
209-
)
210-
211-
; instance
212-
; <no spoken form>
213-
; instance name
214-
(haskell
215-
(instance
216-
(instance_head
217-
(class_name
218-
(type) @name
219-
)
220-
)
221-
)
222-
)
209+
; (haskell
210+
; (instance
211+
; (instance_head
212+
; (class_name
213+
; (type) @name
214+
; )
215+
; )
216+
; )
217+
; )
223218

224219
; statement
225220
; "state" a statement, eg let foo
226-
(exp_do
227-
(stmt) @statement
228-
)
221+
(stmt) @statement
229222
; TODO: let clause?
230223
; TODO: where clause?
231224

@@ -235,6 +228,11 @@
235228

236229
; type
237230
; "type" a type annotation or declaration
231+
(haskell
232+
(type_alias
233+
(_) @type.interior .
234+
) @type
235+
)
238236

239237
; value
240238
; "value" a value eg in a map / object, return statement, etc

0 commit comments

Comments
 (0)