robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
34b4df774d
master
1" Vim compiler file 2" Language: jq 3" Maintainer: Vito <vito.blog@gmail.com> 4" Last Change: 2024 Apr 17 5" Upstream: https://github.com/vito-c/jq.vim 6" 2025 Apr 16 by Vim Project (set 'cpoptions' for line continuation, #17121) 7" 8" Quit when a (custom) syntax file was already loaded 9if exists ( 'b:current_syntax' ) 10finish 11endif 12 13let s: cpo_save = & cpo 14set cpo & vim 15 16" syn include @jqHtml syntax/html.vim " Doc comment HTML 17 18" jqTodo 19syntax keyword jqTodo contained TODO FIXME NOTE XXX 20 21" jqKeywords 22syntax keyword jqKeywords and or not empty 23syntax keyword jqKeywords try catch 24syntax keyword jqKeywords reduce as label break foreach 25syntax keyword jqKeywords import include module modulemeta 26syntax keyword jqKeywords env nth has in while error stderr debug 27 28" jqConditional 29syntax keyword jqConditional if then elif else end 30 31" jqConditions 32syntax keyword jqCondtions true false null 33 34" jqSpecials 35syntax keyword jqType type 36syntax match jqType /[ \|; ] /" not really a type I did this for coloring reasons though :help group-name 37syntax region jqParentheses start = +( +end = +) +fold transparent 38 39" jq Functions 40syntax keyword jqFunction add all any arrays ascii_downcase floor 41syntax keyword jqFunction ascii_upcase booleans bsearch builtins capture combinations 42syntax keywordjqFunction \contains del delpaths endswith explode 43syntax keyword jqFunction finites first flatten format from_entries 44syntax keyword jqFunction fromdate fromdateiso8601 fromjson fromstream get_jq_origin 45syntax keyword jqFunction get_prog_origin get_search_list getpath gmtime group_by 46syntax keyword jqFunction gsub halt halt_error implode index indices infinite 47syntax keyword jqFunction input input_filename input_line_number inputs inside 48syntax keyword jqFunction isempty isfinite isinfinite isnan isnormal iterables 49syntax keyword jqFunction join keys keys_unsorted last leaf_paths 50syntax keyword jqFunction length limit localtime ltrimstr map map_values 51syntax keyword jqFunction match max max_by min min_by 52syntax keyword jqFunction mktime nan normals now 53syntax keyword jqFunction nulls numbers objects path paths range 54syntax keyword jqFunction recurse recurse_down repeat reverse rindex 55syntax keyword jqFunction rtrimstr scalars scalars_or_empty scan select 56syntax keyword jqFunction setpath sort sort_by split splits with_entries 57syntax keyword jqFunction startswith strflocaltime strftime strings strptime sub 58syntax keyword jqFunction test to_entries todate todateiso8601 tojson __loc__ 59syntax keyword jqFunction tonumber tostream tostring transpose truncate_stream 60syntax keyword jqFunction unique unique_by until utf8bytelength values walk 61" TODO: $__loc__ is going to be a pain 62 63" jq Math Functions 64syntax keyword jqFunction acos acosh asin asinh atan atanh cbrt ceil cos cosh 65syntax keyword jqFunction erf erfc exp exp10 exp2 expm1 fabs floor gamma j0 j1 66syntax keyword jqFunction lgamma lgamma_r log log10 log1p log2 logb nearbyint 67syntax keyword jqFunction pow10 rint round significand sin sinh sqrt tan tanh 68syntax keyword jqFunction tgamma trunc y0 y1 69syntax keyword jqFunction atan2 copysign drem fdim fmax fmin fmod frexp hypot 70syntax keyword jqFunction jn ldexp modf nextafter nexttoward pow remainder 71syntax keyword jqFunction scalb scalbln yn 72syntax keyword jqFunction fma 73 74" jq SQL-style Operators 75syntax keyword jqFunction INDEX JOIN IN 76 77" Macro 78syntax match jqMacro "@\%(text\|json\|html\|uri\| [ ct ] sv\|sh\|base64d\?\)\> " 79 80" Comments 81syntax match jqComment "#. * "contains = jqTodo 82 83" Variables 84syn match jqVariables /$ [ _A-Za-z0-9 ] \+ / 85 86" Definition 87syntax keyword jqKeywords def nextgroup = jqNameDefinition skipwhite 88syn match jqNameDefinition /\< [ _A-Za-z0-9 ] \+\> /contained nextgroup = jqPostNameDefinition 89syn match jqNameDefinition /` [ ^` ] \+` /contained nextgroup = jqPostNameDefinition 90 91" Strings 92syn region jqError start = +' +end = +'\|$\| [ ;) ] \@= + 93syn region jqString matchgroup = jqQuote 94 \start = +" +skip = +\\ [ \\" ] +end = +" + 95 \contains = @Spell , jqInterpolation 96syn region jqInterpolation matchgroup = jqInterpolationDelimiter 97 \start = +\%( [ ^\\ ] \%(\\\\\) * \\\)\@<!\\( +end = +) + 98 \contained contains = TOP 99 100" Operators 101syn match jqOperator /:\|\( [ -+*/%<>= ] \|\/\/\)=\?\| [ !| ] =\|?\/\/ / 102"syn region jqRange matchgroup=jqSquareBracket start=+\[+ skip=+:+ end=+\]+ 103 104" Errors 105syn keyword jqError _assign _flatten _modify _nwise _plus _negate _minus _multiply 106syn keyword jqError _divide _mod _strindices _equal _notequal _less _greater _lesseq 107syn keyword jqError _greatereq _sort_by_impl _group_by_impl _min_by_impl _max_by_impl _match_impl _input 108" TODO: these errors should show up when doing def _flatten: as well 109 110" Numbers 111syn match jqNumber /\<0 [ dDfFlL ] \?\> /" Just a bare 0 112syn match jqNumber /\< [ 1-9 ] \d * [ dDfFlL ] \?\> /" A multi-digit number - octal numbers with leading 0's are deprecated in Scala 113 114if ! exists ( 'jq_quote_highlight' ) 115highlight def link jqQuote String 116else 117highlight def link jqQuote Type 118endif 119 120hi def link jqCondtions Boolean 121hi def link jqVariables Identifier 122hi def link jqNameDefinition Function 123hi def link jqTodo Todo 124hi def link jqComment Comment 125hi def link jqKeywords Keyword 126hi def link jqType Type 127hi def link jqOperator Operator 128hi def link jqFunction Function 129hi def link jqMacro Macro 130hi def link jqError Error 131hi def link jqString String 132hi def link jqInterpolationDelimiter Delimiter 133hi def link jqConditional Conditional 134hi def link jqNumber Number 135 136let & cpo = s: cpo_save 137unlet s: cpo_save