]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/handlers/pony.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / autoload / ale / handlers / pony.vim
1 scriptencoding utf-8
2 " Description: This file defines a handler function which ought to work for
3 " any program which outputs errors in the format that ponyc uses.
4
5 function! s:RemoveUnicodeQuotes(text) abort
6     let l:text = a:text
7     let l:text = substitute(l:text, '[`´‘’]', '''', 'g')
8     let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g')
9     let l:text = substitute(l:text, '[“”]', '"', 'g')
10
11     return l:text
12 endfunction
13
14 function! ale#handlers#pony#HandlePonycFormat(buffer, lines) abort
15     " Look for lines like the following.
16     " /home/code/pony/classes/Wombat.pony:22:30: can't lookup private fields from outside the type
17     let l:pattern = '\v^([^:]+):(\d+):(\d+)?:? (.+)$'
18     let l:output = []
19
20     for l:match in ale#util#GetMatches(a:lines, l:pattern)
21         let l:item = {
22         \   'filename': l:match[1],
23         \   'lnum': str2nr(l:match[2]),
24         \   'col': str2nr(l:match[3]),
25         \   'type': 'E',
26         \   'text': s:RemoveUnicodeQuotes(l:match[4]),
27         \}
28
29         call add(l:output, l:item)
30     endfor
31
32     return l:output
33 endfunction