aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/ruby.vim26
-rw-r--r--runtime/syntax/zserio.vim112
2 files changed, 125 insertions, 13 deletions
diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim
index c951fcfe1d..e19d61a051 100644
--- a/runtime/syntax/ruby.vim
+++ b/runtime/syntax/ruby.vim
@@ -3,7 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Nov 03
+" Last Change: 2023 Mar 16
" ----------------------------------------------------------------------------
"
" Previous Maintainer: Mirko Nasato
@@ -145,9 +145,9 @@ syn cluster rubyStringSpecial contains=rubyInterpolation,rubyStringEscape
syn cluster rubyStringNotTop contains=@rubyStringSpecial,@rubyNestedBrackets,@rubySingleCharEscape
" Regular Expression Metacharacters {{{1
-syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\\\\|\\)" end=")" contained
-syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\\\\|\\)" end=")" contained transparent contains=@rubyRegexpSpecial
-syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\\\|\\\]" end="\]" contained transparent contains=rubyRegexpBrackets,rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass,rubyRegexpIntersection oneline
+syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\\\\|\\)" end=")" contained
+syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\%(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\\\\|\\)" end=")" contained transparent contains=@rubyRegexpSpecial
+syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\\\|\\\]" end="\]" contained transparent contains=rubyRegexpBrackets,rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass,rubyRegexpIntersection oneline
syn match rubyRegexpCharClass "\\[DdHhRSsWw]" contained display
syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|xdigit\):\]" contained
syn match rubyRegexpCharClass "\\[pP]{^\=.\{-}}" contained display
@@ -346,7 +346,7 @@ syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,
syn match rubyControl "\%#=1\<\%(break\|in\|next\|redo\|retry\|return\)\>"
syn match rubyKeyword "\%#=1\<\%(super\|yield\)\>"
syn match rubyBoolean "\%#=1\<\%(true\|false\)\>[?!]\@!"
-syn match rubyPseudoVariable "\%#=1\<\(self\|nil\)\>[?!]\@!"
+syn match rubyPseudoVariable "\%#=1\<\%(self\|nil\)\>[?!]\@!"
syn match rubyPseudoVariable "\%#=1\<__\%(ENCODING\|dir\|FILE\|LINE\|callee\|method\)__\>"
syn match rubyBeginEnd "\%#=1\<\%(BEGIN\|END\)\>"
@@ -399,11 +399,6 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
SynFold 'for' syn region rubyRepeatExpression start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\@<![!?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat skip="\<end:" end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine
- if !exists("ruby_minlines")
- let ruby_minlines = 500
- endif
- exe "syn sync minlines=" . ruby_minlines
-
else
syn match rubyControl "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl
syn match rubyControl "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl
@@ -412,13 +407,18 @@ else
syn match rubyKeyword "\<\%(alias\|undef\)\>"
endif
+if !exists("ruby_minlines")
+ let ruby_minlines = 500
+endif
+exe "syn sync minlines=" . ruby_minlines
+
" Special Methods {{{1
if !exists("ruby_no_special_methods")
syn match rubyAccess "\<\%(public\|protected\|private\)\>" " use re=2
syn match rubyAccess "\%#=1\<\%(public\|private\)_class_method\>"
syn match rubyAccess "\%#=1\<\%(public\|private\)_constant\>"
syn match rubyAccess "\%#=1\<module_function\>"
- syn match rubyAttribute "\%#=1\%(\%(^\|;\)\s*\)\@<=attr\>\(\s*[.=]\)\@!" " attr is a common variable name
+ syn match rubyAttribute "\%#=1\%(\%(^\|;\)\s*\)\@<=attr\>\%(\s*[.=]\)\@!" " attr is a common variable name
syn match rubyAttribute "\%#=1\<attr_\%(accessor\|reader\|writer\)\>"
syn match rubyControl "\%#=1\<\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>"
syn match rubyEval "\%#=1\<eval\>"
@@ -435,8 +435,8 @@ syn match rubySharpBang "\%^#!.*" display
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
syn match rubyEncoding "[[:alnum:]-_]\+" contained display
syn match rubyMagicComment "\c\%<3l#\s*\zs\%(coding\|encoding\):" contained nextgroup=rubyEncoding skipwhite
-syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen_string_literal\|warn_indent\|warn_past_scope\):" contained nextgroup=rubyBoolean skipwhite
-syn match rubyMagicComment "\c\%<10l#\s*\zs\%(shareable_constant_value\):" contained nextgroup=rubyEncoding skipwhite
+syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen[-_]string[-_]literal\|warn[-_]indent\|warn[-_]past[-_]scope\):" contained nextgroup=rubyBoolean skipwhite
+syn match rubyMagicComment "\c\%<10l#\s*\zs\%(shareable[-_]constant[-_]value\):" contained nextgroup=rubyEncoding skipwhite
syn match rubyComment "#.*" contains=@rubyCommentSpecial,rubySpaceError,@Spell
syn cluster rubyCommentSpecial contains=rubySharpBang,rubyTodo,rubyMagicComment
diff --git a/runtime/syntax/zserio.vim b/runtime/syntax/zserio.vim
new file mode 100644
index 0000000000..5459915c01
--- /dev/null
+++ b/runtime/syntax/zserio.vim
@@ -0,0 +1,112 @@
+" Vim syntax file
+" Language: Zserio
+" Maintainer: Dominique Pellé <dominique.pelle@gmail.com>
+" Last Change: 2023 Jun 18
+"
+" Zserio is a serialization schema language for modeling binary
+" data types, bitstreams or file formats. Based on the zserio
+" language it is possible to automatically generate encoders and
+" decoders for a given schema in various target languages
+" (e.g. Java, C++, Python).
+"
+" Zserio is an evolution of the DataScript language.
+"
+" For more information, see:
+" - http://zserio.org/
+" - https://github.com/ndsev/zserio
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:keepcpo= &cpo
+set cpo&vim
+
+syn case match
+
+syn keyword zserioPackage import package zserio_compatibility_version
+syn keyword zserioType bit bool string
+syn keyword zserioType int int8 int16 int32 int64
+syn keyword zserioType uint8 uint16 uint32 uint64
+syn keyword zserioType float16 float32 float64
+syn keyword zserioType varint varint16 varint32 varint64
+syn keyword zserioType varuint varsize varuint16 varuint32 varuint64
+syn keyword zserioAlign align
+syn keyword zserioLabel case default
+syn keyword zserioConditional if condition
+syn keyword zserioBoolean true false
+syn keyword zserioCompound struct union choice on enum bitmask subtype
+syn keyword zserioKeyword function return
+syn keyword zserioOperator lengthof valueof instanceof numbits isset
+syn keyword zserioRpc service pubsub topic publish subscribe
+syn keyword zserioRule rule_group rule
+syn keyword zserioStorageClass const implicit packed instantiate
+syn keyword zserioTodo contained TODO FIXME XXX
+syn keyword zserioSql sql sql_table sql_database sql_virtual sql_without_rowid
+syn keyword zserioSql explicit using
+
+" zserioCommentGroup allows adding matches for special things in comments.
+syn cluster zserioCommentGroup contains=zserioTodo
+
+syn match zserioOffset display "^\s*[a-zA-Z_:\.][a-zA-Z0-9_:\.]*\s*:"
+
+syn match zserioNumber display "\<\d\+\>"
+syn match zserioNumberHex display "\<0[xX]\x\+\>"
+syn match zserioNumberBin display "\<[01]\+[bB]\>" contains=zserioBinaryB
+syn match zserioBinaryB display contained "[bB]\>"
+syn match zserioOctal display "\<0\o\+\>" contains=zserioOctalZero
+syn match zserioOctalZero display contained "\<0"
+
+syn match zserioOctalError display "\<0\o*[89]\d*\>"
+
+syn match zserioCommentError display "\*/"
+syn match zserioCommentStartError display "/\*"me=e-1 contained
+
+syn region zserioCommentL
+ \ start="//" skip="\\$" end="$" keepend
+ \ contains=@zserioCommentGroup,@Spell
+syn region zserioComment
+ \ matchgroup=zserioCommentStart start="/\*" end="\*/"
+ \ contains=@zserioCommentGroup,zserioCommentStartError,@Spell extend
+
+syn region zserioString
+ \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
+
+syn sync ccomment zserioComment
+
+" Define the default highlighting.
+hi def link zserioType Type
+hi def link zserioEndian StorageClass
+hi def link zserioStorageClass StorageClass
+hi def link zserioAlign Label
+hi def link zserioLabel Label
+hi def link zserioOffset Label
+hi def link zserioSql PreProc
+hi def link zserioCompound Structure
+hi def link zserioConditional Conditional
+hi def link zserioBoolean Boolean
+hi def link zserioKeyword Statement
+hi def link zserioRpc Keyword
+hi def link zserioRule Keyword
+hi def link zserioString String
+hi def link zserioNumber Number
+hi def link zserioNumberBin Number
+hi def link zserioBinaryB Special
+hi def link zserioOctal Number
+hi def link zserioOctalZero Special
+hi def link zserioOctalError Error
+hi def link zserioNumberHex Number
+hi def link zserioTodo Todo
+hi def link zserioOperator Operator
+hi def link zserioPackage Include
+hi def link zserioCommentError Error
+hi def link zserioCommentStartError Error
+hi def link zserioCommentStart zserioComment
+hi def link zserioCommentL zserioComment
+hi def link zserioComment Comment
+
+let b:current_syntax = "zserio"
+
+let &cpo = s:keepcpo
+unlet s:keepcpo