├── LICENSE ├── README.md ├── autoload └── neomake │ └── makers │ └── ft │ └── pony.vim ├── ftdetect └── pony.vim ├── syntax └── pony.vim └── syntax_checkers └── pony └── ponyc.vim /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A syntax file for editing [pony](http://ponylang.org) source files in [vim](http://www.vim.org/). 2 | 3 | Install with your favourite plugin manager such as [vim-plug](https://github.com/junegunn/vim-plug) or [pathogen](https://github.com/tpope/vim-pathogen). 4 | -------------------------------------------------------------------------------- /autoload/neomake/makers/ft/pony.vim: -------------------------------------------------------------------------------- 1 | function! neomake#makers#ft#pony#EnabledMakers() 2 | return ['ponyc'] 3 | endfunction 4 | 5 | function! neomake#makers#ft#pony#ponyc() 6 | " This is currently a hack. Ponyc itself uses the project directory as 7 | " the target to build. Using %:p:h like this fetches the parent 8 | " directory of the current file which might cause supurious errors on 9 | " package imports if the current file is nested under a sub-directory. 10 | return { 11 | \ 'args': ['--pass=expr', '%:p:h'], 12 | \ 'errorformat': '%f:%l:%c: %m' 13 | \ } 14 | endfunction 15 | -------------------------------------------------------------------------------- /ftdetect/pony.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.pony set filetype=pony 2 | -------------------------------------------------------------------------------- /syntax/pony.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Pony 3 | " Maintainer: You 4 | " Last Change: 2015 May 6 5 | " Original Author: David Leonard 6 | 7 | if exists("b:current_syntax") 8 | finish 9 | endif 10 | 11 | " For syntastic as the 'pony' filetype is not officially registered. 12 | if exists('g:syntastic_extra_filetypes') 13 | call add(g:syntastic_extra_filetypes, 'pony') 14 | else 15 | let g:syntastic_extra_filetypes = ['pony'] 16 | endif 17 | 18 | " TODO add markdown to triple-comments 19 | 20 | syn case match 21 | 22 | " Sync at the beginning of classes, functions 23 | syn sync match ponySync grouphere NONE "^\s*\%(class\|fun\|be\|new\)\s\+[a-zA-Z_]" 24 | 25 | " Constants 26 | syn region ponyString start=+"+ skip=+\\"+ end=+"+ contains=ponyEscape 27 | syn region ponyTripleString start=+"""+ end=+"""+ contains=ponyEscape,@markdownBlock 28 | syn match ponyEscape contained "\\x\x\{2}" 29 | syn match ponyEscape contained "\\u\x\{4}" 30 | syn match ponyEscape contained "\\U\x\{6}" 31 | syn match ponyEscape contained "\\[\\abefnrtv\"'0]" 32 | 33 | hi def link ponyString String 34 | hi def link ponyTripleString String 35 | hi def link ponyEscape Character 36 | 37 | syn match ponyInt "\d\+" 38 | syn match ponyIntError "0[bx]" 39 | syn match ponyInt "0x\x\+" 40 | syn match ponyInt "0b[01]\+" 41 | syn match ponyCharError "'" 42 | syn match ponyChar "'[^\\']'" 43 | syn match ponyChar "'\\[\\abefnrtv\"'0]'" contains=ponyEscape 44 | syn match ponyChar "'\\x\x\{2}'" contains=ponyEscape 45 | syn match ponyChar "'\\u\x\{4}'" contains=ponyEscape 46 | syn match ponyChar "'\\U\x\{6}'" contains=ponyEscape 47 | syn keyword ponyBoolean true false 48 | syn match ponyReal "\d\+\%(\.\d\+\)\=[Ee][+-]\=\d\+" 49 | syn match ponyReal "\d\+\.\d\+\%([Ee][+-]\=\d\+\)\=" 50 | 51 | hi def link ponyInt Number 52 | hi def link ponyChar Number 53 | hi def link ponyBoolean Boolean 54 | hi def link ponyReal Float 55 | hi def link ponyCharError Error 56 | hi def link ponyIntError Error 57 | 58 | " Identifiers 59 | 60 | syn match ponyId "\<\a[a-zA-Z0-9_']*" nextgroup=ponyCap,ponyCapMod 61 | syn match ponyPrivateId "\<_[a-zA-Z0-9_']\+" 62 | syn cluster PonyIdentifier contains=ponyId,ponyPrivateId 63 | "hi def link ponyId Identifier 64 | "hi def link ponyPrivateId Identifier 65 | 66 | syn keyword ponyBuiltinClass Array ArrayKeys ArrayValues ArrayPairs 67 | syn keyword ponyBuiltinClass Env Pointer String StringValues 68 | hi def link ponyBuiltinClass Structure 69 | 70 | syn keyword ponyBuiltinType Number Signed Unsigned Float 71 | syn keyword ponyBuiltinType I8 I16 I32 I64 I128 U8 U16 U32 U64 U128 F32 F64 72 | syn keyword ponyBuiltinType EventID Align IntFormat NumberPrefix FloatFormat 73 | hi def link ponyBuiltinType Type 74 | 75 | syn keyword ponyBuiltinIface Arithmetic Logical Bits Comparable Ordered 76 | syn keyword ponyBuiltinIface EventNotify Iterator ReadSeq StdinNotify Seq 77 | syn keyword ponyBuiltinIface Stringable Bytes BytesList Stream Any 78 | hi def link ponyBuiltinIface Type 79 | 80 | syn region ponyMethodDecl matchgroup=ponyMethodKeyword start=+\<\%(fun\|be\|new\)\>+ end=+[[({]\@=+ contains=ponyCap,ponyMethod,@PonyComment 81 | syn keyword ponyMethodKeyword contained fun be new 82 | syn match ponyMethod contained "\<\a[a-zA-Z0-9_']*" 83 | syn match ponyMethod contained "\<_[a-zA-Z0-9_']\+" 84 | hi def link ponyMethod Function 85 | hi def link ponyMethodKeyword Keyword 86 | 87 | syn region ponyVarDecl matchgroup=ponyVarKeyword start=+\<\%(var\|let\|embed\)\>+ end=+[:=]\@=+ contains=ponyVar,@PonyComment 88 | syn keyword ponyVarKeyword contained var let embed 89 | syn match ponyVar contained "\<\a[a-zA-Z0-9_']*" 90 | syn match ponyVar contained "\<_[a-zA-Z0-9_']\+" 91 | hi def link ponyVar Identifier 92 | hi def link ponyVarKeyword Keyword 93 | 94 | " Operators and delimiters 95 | 96 | syn match ponyCapModError +[\^\!]+ 97 | hi def link ponyCapModError Error 98 | 99 | syn match ponyQuestion +?+ 100 | hi def link ponyQuestion StorageClass 101 | 102 | syn match ponyAt +@+ 103 | hi def link ponyAt Delimiter 104 | 105 | syn match ponyAtOpError +@[^ \-[("a-zA-Z_]+ 106 | syn match ponyAtIdError +@\s\+[^"a-zA-Z_]+ 107 | hi def link ponyAtIdError Error 108 | hi def link ponyAtOpError Error 109 | 110 | syn keyword ponyOp1 and or xor is isnt not consume 111 | syn match ponyOp2 +\([=!]=\|[<>]=\|<<\|>>\|@-\|[-+<>*/%&|]\)+ 112 | hi def link ponyOp1 Operator 113 | hi def link ponyOp2 Operator 114 | 115 | " Keywords 116 | 117 | syn keyword ponyUse use 118 | hi def link ponyUse Include 119 | 120 | syn keyword ponyStatement return break continue 121 | syn keyword ponyKeyword error 122 | syn keyword ponyConditional if then else elseif match 123 | syn keyword ponyKeyword do end 124 | syn keyword ponyKeyword in 125 | syn keyword ponyRepeat while repeat until for 126 | syn keyword ponyKeyword with 127 | syn keyword ponyTry try recover 128 | syn keyword ponyKeyword this box 129 | syn keyword ponyKeyword as where 130 | hi def link ponyStatement Statement 131 | hi def link ponyConditional Conditional 132 | hi def link ponyRepeat Repeat 133 | hi def link ponyKeyword Keyword 134 | hi def link ponyTry Exception 135 | 136 | syn keyword ponyTypedef type 137 | syn keyword ponyStructure interface trait primitive class actor 138 | hi def link ponyTypedef Typedef 139 | hi def link ponyStructure Structure 140 | 141 | syn keyword ponyCap iso trn ref val box tag nextgroup=ponyCapMod 142 | syn match ponyCapMod contained +[\^\!]+ 143 | hi def link ponyCap StorageClass 144 | hi def link ponyCapMod StorageClass 145 | 146 | syn keyword ponySpecial compiler_intrinsic 147 | hi def link ponySpecial Special 148 | 149 | syn keyword ponyAny _ 150 | hi def link ponyAny Special 151 | 152 | " Parentheses 153 | 154 | syn match ponyParenError +[()]+ 155 | syn region ponyParen transparent start=+(+ end=+)+ contains=TOP,ponyParenError 156 | syn match ponyArrayError +[\[\]]+ 157 | syn region ponyArray transparent start=+\[+ end=+]+ contains=TOP,ponyArrayError 158 | syn match ponyConstError +[{}]+ 159 | syn region ponyConst transparent start=+{+ end=+}+ contains=TOP,ponyConstError 160 | 161 | hi def link ponyParenError Error 162 | hi def link ponyArrayError Error 163 | hi def link ponyConstError Error 164 | 165 | " Methods 166 | 167 | syn match ponyIntroducer +=>+ 168 | hi def link ponyIntroducer Delimiter 169 | 170 | " Comments 171 | syn region ponyLineComment start=+//+ end=+$+ contains=ponyTodo keepend 172 | syn region ponyNestedComment start=+/\*+ end=+\*/+ contains=ponyTodo,ponyNestedComment 173 | syn cluster ponyComment contains=ponyLineComment,ponyNestedComment 174 | syn keyword ponyTodo contained TODO FIXME XXX 175 | 176 | hi def link ponyLineComment Comment 177 | hi def link ponyNestedComment Comment 178 | hi def link ponyTodo Todo 179 | 180 | let b:current_syntax = "pony" 181 | -------------------------------------------------------------------------------- /syntax_checkers/pony/ponyc.vim: -------------------------------------------------------------------------------- 1 | "============================================================================ 2 | "File: ponyc.vim 3 | "Description: Syntax checking plugin for syntastic.vim 4 | "Maintainer: Earnestly 5 | "License: This program is free software. It comes without any warranty, 6 | " to the extent permitted by applicable law. 7 | " 8 | "============================================================================ 9 | 10 | if exists('g:loaded_syntastic_pony_ponyc_checker') 11 | finish 12 | endif 13 | let g:loaded_syntastic_pony_ponyc_checker = 1 14 | 15 | let s:save_cpo = &cpo 16 | set cpo&vim 17 | 18 | function! SyntaxCheckers_pony_ponyc_GetLocList() dict 19 | 20 | " This is currently a hack. `ponyc` itself uses the project directory as 21 | " the target to build. Using expand like this fetches the parent 22 | " directory of the current file which might cause supurious errors on 23 | " package imports if the current file is nested under a sub-directory. 24 | let n = expand('%:p:h') 25 | 26 | let makeprg = self.makeprgBuild({ 27 | \ 'args': '--pass=expr', 28 | \ 'fname': n}) 29 | 30 | let errorformat = 31 | \ '%f:%l:%c: %m' 32 | 33 | return SyntasticMake({ 34 | \ 'makeprg': makeprg, 35 | \ 'errorformat': errorformat }) 36 | endfunction 37 | 38 | call g:SyntasticRegistry.CreateAndRegisterChecker({ 39 | \ 'filetype': 'pony', 40 | \ 'name': 'ponyc'}) 41 | 42 | let &cpo = s:save_cpo 43 | unlet s:save_cpo 44 | --------------------------------------------------------------------------------