Browse Source

Complete the plugin.

pull/1/head
Ivan Enderlin 5 years ago
parent
commit
21e19f9d4a
5 changed files with 185 additions and 13 deletions
  1. +26
    -4
      README.md
  2. +39
    -9
      colors/pp.vim
  3. +30
    -0
      ftdetect/pp.vim
  4. +31
    -0
      ftplugin/pp.vim
  5. +59
    -0
      syntax/pp.vim

+ 26
- 4
README.md View File

@@ -5,16 +5,38 @@ Moreover, Hoa aims at being a bridge between industrial and research worlds.

# Contributions/Vim/Pp

This repository contains tools for the PP grammar description language from
[`Hoa\Compiler`](http://central.hoa-project.net/Resource/Library/Compiler).
This repository contains Vim tools for the PP grammar description language from
[the PHP `Hoa\Compiler`
library](http://central.hoa-project.net/Resource/Library/Compiler):

* File type plugin,
* File type detection,
* File syntax and,
* Color scheme.

## Installation

With [Vundle](https://github.com/gmarik/Vundle.vim), to include this plugin into
your Vim plugins, you need to require
[`hoaproject/Contributions-Vim-Pp`](http://vimawesome.com/plugin/pp) (in your
plugin list file):

```vim
Plugin 'hoaproject/Contributions-Vim-Pp'
```

Then, in the Vim command mode (press Esc):

```vim
:source %
:PluginInstall
```

## Quick usage

Just open a PP file in Vim, nothing special to do! For instance, try the
[`hoa://Library/Compiler/Llk/Llk.pp`](http://central.hoa-project.net/Resource/Library/Compiler/Llk/Llk.pp)
file.

## Documentation



+ 39
- 9
colors/pp.vim View File

@@ -1,9 +1,39 @@
hi ppRule ctermfg=94
hi ppRuleName ctermfg=221
hi ppNamedToken ctermfg=106
hi ppSkippedToken ctermfg=173
hi ppKeptToken ctermfg=223
hi ppNode ctermfg=117
hi ppComment ctermfg=240
hi ppToken ctermfg=74
hi ppKeyword ctermfg=220
" Hoa
"
"
" New BSD License
"
" Copyright © 2007-2015, Hoa community. All rights reserved.
"
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions are met:
" * Redistributions of source code must retain the above copyright
" notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above copyright
" notice, this list of conditions and the following disclaimer in the
" documentation and/or other materials provided with the distribution.
" * Neither the name of the Hoa nor the names of its contributors may be
" used to endorse or promote products derived from this software without
" specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
" POSSIBILITY OF SUCH DAMAGE.

hi ppRule ctermfg=94
hi ppRuleName ctermfg=221
hi ppNamedToken ctermfg=106
hi ppSkippedToken ctermfg=173
hi ppKeptToken ctermfg=223
hi ppNode ctermfg=117
hi ppComment ctermfg=240
hi ppToken ctermfg=74
hi ppKeyword ctermfg=220

+ 30
- 0
ftdetect/pp.vim View File

@@ -1 +1,31 @@
" Hoa
"
"
" New BSD License
"
" Copyright © 2007-2015, Hoa community. All rights reserved.
"
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions are met:
" * Redistributions of source code must retain the above copyright
" notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above copyright
" notice, this list of conditions and the following disclaimer in the
" documentation and/or other materials provided with the distribution.
" * Neither the name of the Hoa nor the names of its contributors may be
" used to endorse or promote products derived from this software without
" specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
" POSSIBILITY OF SUCH DAMAGE.

autocmd BufRead,BufNewFile *.pp set filetype=pp

+ 31
- 0
ftplugin/pp.vim View File

@@ -1,4 +1,35 @@
" Hoa
"
"
" New BSD License
"
" Copyright © 2007-2015, Hoa community. All rights reserved.
"
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions are met:
" * Redistributions of source code must retain the above copyright
" notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above copyright
" notice, this list of conditions and the following disclaimer in the
" documentation and/or other materials provided with the distribution.
" * Neither the name of the Hoa nor the names of its contributors may be
" used to endorse or promote products derived from this software without
" specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
" POSSIBILITY OF SUCH DAMAGE.

colorscheme pp

inoremap : ::<LEFT>
inoremap < <><LEFT>
inoremap ( ()

+ 59
- 0
syntax/pp.vim View File

@@ -0,0 +1,59 @@
" Hoa
"
"
" New BSD License
"
" Copyright © 2007-2015, Hoa community. All rights reserved.
"
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions are met:
" * Redistributions of source code must retain the above copyright
" notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above copyright
" notice, this list of conditions and the following disclaimer in the
" documentation and/or other materials provided with the distribution.
" * Neither the name of the Hoa nor the names of its contributors may be
" used to endorse or promote products derived from this software without
" specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
" POSSIBILITY OF SUCH DAMAGE.

if !exists("b:current_syntax")

syntax region ppRuleName start="." end=":"
syntax region ppRule start=" " end="$" contains=ppNamedToken,ppSkippedToken,ppKeptToken,ppNode,ppKeyword
syntax match ppNamedToken "\w\(\)" contained
syntax region ppSkippedToken start="::" end="::" contained
syntax region ppKeptToken start="<" end=">" contained
syntax region ppNode start="#" end=" " contained
syntax region ppComment start="//" end="$"
syntax region ppToken start="%" end="$"
syntax match ppKeyword "[\|\*\?\+,{}]" contained

highlight default link ppRuleName StorageClass
highlight default link ppNamedToken Function
highlight default link ppSkippedToken Constant
highlight default link ppKeptToken Constant
highlight default link ppNode Identifier
highlight default link ppComment Comment
highlight default link ppToken Define
highlight default link ppKeyword Keyword

syntax sync clear
syntax sync fromstart

let b:current_syntax="pp"

endif

finish

Loading…
Cancel
Save