mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-11 21:13:50 -05:00
Update
This commit is contained in:
@@ -36,11 +36,11 @@ let s:julia_highlight_operators = get(g:, "julia_highlight_operators", 1)
|
||||
" characters which cannot be used in identifiers. This list is very incomplete:
|
||||
" 1) it only cares about charactes below 256
|
||||
" 2) it doesn't distinguish between what's allowed as the 1st char vs in the
|
||||
" rest of an identifier (e.g. digits, `!` and `?`)
|
||||
" rest of an identifier (e.g. digits and `!`)
|
||||
" Despite these shortcomings, it seems to do a decent job.
|
||||
" note: \U5B and \U5D are '[' and ']'
|
||||
let s:nonid_chars = "\U01-\U07" . "\U0E-\U1F" .
|
||||
\ "\"#$'(,.:;=@`\\U5B{" .
|
||||
\ "?\"#$'(,.:;=@`\\U5B{" .
|
||||
\ "\U80-\UA1" . "\UA7\UA8\UAB\UAD\UAF\UB4" . "\UB6-\UB8" . "\UBB\UBF"
|
||||
|
||||
let s:nonidS_chars = "[:space:])\\U5D}" . s:nonid_chars
|
||||
@@ -64,7 +64,7 @@ let s:binop_chars = "=+\\U2D*/\\%÷^&|⊻<>≤≥≡≠≢∈∉⋅×∪∩⊆
|
||||
let s:binop_chars_extra = "\\U214B\\U2190-\\U2194\\U219A\\U219B\\U21A0\\U21A3\\U21A6\\U21AE\\U21CE\\U21CF\\U21D2\\U21D4\\U21F4-\\U21FF\\U2208-\\U220D\\U2213\\U2214\\U2217-\\U2219\\U221D\\U2224-\\U222A\\U2237\\U2238\\U223A\\U223B\\U223D\\U223E\\U2240-\\U228B\\U228D-\\U229C\\U229E-\\U22A3\\U22A9\\U22AC\\U22AE\\U22B0-\\U22B7\\U22BB-\\U22BD\\U22C4-\\U22C7\\U22C9-\\U22D3\\U22D5-\\U22ED\\U22F2-\\U22FF\\U25B7\\U27C8\\U27C9\\U27D1\\U27D2\\U27D5-\\U27D7\\U27F0\\U27F1\\U27F5-\\U27F7\\U27F7\\U27F9-\\U27FF\\U2900-\\U2918\\U291D-\\U2920\\U2944-\\U2970\\U29B7\\U29B8\\U29BC\\U29BE-\\U29C1\\U29E1\\U29E3-\\U29E5\\U29F4\\U29F6\\U29F7\\U29FA\\U29FB\\U2A07\\U2A08\\U2A1D\\U2A22-\\U2A2E\\U2A30-\\U2A3D\\U2A40-\\U2A45\\U2A4A-\\U2A58\\U2A5A-\\U2A63\\U2A66\\U2A67\\U2A6A-\\U2AD9\\U2ADB\\U2AF7-\\U2AFA\\U2B30-\\U2B44\\U2B47-\\U2B4C\\UFFE9-\\UFFEC"
|
||||
|
||||
" a Julia identifier, sort of
|
||||
let s:idregex = '\%([^' . s:nonidS_chars . '0-9!?' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*\)'
|
||||
let s:idregex = '\%([^' . s:nonidS_chars . '0-9!' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*\)'
|
||||
|
||||
let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .
|
||||
\ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|>:\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' .
|
||||
@@ -74,11 +74,11 @@ let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .
|
||||
|
||||
syn case match
|
||||
|
||||
syntax cluster juliaExpressions contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems
|
||||
syntax cluster juliaExpressions contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems,@juliaSyntaxRegions
|
||||
syntax cluster juliaExprsPrintf contains=@juliaExpressions,@juliaPrintfItems
|
||||
|
||||
syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraIdxBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar
|
||||
syntax cluster juliaKeywordItems contains=juliaKeyword,juliaImportLine,juliaInfixKeyword,juliaRepKeyword
|
||||
syntax cluster juliaKeywordItems contains=juliaKeyword,juliaWhereKeyword,juliaImportLine,juliaInfixKeyword,juliaRepKeyword
|
||||
syntax cluster juliaBlocksItems contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock,juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock
|
||||
syntax cluster juliaTypesItems contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther
|
||||
|
||||
@@ -93,6 +93,8 @@ syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juli
|
||||
syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM
|
||||
syntax cluster juliaErrorItems contains=juliaErrorPar,juliaErrorEnd,juliaErrorElse,juliaErrorCatch,juliaErrorFinally
|
||||
|
||||
syntax cluster juliaSyntaxRegions contains=juliaParamTypeR,juliaFunctionCallR,juliaTypeOperatorR,juliaWhereR
|
||||
|
||||
syntax cluster juliaSpellcheckStrings contains=@spell
|
||||
syntax cluster juliaSpellcheckDocStrings contains=@spell
|
||||
syntax cluster juliaSpellcheckComments contains=@spell
|
||||
@@ -126,9 +128,21 @@ syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contain
|
||||
syntax region juliaParBlockInRange matchgroup=juliaParDelim contained start="(" end=")" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeKeyword,juliaComprehensionFor
|
||||
syntax region juliaSqBraIdxBlock matchgroup=juliaParDelim start="\[" end="\]" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeKeyword,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
|
||||
exec 'syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\%(^\|\s\|' . s:operators . '\)\@'.s:d(3).'<=\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
|
||||
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions
|
||||
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=juliaType,@juliaExpressions
|
||||
|
||||
exec 'syntax match juliaKeyword display "'.s:nodot.'\<\%(return\|local\|global\|const\|where\)\>"'
|
||||
exec 'syntax match juliaType contained "' . s:idregex . '\%(\.' . s:idregex . '\)*"'
|
||||
|
||||
exec 'syntax region juliaFunctionCallR transparent start="' . s:idregex . '\%(\.' . s:idregex . '\)*\s*(" end=")\@'.s:d(1).'<=" contains=juliaFunctionCall,juliaParBlock'
|
||||
exec 'syntax match juliaFunctionCall contained "\%(' . s:idregex . '\.\)*\zs' . s:idregex . '"'
|
||||
|
||||
" note: we would in principle add a "s:nodot" before function/macro/struct/... but it shouldn't come up in valid code
|
||||
exec 'syntax match juliaFunctionDef contained transparent "\%(\<\%(function\|macro\)\s\+\)\@'.s:d(20).'<=' . s:idregex . '\%(\.' . s:idregex . '\)*\ze\s\+\%(end\>\|$\)" contains=juliaFunctionName'
|
||||
exec 'syntax region juliaFunctionDefP contained transparent start="\%(\<\%(function\|macro\)\s\+\)\@'.s:d(20).'<=' . s:idregex . '\%(\.' . s:idregex . '\)*\s*(" end=")\@'.s:d(1).'<=" contains=juliaFunctionName,juliaParBlock'
|
||||
exec 'syntax match juliaFunctionName contained "\%(\<\%(function\|macro\)\s\+\)\@'.s:d(20).'<=\%(' . s:idregex . '\.\)*\zs' . s:idregex . '"'
|
||||
|
||||
exec 'syntax match juliaStructR contained transparent "\%(\<\%(\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\)\s\+\)\@'.s:d(20).'<=\%(' . s:idregex . '\.\)*' . s:idregex . '\>\(\s*(\)\@!" contains=juliaType'
|
||||
|
||||
exec 'syntax match juliaKeyword display "'.s:nodot.'\<\%(return\|local\|global\|const\)\>"'
|
||||
syntax match juliaInfixKeyword display "\%(=\s*\)\@<!\<\%(in\|isa\)\>\S\@!\%(\s*=\)\@!"
|
||||
|
||||
" The import/export/using keywords introduce a sort of special parsing
|
||||
@@ -144,26 +158,25 @@ exec 'syntax region juliaWhileBlock matchgroup=juliaRepeat start="'.s:nodot.'\
|
||||
exec 'syntax region juliaForBlock matchgroup=juliaRepeat start="'.s:nodot.'\<for\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions,juliaOuter fold'
|
||||
exec 'syntax region juliaBeginBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<begin\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<function\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions,juliaFunctionDef,juliaFunctionDefP fold'
|
||||
exec 'syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<macro\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<macro\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions,juliaFunctionDef,juliaFunctionDefP fold'
|
||||
exec 'syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<quote\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<mutable\s\+struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions,juliaStructR fold'
|
||||
exec 'syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<mutable\s\+struct\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions,juliaStructR fold'
|
||||
exec 'syntax region juliaLetBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<let\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaDoBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<do\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaModuleBlock matchgroup=juliaBlKeyword start="\%(\%(\.\s*\)\@'.s:d(6).'<!\|\%(@\s*\.\s*\)\@'.s:d(6).'<=\)\<\%(bare\)\?module\>" end="\<end\>" contains=@juliaExpressions fold'
|
||||
exec 'syntax region juliaExceptionBlock matchgroup=juliaException start="'.s:nodot.'\<try\>" end="'.s:nodot.'\<end\>" contains=@juliaExpressions,juliaCatchBlock,juliaFinallyBlock fold'
|
||||
exec 'syntax region juliaCatchBlock matchgroup=juliaException transparent contained start="'.s:nodot.'\<catch\>" end="'.s:nodot.'\<end\>"me=s-1 contains=@juliaExpressions,juliaFinallyBlock'
|
||||
exec 'syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="'.s:nodot.'\<finally\>" end="'.s:nodot.'\<end\>"me=s-1 contains=@juliaExpressions'
|
||||
" AbstractBlock needs to come after to take precedence
|
||||
exec 'syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<abstract\s\+type\>" end="'.s:nodot.'\<end\>" fold contains=@juliaExpressions'
|
||||
exec 'syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<primitive\s\+type\>" end="'.s:nodot.'\<end\>" fold contains=@juliaExpressions'
|
||||
exec 'syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="'.s:nodot.'\<finally\>" end="'.s:nodot.'\<end\>"me=s-1 contains=@juliaExpressions'
|
||||
exec 'syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<abstract\s\+type\>" end="'.s:nodot.'\<end\>" fold contains=@juliaExpressions,juliaStructR'
|
||||
exec 'syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="'.s:nodot.'\<primitive\s\+type\>" end="'.s:nodot.'\<end\>" fold contains=@juliaExpressions,juliaStructR'
|
||||
|
||||
exec 'syntax region juliaComprehensionFor matchgroup=juliaComprehensionFor transparent contained start="\%([^[:space:],;:({[]\_s*\)\@'.s:d(80).'<=\<for\>" end="\ze[]);]" contains=@juliaExpressions,juliaComprehensionIf,juliaComprehensionFor'
|
||||
exec 'syntax match juliaComprehensionIf contained "'.s:nodot.'\<if\>"'
|
||||
|
||||
exec 'syntax match juliaOuter contained "\<outer\ze\s\+' . s:idregex . '\>"'
|
||||
|
||||
syntax match juliaRangeKeyword display contained "\<\%(begin\|end\)\>"
|
||||
syntax match juliaRangeKeyword contained "\<\%(begin\|end\)\>"
|
||||
|
||||
syntax match juliaBaseTypeBasic display "\<\%(\%(N\|Named\)\?Tuple\|Symbol\|Function\|Union\%(All\)\?\|Type\%(Name\|Var\)\?\|Any\|ANY\|Vararg\|Ptr\|Exception\|Module\|Expr\|DataType\|\%(LineNumber\|Quote\)Node\|\%(Weak\|Global\)\?Ref\|Method\|Pair\|Val\|Nothing\|Some\|Missing\)\>"
|
||||
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|\%(Abstract\)\?Irrational\|Enum\|BigInt\|BigFloat\|MathConst\|ComplexF\%(16\|32\|64\)\)\>"
|
||||
@@ -201,11 +214,9 @@ syntax match juliaConstIO display "\<\%(std\%(out\|in\|err\)\|devnull\)\>"
|
||||
syntax match juliaConstC display "\<\%(C_NULL\)\>"
|
||||
syntax match juliaConstGeneric display "\<\%(nothing\|Main\|undef\|missing\)\>"
|
||||
|
||||
exec 'syntax match juliaFunctionDef contained transparent "\%(\<function\s\+\)\@'.s:d(20).'<=' . s:idregex . '\%(\.' . s:idregex . '\)*\ze\s\+\%(end\>\|$\)" contains=juliaFunctionName'
|
||||
exec 'syntax region juliaFunctionDefP contained transparent start="\%(\<function\s\+\)\@'.s:d(20).'<=' . s:idregex . '\%(\.' . s:idregex . '\)*\s*(" end=")\@'.s:d(1).'<=" contains=juliaFunctionName,juliaParBlock'
|
||||
exec 'syntax match juliaFunctionName contained "\%(\<function\s\+\)\@'.s:d(20).'<=' . s:idregex . '\%(\.' . s:idregex . '\)*"'
|
||||
exec 'syntax region juliaParamTypeR transparent start="' . s:idregex . '\%(\.' . s:idregex . '\)*\s*{" end="}\@'.s:d(1).'<=" contains=juliaType,@juliaExpressions'
|
||||
|
||||
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
|
||||
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro,juliaDocMacro
|
||||
|
||||
exec 'syntax match juliaMacro contained "@' . s:idregex . '\%(\.' . s:idregex . '\)*"'
|
||||
syntax match juliaMacro contained "@[!.~$%^*/\\|<>+-]\ze[^0-9]"
|
||||
@@ -253,11 +264,11 @@ exec 'syntax match juliaNumber contained "' . s:int_regex . '" contains=juliaC
|
||||
exec 'syntax match juliaFloat contained "' . s:float_regex . '" contains=juliaComplexUnit'
|
||||
syntax match juliaComplexUnit display contained "\<im\>"
|
||||
|
||||
exec 'syntax match juliaOperator "' . s:operators . '"'
|
||||
syntax match juliaRangeOperator display ":"
|
||||
exec 'syntax match juliaOperator "' . s:operators . '"'
|
||||
exec 'syntax region juliaTernaryRegion matchgroup=juliaTernaryOperator start="\s\zs?\ze\s" skip="\%(:\(:\|[^:[:space:]'."'".'"({[]\+\s*\ze:\)\|\%(?\s*\)\@'.s:d(6).'<=:(\)" end=":" contains=@juliaExpressions,juliaErrorSemicol'
|
||||
|
||||
let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!?]\|^\)\@'.s:d(1).'<=\$'
|
||||
let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!]\|^\)\@'.s:d(1).'<=\$'
|
||||
|
||||
exec 'syntax match juliaDollarVar display contained "' . s:interp_dollar . s:idregex . '"'
|
||||
exec 'syntax region juliaDollarPar matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '(" end=")" contains=@juliaExpressions'
|
||||
@@ -269,7 +280,7 @@ syntax match juliaChar display "'\\x\x\{2\}'" contains=juliaHexEscapeChar
|
||||
syntax match juliaChar display "'\\u\x\{1,4\}'" contains=juliaUniCharSmall
|
||||
syntax match juliaChar display "'\\U\x\{1,8\}'" contains=juliaUniCharLarge
|
||||
|
||||
exec 'syntax match juliaCTransOperator "[[:space:]}' . s:nonid_chars . s:uniop_chars . s:binop_chars . '!?]\@'.s:d(1).'<!\.\?' . "'" . '"'
|
||||
exec 'syntax match juliaCTransOperator "[[:space:]}' . s:nonid_chars . s:uniop_chars . s:binop_chars . '!]\@'.s:d(1).'<!\.\?' . "'" . 'ᵀ\?"'
|
||||
|
||||
" TODO: some of these might be specialized; the rest could be just left to the
|
||||
" generic juliaStringPrefixed fallback
|
||||
@@ -293,6 +304,9 @@ syntax region juliaPrintfMacro contained transparent start="@s\?printf\s\+" en
|
||||
syntax region juliaPrintfParBlock contained matchgroup=juliaParDelim start="(" end=")" contains=@juliaExprsPrintf
|
||||
syntax region juliaPrintfString contained matchgroup=juliaStringDelim start=+"+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=@juliaSpecialChars,@juliaPrintfChars
|
||||
|
||||
exec 'syntax region juliaDocMacro contained transparent start=+@doc\s\+\%(' . s:idregex . '\%(\.' . s:idregex . '\)*\)\?\z("\%(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\(\z1\)\@'.s:d(3).'<=+ contains=juliaMacro,juliaDocStringM'
|
||||
syntax region juliaDocStringM contained fold matchgroup=juliaDocStringDelim fold start=+\z\("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings
|
||||
|
||||
syntax region juliaShellString matchgroup=juliaStringDelim start=+`+ skip=+\%(\\\\\)*\\`+ end=+`+ contains=@juliaStringVars,juliaSpecialChar
|
||||
|
||||
syntax cluster juliaStringVars contains=juliaStringVarsPar,juliaStringVarsSqBra,juliaStringVarsCurBra,juliaStringVarsPla
|
||||
@@ -326,7 +340,7 @@ syntax match juliaPrintfFmt display contained "\\%%"hs=s+1
|
||||
syntax match juliaPossibleSymbol transparent ":\ze[^:]" contains=juliaSymbol,juliaQuotedParBlock,juliaQuotedQMarkPar,juliaColon
|
||||
|
||||
let s:quotable = '\%(' . s:idregex . '\|?\|' . s:operators . '\|' . s:float_regex . '\|' . s:int_regex . '\)'
|
||||
let s:quoting_colon = '\%(\%(^\s*\|\s\{6,\}\|[' . s:nonid_chars . s:uniop_chars . s:binop_chars . '?]\s*\)\@'.s:d(6).'<=\|\%(\<\%(return\|if\|else\%(if\)\?\|while\|try\|begin\)\s\+\)\@'.s:d(9).'<=\)\zs:'
|
||||
let s:quoting_colon = '\%(\%(^\s*\|\s\{6,\}\|[' . s:nonid_chars . s:uniop_chars . s:binop_chars . ']\s*\)\@'.s:d(6).'<=\|\%(\<\%(return\|if\|else\%(if\)\?\|while\|try\|begin\)\s\+\)\@'.s:d(9).'<=\)\zs:'
|
||||
let s:quoting_colonS = '\s\@'.s:d(1).'<=:'
|
||||
|
||||
" note: juliaSymbolS only works within whitespace-sensitive contexts,
|
||||
@@ -336,7 +350,7 @@ let s:quoting_colonS = '\s\@'.s:d(1).'<=:'
|
||||
" (Note that such `a :b` expressions only allows at most 5 spaces between
|
||||
" the identifier and the colon anyway.)
|
||||
|
||||
exec 'syntax match juliaSymbol contained "' .s:quoting_colon . s:quotable . '"'
|
||||
exec 'syntax match juliaSymbol contained "' . s:quoting_colon . s:quotable . '"'
|
||||
exec 'syntax match juliaSymbolS contained "' . s:quoting_colonS . s:quotable . '"'
|
||||
|
||||
" same as above for quoted expressions such as :(expr)
|
||||
@@ -346,7 +360,14 @@ exec 'syntax region juliaQuotedParBlockS matchgroup=juliaQParDelim contained s
|
||||
|
||||
|
||||
" force precedence over Symbols
|
||||
syntax match juliaOperator display "::"
|
||||
exec 'syntax match juliaTypeOperatorR transparent "[<>:]:\s*\%(' . s:idregex . '\.\)*' . s:idregex . '" contains=juliaTypeOperator,juliaType,@juliaExpressions'
|
||||
exec 'syntax match juliaTypeOperatorR transparent "' . s:idregex . '\%(\.' . s:idregex . '\)*\s*[<>]:\s*\%(\%(' . s:idregex . '\.\)*' . s:idregex . '\)\?" contains=juliaTypeOperator,juliaType,@juliaExpressions'
|
||||
exec 'syntax match juliaTypeOperatorR transparent "\<isa\s\+\%(' . s:idregex . '\.\)*' . s:idregex . '" contains=juliaIsaKeyword,juliaType,@juliaExpressions'
|
||||
syntax match juliaTypeOperator contained "[:<>]:"
|
||||
syntax match juliaIsaKeyword contained "\<isa\>"
|
||||
|
||||
syntax match juliaWhereKeyword "\<where\>"
|
||||
exec 'syntax match juliaWhereR transparent "\<where\s\+' . s:idregex . '" contains=juliaWhereKeyword,juliaType,juliaTypeOperatorR'
|
||||
|
||||
syntax region juliaCommentL matchgroup=juliaCommentDelim excludenl start="#\ze\%([^=]\|$\)" end="$" contains=juliaTodo,@juliaSpellcheckComments
|
||||
syntax region juliaCommentM matchgroup=juliaCommentDelim fold start="#=\ze\%([^#]\|$\)" end="=#" contains=juliaTodo,juliaCommentM,@juliaSpellcheckComments
|
||||
@@ -370,15 +391,19 @@ exec 'syntax match juliaMacroName "@' . s:idregex . '\%(\.' . s:idregex . '\)
|
||||
hi def link juliaParDelim juliaNone
|
||||
hi def link juliaSemicolon juliaNone
|
||||
hi def link juliaComma juliaNone
|
||||
hi def link juliaFunctionCall juliaNone
|
||||
|
||||
hi def link juliaColon juliaOperator
|
||||
|
||||
hi def link juliaFunctionName juliaFunction
|
||||
hi def link juliaFunctionName1 juliaFunction
|
||||
hi def link juliaMacroName juliaMacro
|
||||
|
||||
|
||||
hi def link juliaKeyword Keyword
|
||||
hi def link juliaWhereKeyword Keyword
|
||||
hi def link juliaInfixKeyword Keyword
|
||||
hi def link juliaIsaKeyword Keyword
|
||||
hi def link juliaAsKeyword Keyword
|
||||
hi def link juliaRepKeyword Keyword
|
||||
hi def link juliaBlKeyword Keyword
|
||||
@@ -408,6 +433,8 @@ hi def link juliaBaseTypeDisplay Type
|
||||
hi def link juliaBaseTypeTime Type
|
||||
hi def link juliaBaseTypeOther Type
|
||||
|
||||
hi def link juliaType Type
|
||||
|
||||
" NOTE: deprecated constants are not highlighted as such. For once,
|
||||
" one can still legitimately use them by importing Base.MathConstants.
|
||||
" Plus, one-letter variables like `e` and `γ` can be used with other
|
||||
@@ -458,6 +485,7 @@ hi def link juliaint128String juliaString
|
||||
hi def link juliaPrintfString juliaString
|
||||
hi def link juliaShellString juliaString
|
||||
hi def link juliaDocString juliaString
|
||||
hi def link juliaDocStringM juliaDocString
|
||||
hi def link juliaStringDelim juliaString
|
||||
hi def link juliaDocStringDelim juliaDocString
|
||||
hi def link juliaStringVarsPla Identifier
|
||||
@@ -484,6 +512,7 @@ hi def link juliaOperator juliaOperatorHL
|
||||
hi def link juliaRangeOperator juliaOperatorHL
|
||||
hi def link juliaCTransOperator juliaOperatorHL
|
||||
hi def link juliaTernaryOperator juliaOperatorHL
|
||||
hi def link juliaTypeOperator juliaOperatorHL
|
||||
|
||||
hi def link juliaCommentL Comment
|
||||
hi def link juliaCommentM Comment
|
||||
|
||||
Reference in New Issue
Block a user