]> git.wincent.com - docvim.git/blob - tests/fixtures/parser/integration-ferret-private.golden
Fix duplicate content
[docvim.git] / tests / fixtures / parser / integration-ferret-private.golden
1 Project
2   [ Project
3       [ Unit
4           [ FunctionDeclaration
5               { functionBang = True
6               , functionName = "s:delete"
7               , functionArguments =
8                   ArgumentList [ Argument "first" , Argument "last" ]
9               , functionAttributes = []
10               , functionBody =
11                   [ LetStatement { letLexpr = "l:list" , letValue = "getqflist()" }
12                   , LetStatement { letLexpr = "l:line" , letValue = "a:first" }
13                   , GenericStatement "while l:line >= a:first && l:line <= a:last"
14                   , LetStatement { letLexpr = "l:list[l:line - 1]" , letValue = "0" }
15                   , LetStatement { letLexpr = "l:line" , letValue = "l:line + 1" }
16                   , GenericStatement "endwhile"
17                   , GenericStatement "call setqflist(l:list, 'r')"
18                   , GenericStatement "execute 'cc ' . a:first"
19                   , GenericStatement "execute \"normal \\<C-W>\\<C-P>\""
20                   ]
21               }
22           , FunctionDeclaration
23               { functionBang = True
24               , functionName = "s:dispatch"
25               , functionArguments = ArgumentList []
26               , functionAttributes = []
27               , functionBody =
28                   [ DocBlock []
29                   , LetStatement
30                       { letLexpr = "l:dispatch"
31                       , letValue = "get(g:, 'FerretDispatch', 1)"
32                       }
33                   , GenericStatement "return l:dispatch && exists(':Make') == 2"
34                   ]
35               }
36           , FunctionDeclaration
37               { functionBang = True
38               , functionName = "s:error"
39               , functionArguments = ArgumentList [ Argument "message" ]
40               , functionAttributes = [ "abort" ]
41               , functionBody =
42                   [ GenericStatement "call inputsave()"
43                   , GenericStatement "echohl ErrorMsg"
44                   , GenericStatement
45                       "call input(a:message . ': press ENTER to continue')"
46                   , GenericStatement "echohl NONE"
47                   , GenericStatement "call inputrestore()"
48                   , GenericStatement "echo"
49                   ]
50               }
51           , FunctionDeclaration
52               { functionBang = True
53               , functionName = "s:parse"
54               , functionArguments = ArgumentList [ Argument "arg" ]
55               , functionAttributes = [ "abort" ]
56               , functionBody =
57                   [ GenericStatement "if exists('g:ferret_lastsearch')"
58                   , UnletStatement
59                       { unletBang = False , unletBody = "g:ferret_lastsearch" }
60                   , GenericStatement "endif"
61                   , LetStatement
62                       { letLexpr = "l:escaped_spaces_replaced_with_markers"
63                       , letValue = "substitute(a:arg, '\\\\ ', '<!!S!!>', 'g')"
64                       }
65                   , LetStatement
66                       { letLexpr = "l:split_on_spaces"
67                       , letValue = "split(l:escaped_spaces_replaced_with_markers)"
68                       }
69                   , LetStatement { letLexpr = "l:expanded_args" , letValue = "[]" }
70                   , GenericStatement "for l:arg in l:split_on_spaces"
71                   , GenericStatement "if l:arg =~# '^-'"
72                   , GenericStatement "call add(l:expanded_args, l:arg)"
73                   , GenericStatement "elseif exists('g:ferret_lastsearch')"
74                   , LetStatement
75                       { letLexpr = "l:file_args"
76                       , letValue =
77                           "glob(l:arg, 1, 1) \" Ignore 'wildignore', return a list."
78                       }
79                   , GenericStatement "if len(l:file_args)"
80                   , GenericStatement "call extend(l:expanded_args, l:file_args)"
81                   , GenericStatement "else"
82                   , GenericStatement "call add(l:expanded_args, l:arg)"
83                   , GenericStatement "endif"
84                   , GenericStatement "else"
85                   , LetStatement
86                       { letLexpr = "g:ferret_lastsearch"
87                       , letValue = "substitute(l:arg, '<!!S!!>', ' ', 'g')"
88                       }
89                   , GenericStatement "call add(l:expanded_args, l:arg)"
90                   , GenericStatement "endif"
91                   , GenericStatement "endfor"
92                   , LetStatement
93                       { letLexpr = "l:each_word_shell_escaped"
94                       , letValue = "map(l:expanded_args, 'shellescape(v:val)')"
95                       }
96                   , LetStatement
97                       { letLexpr = "l:joined"
98                       , letValue = "join(l:each_word_shell_escaped)"
99                       }
100                   , GenericStatement
101                       "return substitute(l:joined, '<!!S!!>', ' ', 'g')"
102                   ]
103               }
104           , FunctionDeclaration
105               { functionBang = True
106               , functionName = "ferret#private#post"
107               , functionArguments = ArgumentList [ Argument "type" ]
108               , functionAttributes = [ "abort" ]
109               , functionBody =
110                   [ GenericStatement "if has('autocmd')"
111                   , GenericStatement "augroup FerretPostQF"
112                   , GenericStatement "autocmd!"
113                   , GenericStatement "augroup END"
114                   , GenericStatement "endif"
115                   , LetStatement
116                       { letLexpr = "l:lastsearch "
117                       , letValue = "get(g:, 'ferret_lastsearch', '')"
118                       }
119                   , LetStatement
120                       { letLexpr = "l:qflist "
121                       , letValue = "a:type == 'qf' ? getqflist() : getloclist(0)"
122                       }
123                   , LetStatement
124                       { letLexpr = "l:tip "
125                       , letValue = "' [see `:help ferret-quotes`]'"
126                       }
127                   , GenericStatement "if len(l:qflist) == 0"
128                   , LetStatement
129                       { letLexpr = "l:base "
130                       , letValue =
131                           "'No results for search pattern `' . l:lastsearch . '`'"
132                       }
133                   , GenericStatement
134                       "if l:lastsearch =~ '\\v^([' . \"'\" . '\"])[^ \\1]+\\1$'"
135                   , GenericStatement "call s:error(l:base . l:tip)"
136                   , GenericStatement "else"
137                   , GenericStatement "call s:error(l:base)"
138                   , GenericStatement "endif"
139                   , GenericStatement "else"
140                   , LetStatement
141                       { letLexpr = "l:invalid "
142                       , letValue = "filter(copy(l:qflist), 'v:val.valid == 0')"
143                       }
144                   , GenericStatement "if len(l:invalid) == len(l:qflist)"
145                   , GenericStatement "redraw!"
146                   , GenericStatement "echohl ErrorMsg"
147                   , GenericStatement "for l:item in l:invalid"
148                   , GenericStatement "echomsg l:item.text"
149                   , GenericStatement "endfor"
150                   , GenericStatement "echohl NONE"
151                   , LetStatement
152                       { letLexpr = "l:base "
153                       , letValue = "'Search for `' . l:lastsearch . '` failed'"
154                       }
155                   , LetStatement
156                       { letLexpr = "l:suffix "
157                       , letValue = "a:type == 'qf' && s:dispatch() ?"
158                       }
159                   , GenericStatement "\\ ' (run `:messages` to see details)' : ''"
160                   , GenericStatement
161                       "if l:lastsearch =~ '\\v^[' . \"'\" . '\"].+[^' . \"'\" . '\"]$'"
162                   , GenericStatement "call s:error(l:base . l:tip . l:suffix)"
163                   , GenericStatement "else"
164                   , GenericStatement "call s:error(l:base . l:suffix)"
165                   , GenericStatement "endif"
166                   , GenericStatement "endif"
167                   , GenericStatement "endif"
168                   ]
169               }
170           , FunctionDeclaration
171               { functionBang = True
172               , functionName = "ferret#private#ack"
173               , functionArguments = ArgumentList [ Argument "command" ]
174               , functionAttributes = [ "abort" ]
175               , functionBody =
176                   [ LetStatement
177                       { letLexpr = "l:command" , letValue = "s:parse(a:command)" }
178                   , GenericStatement "call ferret#private#hlsearch()"
179                   , GenericStatement "if empty(&grepprg)"
180                   , GenericStatement "return"
181                   , GenericStatement "endif"
182                   , GenericStatement "if s:dispatch()"
183                   , GenericStatement "if has('autocmd')"
184                   , GenericStatement "augroup FerretPostQF"
185                   , GenericStatement "autocmd!"
186                   , GenericStatement
187                       "autocmd QuickfixCmdPost cgetfile call ferret#private#post('qf')"
188                   , GenericStatement "augroup END"
189                   , GenericStatement "endif"
190                   , LetStatement
191                       { letLexpr = "l:original_makeprg" , letValue = "&l:makeprg" }
192                   , LetStatement
193                       { letLexpr = "l:original_errorformat"
194                       , letValue = "&l:errorformat"
195                       }
196                   , GenericStatement "try"
197                   , LetStatement
198                       { letLexpr = "&l:makeprg"
199                       , letValue = "&grepprg . ' ' . l:command"
200                       }
201                   , LetStatement
202                       { letLexpr = "&l:errorformat" , letValue = "&grepformat" }
203                   , GenericStatement "Make"
204                   , GenericStatement "catch"
205                   , GenericStatement "if has('autocmd')"
206                   , GenericStatement "augroup! FerretPostQF"
207                   , GenericStatement "endif"
208                   , GenericStatement "finally"
209                   , LetStatement
210                       { letLexpr = "&l:makeprg" , letValue = "l:original_makeprg" }
211                   , LetStatement
212                       { letLexpr = "&l:errorformat"
213                       , letValue = "l:original_errorformat"
214                       }
215                   , GenericStatement "endtry"
216                   , GenericStatement "else"
217                   , GenericStatement "cexpr system(&grepprg . ' ' . l:command)"
218                   , GenericStatement "cwindow"
219                   , GenericStatement "call ferret#private#post('qf')"
220                   , GenericStatement "endif"
221                   ]
222               }
223           , FunctionDeclaration
224               { functionBang = True
225               , functionName = "ferret#private#lack"
226               , functionArguments = ArgumentList [ Argument "command" ]
227               , functionAttributes = [ "abort" ]
228               , functionBody =
229                   [ LetStatement
230                       { letLexpr = "l:command" , letValue = "s:parse(a:command)" }
231                   , GenericStatement "call ferret#private#hlsearch()"
232                   , GenericStatement "if empty(&grepprg)"
233                   , GenericStatement "return"
234                   , GenericStatement "endif"
235                   , LexprStatement
236                       { lexprBang = False
237                       , lexprExpr = "system(&grepprg . ' ' . l:command)"
238                       }
239                   , LwindowStatement { lwindowHeight = Nothing }
240                   , GenericStatement "call ferret#private#post('location')"
241                   ]
242               }
243           , FunctionDeclaration
244               { functionBang = True
245               , functionName = "ferret#private#hlsearch"
246               , functionArguments = ArgumentList []
247               , functionAttributes = [ "abort" ]
248               , functionBody =
249                   [ GenericStatement "if has('extra_search')"
250                   , GenericStatement "\"\""
251                   , LetStatement
252                       { letLexpr = "l:hlsearch"
253                       , letValue = "get(g:, 'FerretHlsearch', &hlsearch)"
254                       }
255                   , GenericStatement "if l:hlsearch"
256                   , LetStatement
257                       { letLexpr = "@/" , letValue = "g:ferret_lastsearch" }
258                   , GenericStatement
259                       "call feedkeys(\":let &hlsearch=1 | echo \\<CR>\", 'n')"
260                   , GenericStatement "endif"
261                   , GenericStatement "endif"
262                   ]
263               }
264           , FunctionDeclaration
265               { functionBang = True
266               , functionName = "ferret#private#acks"
267               , functionArguments = ArgumentList [ Argument "command" ]
268               , functionAttributes = [ "abort" ]
269               , functionBody =
270                   [ GenericStatement
271                       "if match(a:command, '\\v^/.+/.*/$') == -1 \" crude sanity check"
272                   , GenericStatement
273                       "echoerr 'Ferret: Expected a substitution expression (/foo/bar/); got: ' . a:command"
274                   , GenericStatement "return"
275                   , GenericStatement "endif"
276                   , LetStatement
277                       { letLexpr = "l:filenames" , letValue = "ferret#private#qargs()" }
278                   , GenericStatement "if l:filenames ==# ''"
279                   , GenericStatement
280                       "echoerr 'Ferret: Quickfix filenames must be present, but there are none'"
281                   , GenericStatement "return"
282                   , GenericStatement "endif"
283                   , GenericStatement "execute 'args' l:filenames"
284                   , GenericStatement
285                       "if v:version > 703 || v:version == 703 && has('patch438')"
286                   , GenericStatement
287                       "silent doautocmd <nomodeline> User FerretWillWrite"
288                   , GenericStatement "else"
289                   , GenericStatement "silent doautocmd User FerretWillWrite"
290                   , GenericStatement "endif"
291                   , GenericStatement
292                       "execute 'argdo' '%s' . a:command . 'ge | update'"
293                   , GenericStatement
294                       "if v:version > 703 || v:version == 703 && has('patch438')"
295                   , GenericStatement
296                       "silent doautocmd <nomodeline> User FerretDidWrite"
297                   , GenericStatement "else"
298                   , GenericStatement "silent doautocmd User FerretDidWrite"
299                   , GenericStatement "endif"
300                   ]
301               }
302           , FunctionDeclaration
303               { functionBang = True
304               , functionName = "ferret#private#qargs"
305               , functionArguments = ArgumentList []
306               , functionAttributes = [ "abort" ]
307               , functionBody =
308                   [ LetStatement { letLexpr = "l:buffer_numbers" , letValue = "{}" }
309                   , GenericStatement "for l:item in getqflist()"
310                   , LetStatement
311                       { letLexpr = "l:buffer_numbers[l:item['bufnr']]"
312                       , letValue = "bufname(l:item['bufnr'])"
313                       }
314                   , GenericStatement "endfor"
315                   , GenericStatement
316                       "return join(map(values(l:buffer_numbers), 'fnameescape(v:val)'))"
317                   ]
318               }
319           , FunctionDeclaration
320               { functionBang = True
321               , functionName = "ferret#private#qf_delete"
322               , functionArguments = ArgumentList []
323               , functionAttributes = [ "range" ]
324               , functionBody =
325                   [ GenericStatement "call s:delete(a:firstline, a:lastline)" ]
326               }
327           , FunctionDeclaration
328               { functionBang = True
329               , functionName = "ferret#private#qf_delete_motion"
330               , functionArguments =
331                   ArgumentList [ Argument "type" , Argument "..." ]
332               , functionAttributes = []
333               , functionBody =
334                   [ LetStatement
335                       { letLexpr = "l:selection" , letValue = "&selection" }
336                   , LetStatement
337                       { letLexpr = "&selection" , letValue = "'inclusive'" }
338                   , LetStatement
339                       { letLexpr = "l:firstline" , letValue = "line(\"'[\")" }
340                   , LetStatement
341                       { letLexpr = "l:lastline" , letValue = "line(\"']\")" }
342                   , GenericStatement "call s:delete(l:firstline, l:lastline)"
343                   , LetStatement
344                       { letLexpr = "&selection" , letValue = "l:selection" }
345                   ]
346               }
347           ]
348       ]
349   , OptionAnnotation "g:FerretDispatch" "boolean" (Just "1")
350   , Paragraph
351       [ Plaintext "Controls"
352       , Whitespace
353       , Plaintext "whether"
354       , Whitespace
355       , Plaintext "to"
356       , Whitespace
357       , Plaintext "use"
358       , Whitespace
359       , Plaintext "vim-dispatch"
360       , Whitespace
361       , Plaintext "(and"
362       , Whitespace
363       , Plaintext "specifically,"
364       , Whitespace
365       , Link ":Make"
366       , Plaintext ")"
367       , Whitespace
368       , Plaintext "to"
369       , Whitespace
370       , Plaintext "run"
371       , Whitespace
372       , Link ":Ack"
373       , Whitespace
374       , Plaintext "searches"
375       , Whitespace
376       , Plaintext "asynchronously,"
377       , Whitespace
378       , Plaintext "when"
379       , Whitespace
380       , Plaintext "available."
381       , Whitespace
382       , Plaintext "To"
383       , Whitespace
384       , Plaintext "prevent"
385       , Whitespace
386       , Plaintext "vim-dispatch"
387       , Whitespace
388       , Plaintext "from"
389       , Whitespace
390       , Plaintext "being"
391       , Whitespace
392       , Plaintext "used,"
393       , Whitespace
394       , Plaintext "set"
395       , Whitespace
396       , Plaintext "to"
397       , Whitespace
398       , Plaintext "0:"
399       ]
400   , Fenced [ "let g:FerretDispatch=0" ]
401   ]