codekingpro/portable-devtools
114k
1" Vim compiler file2" Language: jq3" Maintainer: Vito <vito.blog@gmail.com>4" Last Change: 2024 Apr 175" Upstream: https://github.com/vito-c/jq.vim6" 2025 Apr 16 by Vim Project (set 'cpoptions' for line continuation, #17121)7"8" Quit when a (custom) syntax file was already loaded9if exists('b:current_syntax')10 finish11endif12 13let s:cpo_save = &cpo14set cpo&vim15 16" syn include @jqHtml syntax/html.vim " Doc comment HTML17 18" jqTodo19syntax keyword jqTodo contained TODO FIXME NOTE XXX20 21" jqKeywords22syntax keyword jqKeywords and or not empty23syntax keyword jqKeywords try catch24syntax keyword jqKeywords reduce as label break foreach25syntax keyword jqKeywords import include module modulemeta26syntax keyword jqKeywords env nth has in while error stderr debug27 28" jqConditional29syntax keyword jqConditional if then elif else end30 31" jqConditions32syntax keyword jqCondtions true false null33 34" jqSpecials35syntax keyword jqType type36syntax match jqType /[\|;]/ " not really a type I did this for coloring reasons though :help group-name37syntax region jqParentheses start=+(+ end=+)+ fold transparent38 39" jq Functions40syntax keyword jqFunction add all any arrays ascii_downcase floor41syntax keyword jqFunction ascii_upcase booleans bsearch builtins capture combinations42syntax keyword jqFunction \contains del delpaths endswith explode43syntax keyword jqFunction finites first flatten format from_entries44syntax keyword jqFunction fromdate fromdateiso8601 fromjson fromstream get_jq_origin45syntax keyword jqFunction get_prog_origin get_search_list getpath gmtime group_by46syntax keyword jqFunction gsub halt halt_error implode index indices infinite47syntax keyword jqFunction input input_filename input_line_number inputs inside48syntax keyword jqFunction isempty isfinite isinfinite isnan isnormal iterables49syntax keyword jqFunction join keys keys_unsorted last leaf_paths50syntax keyword jqFunction length limit localtime ltrimstr map map_values51syntax keyword jqFunction match max max_by min min_by52syntax keyword jqFunction mktime nan normals now53syntax keyword jqFunction nulls numbers objects path paths range54syntax keyword jqFunction recurse recurse_down repeat reverse rindex55syntax keyword jqFunction rtrimstr scalars scalars_or_empty scan select56syntax keyword jqFunction setpath sort sort_by split splits with_entries57syntax keyword jqFunction startswith strflocaltime strftime strings strptime sub58syntax keyword jqFunction test to_entries todate todateiso8601 tojson __loc__59syntax keyword jqFunction tonumber tostream tostring transpose truncate_stream60syntax keyword jqFunction unique unique_by until utf8bytelength values walk61" TODO: $__loc__ is going to be a pain62 63" jq Math Functions64syntax keyword jqFunction acos acosh asin asinh atan atanh cbrt ceil cos cosh65syntax keyword jqFunction erf erfc exp exp10 exp2 expm1 fabs floor gamma j0 j166syntax keyword jqFunction lgamma lgamma_r log log10 log1p log2 logb nearbyint67syntax keyword jqFunction pow10 rint round significand sin sinh sqrt tan tanh68syntax keyword jqFunction tgamma trunc y0 y169syntax keyword jqFunction atan2 copysign drem fdim fmax fmin fmod frexp hypot70syntax keyword jqFunction jn ldexp modf nextafter nexttoward pow remainder71syntax keyword jqFunction scalb scalbln yn72syntax keyword jqFunction fma73 74" jq SQL-style Operators75syntax keyword jqFunction INDEX JOIN IN76 77" Macro78syntax match jqMacro "@\%(text\|json\|html\|uri\|[ct]sv\|sh\|base64d\?\)\>"79 80" Comments81syntax match jqComment "#.*" contains=jqTodo82 83" Variables84syn match jqVariables /$[_A-Za-z0-9]\+/85 86" Definition87syntax keyword jqKeywords def nextgroup=jqNameDefinition skipwhite88syn match jqNameDefinition /\<[_A-Za-z0-9]\+\>/ contained nextgroup=jqPostNameDefinition89syn match jqNameDefinition /`[^`]\+`/ contained nextgroup=jqPostNameDefinition90 91" Strings92syn region jqError start=+'+ end=+'\|$\|[;)]\@=+93syn region jqString matchgroup=jqQuote94 \ start=+"+ skip=+\\[\\"]+ end=+"+95 \ contains=@Spell,jqInterpolation96syn region jqInterpolation matchgroup=jqInterpolationDelimiter97 \ start=+\%([^\\]\%(\\\\\)*\\\)\@<!\\(+ end=+)+98 \ contained contains=TOP99 100" Operators101syn match jqOperator /:\|\([-+*/%<>=]\|\/\/\)=\?\|[!|]=\|?\/\//102"syn region jqRange matchgroup=jqSquareBracket start=+\[+ skip=+:+ end=+\]+103 104" Errors105syn keyword jqError _assign _flatten _modify _nwise _plus _negate _minus _multiply106syn keyword jqError _divide _mod _strindices _equal _notequal _less _greater _lesseq107syn keyword jqError _greatereq _sort_by_impl _group_by_impl _min_by_impl _max_by_impl _match_impl _input108" TODO: these errors should show up when doing def _flatten: as well109 110" Numbers111syn match jqNumber /\<0[dDfFlL]\?\>/ " Just a bare 0112syn match jqNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala113 114if !exists('jq_quote_highlight')115 highlight def link jqQuote String116else117 highlight def link jqQuote Type118endif119 120hi def link jqCondtions Boolean121hi def link jqVariables Identifier122hi def link jqNameDefinition Function123hi def link jqTodo Todo124hi def link jqComment Comment125hi def link jqKeywords Keyword126hi def link jqType Type127hi def link jqOperator Operator128hi def link jqFunction Function129hi def link jqMacro Macro130hi def link jqError Error131hi def link jqString String132hi def link jqInterpolationDelimiter Delimiter133hi def link jqConditional Conditional134hi def link jqNumber Number135 136let &cpo = s:cpo_save137unlet s:cpo_save138 