diff options
author | Sinos <github@47.rs> | 2020-10-27 19:02:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 12:02:41 +0100 |
commit | 05e21a9e252b283b2d71568ad3b671d7f28fe0bc (patch) | |
tree | 479dad4293619cfaa0eaa1c47ffa76bf491865f3 | |
parent | 683286b3d7e0db80e67458b4a0b4d71a88377b62 (diff) | |
download | vim-polyglot-05e21a9e252b283b2d71568ad3b671d7f28fe0bc.tar.gz vim-polyglot-05e21a9e252b283b2d71568ad3b671d7f28fe0bc.zip |
Add support for PEG syntax (#615)
* feat: add pest syntax
* feat: add pest into packages
* feat: increase the package count
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 4 | ||||
-rw-r--r-- | packages.yaml | 7 | ||||
-rw-r--r-- | syntax/pest.vim | 131 |
4 files changed, 144 insertions, 1 deletions
@@ -7,7 +7,7 @@ A collection of language packs for Vim. > One to rule them all, one to find them, one to bring them all and in the darkness bind them. - It **won't affect your startup time**, as scripts are loaded only on demand\*. -- It **installs and updates 120+ times faster** than the <!--Package Count-->597<!--/Package Count--> packages it consists of. +- It **installs and updates 120+ times faster** than the <!--Package Count-->598<!--/Package Count--> packages it consists of. - It is also more secure (scripts loaded for every filetype are generated by vim-polyglot) - Best syntax and indentation support (no other features). Hand-selected language packs. - Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled) @@ -138,6 +138,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr - [odin](https://github.com/Tetralux/odin.vim) (Odin syntax highlighting for odin files) - [opencl](https://github.com/petRUShka/vim-opencl) (OpenCL syntax highlighting for cl and opencl files) - [perl](https://github.com/vim-perl/vim-perl) (Perl syntax highlighting for pl, al, cgi, fcgi, perl and 12 more files) +- [pest](https://github.com/pest-parser/pest.vim) (PEG syntax for Rust Pest crate) - [pgsql](https://github.com/lifepillar/pgsql.vim) (PLpgSQL syntax highlighting for pgsql files) - [php](https://github.com/StanAngeloff/php.vim) (PHP syntax highlighting for php, aw, ctp, fcgi, inc and 7 more files) - [plantuml](https://github.com/aklt/plantuml-syntax) (PlantUML syntax highlighting for puml, iuml, plantuml, uml and pu files) diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 5902b34f..a5dbf5ef 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -1998,6 +1998,10 @@ if !has_key(g:polyglot_is_disabled, 'requirements') au BufNewFile,BufRead *.pip,*require.{txt,in},*requirements.{txt,in},constraints.{txt,in} setf requirements endif +if !has_key(g:polyglot_is_disabled, 'pest') + au BufNewFile,BufRead *.pest setf pest +endif + if !has_key(g:polyglot_is_disabled, 'python') au BufNewFile,BufRead *.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.ptl,*.py,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,{.,}gclient,{.,}pythonrc,{.,}pythonstartup,DEPS,SConscript,SConstruct,Snakefile,wscript setf python endif diff --git a/packages.yaml b/packages.yaml index 2e4cdb87..d7c23f94 100644 --- a/packages.yaml +++ b/packages.yaml @@ -1236,6 +1236,13 @@ filetypes: - name: blade linguist: Blade --- +name: pest +remote: pest-parser/pest.vim +filetypes: +- name: pest + extensions: + - pest +--- name: plantuml remote: aklt/plantuml-syntax filetypes: diff --git a/syntax/pest.vim b/syntax/pest.vim new file mode 100644 index 00000000..c151c678 --- /dev/null +++ b/syntax/pest.vim @@ -0,0 +1,131 @@ +" Comments +syntax keyword pestTodo contained TODO FIXME XXX NOTE +syntax match pestComment "\/\/.*$" contains=celTodo + +" Rule names +syntax match pestName "^[a-z_][a-z0-9_]*" + +" String types +syntax region pestString start=/"/ skip=/\\\\\|\\"/ end=/"/ oneline contained +syntax region pestStringIcase start=/\^"/ skip=/\\\\\|\\"/ end=/"/ oneline contained +syntax region pestChar start=/'/ end=/'/ oneline contained + +" Operators, modifiers, keywords +syntax match pestModifier "\v[_@$!]" +syntax match pestOperator "\v[~|*+?&!]" contained +syntax keyword pestKeyword PUSH POP POP_ALL PEEK PEEK_ALL DROP contained +syntax keyword pestSpecial WHITESPACE COMMENT ANY SOI EOI ASCII_DIGIT ASCII_NONZERO_DIGIT ASCII_BIN_DIGIT ASCII_OCT_DIGIT ASCII_HEX_DIGIT + \ ASCII_ALPHA_LOWER ASCII_ALPHA_UPPER ASCII_ALPHA ASCII_ALPHANUMERIC ASCII NEWLINE +syntax keyword pestGeneral contained + \ LETTER + \ CASED_LETTER + \ UPPERCASE_LETTER + \ LOWERCASE_LETTER + \ TITLECASE_LETTER + \ MODIFIER_LETTER + \ OTHER_LETTER + \ MARK + \ NONSPACING_MARK + \ SPACING_MARK + \ ENCLOSING_MARK + \ NUMBER + \ DECIMAL_NUMBER + \ LETTER_NUMBER + \ OTHER_NUMBER + \ PUNCTUATION + \ CONNECTOR_PUNCTUATION + \ DASH_PUNCTUATION + \ OPEN_PUNCTUATION + \ CLOSE_PUNCTUATION + \ INITIAL_PUNCTUATION + \ FINAL_PUNCTUATION + \ OTHER_PUNCTUATION + \ SYMBOL + \ MATH_SYMBOL + \ CURRENCY_SYMBOL + \ MODIFIER_SYMBOL + \ OTHER_SYMBOL + \ SEPARATOR + \ SPACE_SEPARATOR + \ LINE_SEPARATOR + \ PARAGRAPH_SEPARATOR + \ OTHER + \ CONTROL + \ FORMAT + \ SURROGATE + \ PRIVATE_USE + \ UNASSIGNED +syntax keyword pestBinary contained + \ ALPHABETIC + \ BIDI_CONTROL + \ CASE_IGNORABLE + \ CASED + \ CHANGES_WHEN_CASEFOLDED + \ CHANGES_WHEN_CASEMAPPED + \ CHANGES_WHEN_LOWERCASED + \ CHANGES_WHEN_TITLECASED + \ CHANGES_WHEN_UPPERCASED + \ DASH + \ DEFAULT_IGNORABLE_CODE_POINT + \ DEPRECATED + \ DIACRITIC + \ EXTENDER + \ GRAPHEME_BASE + \ GRAPHEME_EXTEND + \ GRAPHEME_LINK + \ HEX_DIGIT + \ HYPHEN + \ IDS_BINARY_OPERATOR + \ IDS_TRINARY_OPERATOR + \ ID_CONTINUE + \ ID_START + \ IDEOGRAPHIC + \ JOIN_CONTROL + \ LOGICAL_ORDER_EXCEPTION + \ LOWERCASE + \ MATH + \ NONCHARACTER_CODE_POINT + \ OTHER_ALPHABETIC + \ OTHER_DEFAULT_IGNORABLE_CODE_POINT + \ OTHER_GRAPHEME_EXTEND + \ OTHER_ID_CONTINUE + \ OTHER_ID_START + \ OTHER_LOWERCASE + \ OTHER_MATH + \ OTHER_UPPERCASE + \ PATTERN_SYNTAX + \ PATTERN_WHITE_SPACE + \ PREPENDED_CONCATENATION_MARK + \ QUOTATION_MARK + \ RADICAL + \ REGIONAL_INDICATOR + \ SENTENCE_TERMINAL + \ SOFT_DOTTED + \ TERMINAL_PUNCTUATION + \ UNIFIED_IDEOGRAPH + \ UPPERCASE + \ VARIATION_SELECTOR + \ WHITE_SPACE + \ XID_CONTINUE + \ XID_START +syntax keyword pestForbidden abstract alignof as become box break const continue crate do else enum extern false + \ final fn for if impl in let loop macro match mod move mut offsetof override priv proc pure pub ref return + \ Self self sizeof static struct super trait true type typeof unsafe unsized use virtual where while yield + +" Rule blocks +syntax region pestBlock start=/{/ end=/}/ fold transparent contains=pestString,pestStringIcase,pestChar,pestOperator,pestKeyword,pestSpecial,pestGeneral,pestBinary,pestForbidden,pestComment,pestBlock +syntax region pestRule start=/^/ end=/ / fold transparent contains=pestName,pestForbidden,pestComment + +highlight default link pestTodo Todo +highlight default link pestComment Comment +highlight default link pestString String +highlight default link pestStringIcase String +highlight default link pestChar Character +highlight default link pestName Identifier +highlight default link pestModifier Operator +highlight default link pestOperator Operator +highlight default link pestKeyword Keyword +highlight default link pestSpecial Type +highlight default link pestGeneral Type +highlight default link pestBinary Type +highlight default link pestForbidden Error |