robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
4ad30f775e
master
1" Vim syntax file 2" Language: S-expressions as used in Sexplib 3" Filenames: *.sexp 4" Maintainers: Markus Mottl <markus.mottl@gmail.com> 5" URL: https://github.com/ocaml/vim-ocaml 6" Last Change: 2020 Dec 31 - Updated header for Vim contribution (MM) 7" 2017 Apr 11 - Improved matching of negative numbers (MM) 8" 2012 Jun 20 - Fixed a block comment highlighting bug (MM) 9 10" For version 5.x: Clear all syntax items 11" For version 6.x: Quit when a syntax file was already loaded 12if version < 600 13syntax clear 14elseif exists ( "b:current_syntax" ) && b: current_syntax == "sexplib" 15finish 16endif 17 18" Sexplib is case sensitive. 19syn case match 20 21" Comments 22syn keyword sexplibTodo contained TODO FIXME XXX NOTE 23syn region sexplibBlockComment matchgroup = sexplibComment start = "#| "matchgroup = sexplibComment end = "|# "contains = ALLBUT , sexplibQuotedAtom , sexplibUnquotedAtom , sexplibEncl , sexplibComment 24syn match sexplibSexpComment "#; "skipwhite skipempty nextgroup = sexplibQuotedAtomComment , sexplibUnquotedAtomComment , sexplibListComment , sexplibComment 25syn region sexplibQuotedAtomComment start = +" +skip = +\\\\\|\\" +end = +" +contained 26syn match sexplibUnquotedAtomComment /\( [ ^;()" \t#| ] \|# [ ^;()" \t| ] \|| [ ^;()" \t# ] \) [ ^;()" \t ] * /contained 27syn region sexplibListComment matchgroup = sexplibComment start = "( "matchgroup = sexplibComment end = ") "contained contains = ALLBUT , sexplibEncl , sexplibString , sexplibQuotedAtom , sexplibUnquotedAtom , sexplibTodo , sexplibNumber , sexplibFloat 28syn match sexplibComment ";. * "contains = sexplibTodo 29 30" Atoms 31syn match sexplibUnquotedAtom /\( [ ^;()" \t#| ] \|# [ ^;()" \t| ] \|| [ ^;()" \t# ] \) [ ^;()" \t ] * / 32syn region sexplibQuotedAtom start = +" +skip = +\\\\\|\\" +end = +" + 33syn match sexplibNumber "-\=\<\d\(_\|\d\) * [ l|L|n ] \?\> " 34syn match sexplibNumber "-\=\<0 [ x|X ] \(\x\|_\)\+ [ l|L|n ] \?\> " 35syn match sexplibNumber "-\=\<0 [ o|O ] \(\o\|_\)\+ [ l|L|n ] \?\> " 36syn match sexplibNumber "-\=\<0 [ b|B ] \( [ 01 ] \|_\)\+ [ l|L|n ] \?\> " 37syn match sexplibFloat "-\=\<\d\(_\|\d\) * \.\?\(_\|\d\) * \( [ eE ][ -+ ] \=\d\(_\|\d\) * \)\=\> " 38 39" Lists 40syn region sexplibEncl transparent matchgroup = sexplibEncl start = "( "matchgroup = sexplibEncl end = ") "contains = ALLBUT , sexplibParenErr 41 42" Errors 43syn match sexplibUnquotedAtomErr /\( [ ^;()" \t#| ] \|# [ ^;()" \t| ] \|| [ ^;()" \t# ] \) [ ^;()" \t ] * \(#|\||#\) [ ^;()" \t ] * / 44syn match sexplibParenErr ") " 45 46" Synchronization 47syn sync minlines= 50 48syn sync maxlines= 500 49 50" Define the default highlighting. 51" For version 5.7 and earlier: only when not done already 52" For version 5.8 and later: only when an item doesn't have highlighting yet 53if version >= 508 || ! exists ( "did_sexplib_syntax_inits" ) 54if version < 508 55let did_sexplib_syntax_inits = 1 56command -nargs = + HiLink hi link <args> 57else 58command -nargs = + HiLink hi def link <args> 59endif 60 61HiLink sexplibParenErr Error 62HiLink sexplibUnquotedAtomErr Error 63 64HiLink sexplibComment Comment 65HiLink sexplibSexpComment Comment 66HiLink sexplibQuotedAtomComment Include 67HiLink sexplibUnquotedAtomComment Comment 68HiLink sexplibBlockComment Comment 69HiLink sexplibListComment Comment 70 71HiLink sexplibBoolean Boolean 72HiLink sexplibCharacter Character 73HiLink sexplibNumber Number 74HiLink sexplibFloat Float 75HiLink sexplibUnquotedAtom Identifier 76HiLink sexplibEncl Identifier 77HiLink sexplibQuotedAtom Keyword 78 79HiLink sexplibTodo Todo 80 81HiLink sexplibEncl Keyword 82 83delcommand HiLink 84endif 85 86let b: current_syntax = "sexplib" 87 88" vim: ts=8