%YAML 1.2 --- # https://www.sublimetext.com/docs/3/syntax.html # https://www.sublimetext.com/docs/3/scope_naming.html # Julia is a language under development, this syntax strives to # support the latest version of Julia. # Julia is currently transitioning from version 0.5 to 0.6, # the changes in 0.6 are listed here https://github.com/JuliaLang/julia/blob/master/NEWS.md # Some syntax is being removed, but kept for now as deprecated, such # features are marked with "# DEPRECATED 0.6" in this file. # TODO: When 0.6 is properly released, re-run all generated regexes, ones commented with "# julia> ...". # The current 0.6 alpha had some issues... name: Julia file_extensions: [jl] first_line_match: ^#!.*\bjulia\s*$ scope: source.julia variables: symb_op_ascii: '[-+*/\\=^:<>~?&$%|]' # The list of unicode symbols allowed as operators is fetched from the Julia parser https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm symb_op_unicode: '[≤≥¬←→↔↚↛↠↣↦↮⇎⇏⇒⇔⇴⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿⟵⟶⟷⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤌⤍⤎⤏⤐⤑⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥊⥋⥎⥐⥒⥓⥖⥗⥚⥛⥞⥟⥢⥤⥦⥧⥨⥩⥪⥫⥬⥭⥰⧴⬱⬰⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←→≡≠≢∈∉∋∌⊆⊈⊂⊄⊊∝∊∍∥∦∷∺∻∽∾≁≃≄≅≆≇≈≉≊≋≌≍≎≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≣≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊃⊅⊇⊉⊋⊏⊐⊑⊒⊜⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⋍⋐⋑⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⟈⟉⟒⦷⧀⧁⧡⧣⧤⧥⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫷⫸⫹⫺⊢⊣⊕⊖⊞⊟∪∨⊔±∓∔∸≂≏⊎⊻⊽⋎⋓⧺⧻⨈⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨹⨺⩁⩂⩅⩊⩌⩏⩐⩒⩔⩖⩗⩛⩝⩡⩢⩣÷⋅∘×∩∧⊗⊘⊙⊚⊛⊠⊡⊓∗∙∤⅋≀⊼⋄⋆⋇⋉⋊⋋⋌⋏⋒⟑⦸⦼⦾⦿⧶⧷⨇⨰⨱⨲⨳⨴⨵⨶⨷⨸⨻⨼⨽⩀⩃⩄⩋⩍⩎⩑⩓⩕⩘⩚⩜⩞⩟⩠⫛⊍▷⨝⟕⟖⟗↑↓⇵⟰⟱⤈⤉⤊⤋⤒⤓⥉⥌⥍⥏⥑⥔⥕⥘⥙⥜⥝⥠⥡⥣⥥⥮⥯↑↓]' symb_op: '(?:{{symb_op_ascii}}|{{symb_op_unicode}})' # Multi-character operators long_op: (?:\+=|-=|\*=|/=|//=|\\\\=|^=|÷=|%=|<<=|>>=|>>>=|\|=|&=|:=|=>|$=|\|\||<:|>:|\|>|<\||//|\+\+) # julia> join(sort(unique((filter(x -> isalpha(x[1]), string.(filter!(x -> isa(eval(x), DataType) || isa(eval(x), TypeConstructor), [names(Base); names(Core)])))))), "|") # Julia 0.6 seems to uses UnionAll instead of TypeConstructor # Compare with https://github.com/JuliaLang/julia/blob/master/base/exports.jl base_types: \b(?:AbstractArray|AbstractChannel|AbstractFloat|AbstractMatrix|AbstractRNG|AbstractSerializer|AbstractSparseArray|AbstractSparseMatrix|AbstractSparseVector|AbstractString|AbstractUnitRange|AbstractVecOrMat|AbstractVector|Any|ArgumentError|Array|AssertionError|Associative|Base64DecodePipe|Base64EncodePipe|Bidiagonal|BigFloat|BigInt|BitArray|BitMatrix|BitVector|Bool|BoundsError|BufferStream|CachingPool|CapturedException|CartesianIndex|CartesianRange|Cchar|Cdouble|Cfloat|Channel|Char|Cint|Cintmax_t|Clong|Clonglong|ClusterManager|Cmd|Colon|Complex|Complex128|Complex32|Complex64|CompositeException|Condition|Cptrdiff_t|Cshort|Csize_t|Cssize_t|Cstring|Cuchar|Cuint|Cuintmax_t|Culong|Culonglong|Cushort|Cwchar_t|Cwstring|DataType|Date|DateTime|DenseArray|DenseMatrix|DenseVecOrMat|DenseVector|Diagonal|Dict|DimensionMismatch|Dims|DirectIndexString|Display|DivideError|DomainError|EOFError|EachLine|Enum|Enumerate|ErrorException|Exception|Expr|Factorization|FileMonitor|Filter|Float16|Float32|Float64|FloatRange|Function|Future|GlobalRef|GotoNode|HTML|Hermitian|IO|IOBuffer|IOContext|IOStream|IPAddr|IPv4|IPv6|InexactError|InitError|Int|Int128|Int16|Int32|Int64|Int8|IntSet|Integer|InterruptException|InvalidStateException|Irrational|KeyError|LabelNode|LambdaInfo|LinSpace|LineNumberNode|LoadError|LowerTriangular|MIME|Matrix|MersenneTwister|Method|MethodError|MethodTable|Module|NTuple|NewvarNode|NullException|Nullable|Number|ObjectIdDict|OrdinalRange|OutOfMemoryError|OverflowError|Pair|ParseError|PartialQuickSort|Pipe|PollingFileWatcher|ProcessExitedException|Ptr|QuoteNode|RandomDevice|Range|Rational|RawFD|ReadOnlyMemoryError|Real|ReentrantLock|Ref|Regex|RegexMatch|RemoteChannel|RemoteException|RepString|RevString|RoundingMode|SSAValue|SegmentationFault|SerializationState|Set|SharedArray|SharedMatrix|SharedVector|Signed|SimpleVector|Slot|SlotNumber|SparseMatrixCSC|SparseVector|StackFrame|StackOverflowError|StackTrace|StepRange|StridedArray|StridedMatrix|StridedVecOrMat|StridedVector|String|SubArray|SubString|SymTridiagonal|Symbol|Symmetric|SystemError|TCPSocket|Task|Text|TextDisplay|Timer|Tridiagonal|Tuple|Type|TypeConstructor|TypeError|TypeMapEntry|TypeMapLevel|TypeName|TypeVar|TypedSlot|UDPSocket|UInt|UInt128|UInt16|UInt32|UInt64|UInt8|UndefRefError|UndefVarError|UnicodeError|UniformScaling|Union|UnitRange|Unsigned|UpperTriangular|Val|Vararg|VecElement|VecOrMat|Vector|VersionNumber|Void|WeakKeyDict|WeakRef|WorkerConfig|WorkerPool|Zip)\b # julia> join(filter!(x -> isascii(x[1]) && isalpha(x[1]) && islower(x[1]), map(string, [names(Base); names(Core)])), '|') base_funcs: (?:abs|abs2|abspath|accept|acos|acosd|acosh|acot|acotd|acoth|acsc|acscd|acsch|addprocs|airy|airyai|airyaiprime|airybi|airybiprime|airyprime|airyx|all|all!|allunique|angle|any|any!|append!|apropos|ascii|asec|asecd|asech|asin|asind|asinh|assert|asyncmap|atan|atan2|atand|atanh|atexit|atreplinit|backtrace|base|base64decode|base64encode|basename|besselh|besselhx|besseli|besselix|besselj|besselj0|besselj1|besseljx|besselk|besselkx|bessely|bessely0|bessely1|besselyx|beta|bfft|bfft!|big|bin|bind|binomial|bitbroadcast|bitpack|bitrand|bits|bitunpack|bkfact|bkfact!|blas_set_num_threads|blkdiag|brfft|broadcast|broadcast!|broadcast!_function|broadcast_function|broadcast_getindex|broadcast_setindex!|bswap|bytes2hex|bytestring|call|cat|catalan|catch_backtrace|catch_stacktrace|cbrt|cd|ceil|cell|cfunction|cglobal|charwidth|checkbounds|checkindex|chmod|chol|cholfact|cholfact!|chomp|chop|chown|chr2ind|circshift|cis|clamp|clamp!|cld|clear!|clipboard|close|cmp|code_llvm|code_lowered|code_native|code_typed|code_warntype|collect|colon|combinations|complex|cond|condskeel|conj|conj!|connect|consume|contains|conv|conv2|convert|copy|copy!|copysign|cor|cos|cosc|cosd|cosh|cospi|cot|cotd|coth|count|count_ones|count_zeros|countfrom|countlines|countnz|cov|cp|cross|csc|cscd|csch|ctime|ctranspose|ctranspose!|cummax|cummin|cumprod|cumprod!|cumsum|cumsum!|cumsum_kbn|current_module|current_task|cycle|dawson|dct|dct!|dec|deconv|deepcopy|default_worker_pool|deg2rad|delete!|deleteat!|den|deserialize|det|detach|diag|diagind|diagm|diff|digamma|digits|digits!|dirname|disable_sigint|display|displayable|displaysize|div|divrem|done|dot|download|drop|dropzeros|dropzeros!|dump|e|eachindex|eachline|eachmatch|edit|eig|eigfact|eigfact!|eigmax|eigmin|eigs|eigvals|eigvals!|eigvecs|eltype|empty!|endof|endswith|enumerate|eof|eps|erf|erfc|erfcinv|erfcx|erfi|erfinv|error|esc|escape_string|eta|etree|eu|eulergamma|evalfile|exit|exp|exp10|exp2|expand|expanduser|expm|expm1|exponent|extrema|eye|factor|factorial|factorize|falses|fd|fdio|fetch|fft|fft!|fftshift|field_offset|fieldname|fieldnames|fieldoffset|fieldoffsets|filemode|filesize|fill|fill!|filt|filt!|filter|filter!|finalize|finalizer|find|findfirst|findin|findlast|findmax|findmax!|findmin|findmin!|findn|findnext|findnz|findprev|first|fld|fld1|fldmod|fldmod1|flipbits!|flipdim|flipsign|float|floor|flush|fma|foldl|foldr|foreach|frexp|full|fullname|functionloc|gamma|gc|gc_enable|gcd|gcdx|gensym|get|get!|get_bigfloat_precision|get_rounding|get_zero_subnormals|getaddrinfo|gethostname|getindex|getipaddr|getkey|getpid|getsockname|givens|golden|gperm|gradient|graphemes|hankelh1|hankelh1x|hankelh2|hankelh2x|hash|haskey|hcat|hessfact|hessfact!|hex|hex2bytes|hex2num|hist|hist!|hist2d|hist2d!|histrange|homedir|htol|hton|hvcat|hypot|idct|idct!|identity|ifelse|ifft|ifft!|ifftshift|ignorestatus|im|imag|in|include|include_dependency|include_string|ind2chr|ind2sub|indexin|indexpids|indices|indmax|indmin|info|init_worker|insert!|instances|interrupt|intersect|intersect!|inv|invdigamma|invmod|invperm|ipermute!|ipermutedims|irfft|is_apple|is_assigned_char|is_bsd|is_linux|is_unix|is_windows|isabspath|isalnum|isalpha|isapprox|isascii|isassigned|isbits|isblockdev|ischardev|iscntrl|isconst|isdiag|isdigit|isdir|isdirpath|isempty|isequal|iseven|isexecutable|isfifo|isfile|isfinite|isgeneric|isgraph|ishermitian|isimag|isimmutable|isinf|isinteger|isinteractive|isleaftype|isless|islink|islocked|islower|ismarked|ismatch|ismount|isnan|isnull|isnumber|isodd|isopen|ispath|isperm|isposdef|isposdef!|ispow2|isprime|isprint|ispunct|isqrt|isreadable|isreadonly|isready|isreal|issetgid|issetuid|issocket|issorted|isspace|issparse|issticky|issubnormal|issubset|issym|issymmetric|istaskdone|istaskstarted|istext|istextmime|istril|istriu|isupper|isvalid|iswritable|isxdigit|join|joinpath|keys|keytype|kill|kron|last|launch|lbeta|lcfirst|lcm|ldexp|ldltfact|ldltfact!|leading_ones|leading_zeros|length|less|levicivita|lexcmp|lexless|lfact|lgamma|linearindices|linreg|linspace|listen|listenany|localindexes|lock|log|log10|log1p|log2|logabsdet|logdet|logm|logspace|lowercase|lpad|lq|lqfact|lqfact!|lstat|lstrip|ltoh|lu|lufact|lufact!|lyap|macroexpand|manage|map|map!|mapfoldl|mapfoldr|mapreduce|mapreducedim|mapslices|mark|match|matchall|max|maxabs|maxabs!|maximum|maximum!|maxintfloat|mean|mean!|median|median!|merge|merge!|method_exists|methods|methodswith|middle|midpoints|mimewritable|min|minabs|minabs!|minimum|minimum!|minmax|mkdir|mkpath|mktemp|mktempdir|mod|mod1|mod2pi|modf|module_name|module_parent|mtime|muladd|mv|myid|names|nb_available|ndigits|ndims|next|nextfloat|nextind|nextpow|nextpow2|nextprod|nnz|nonzeros|norm|normalize|normalize!|normalize_string|normpath|notify|now|nprocs|nthperm|nthperm!|ntoh|ntuple|nullspace|num|num2hex|nworkers|nzrange|object_id|oct|oftype|one|ones|open|operm|ordschur|ordschur!|parent|parentindexes|parity|parse|parseip|partitions|peakflops|permutations|permute|permute!|permutedims|permutedims!|pi|pinv|pipeline|plan_bfft|plan_bfft!|plan_brfft|plan_dct|plan_dct!|plan_fft|plan_fft!|plan_idct|plan_idct!|plan_ifft|plan_ifft!|plan_irfft|plan_rfft|pmap|pointer|pointer_from_objref|pointer_to_array|pointer_to_string|poll_fd|poll_file|polygamma|pop!|popdisplay|position|powermod|precision|precompile|prepend!|prevfloat|prevind|prevpow|prevpow2|prevprod|primes|primesmask|print|print_escaped|print_joined|print_shortest|print_unescaped|print_with_color|println|process_exited|process_running|procs|prod|prod!|produce|promote|promote_rule|promote_shape|promote_type|push!|pushdisplay|put!|pwd|qr|qrfact|qrfact!|quadgk|quantile|quantile!|quit|rad2deg|rand|rand!|randcycle|randexp|randexp!|randjump|randn|randn!|randperm|randstring|randsubseq|randsubseq!|range|rank|rationalize|read|read!|readall|readandwrite|readavailable|readbytes|readbytes!|readchomp|readcsv|readdir|readdlm|readline|readlines|readlink|readstring|readuntil|real|realmax|realmin|realpath|recv|recvfrom|redirect_stderr|redirect_stdin|redirect_stdout|redisplay|reduce|reducedim|reenable_sigint|reim|reinterpret|reload|relpath|rem|rem1|remote|remotecall|remotecall_fetch|remotecall_wait|repeat|repeated|replace|repmat|repr|reprmime|reset|reshape|resize!|rest|rethrow|retry|reverse|reverse!|reverseind|rfft|rm|rmprocs|rol|rol!|ror|ror!|rot180|rotl90|rotr90|round|rounding|rowvals|rpad|rsearch|rsearchindex|rsplit|rstrip|run|scale|scale!|schedule|schur|schurfact|schurfact!|sdata|search|searchindex|searchsorted|searchsortedfirst|searchsortedlast|sec|secd|sech|seek|seekend|seekstart|select|select!|selectperm|selectperm!|send|serialize|set_bigfloat_precision|set_rounding|set_zero_subnormals|setdiff|setdiff!|setenv|setindex!|setprecision|setrounding|shift!|show|showall|showcompact|showcompact_lim|showerror|shuffle|shuffle!|sign|signbit|signed|signif|significand|similar|sin|sinc|sind|sinh|sinpi|size|sizehint!|sizeof|skip|skipchars|sleep|slice|slicedim|sort|sort!|sortcols|sortperm|sortperm!|sortrows|sparse|sparsevec|spawn|spdiagm|specialized_binary|specialized_bitwise_binary|specialized_bitwise_unary|specialized_unary|speye|splice!|split|splitdir|splitdrive|splitext|spones|sprand|sprandbool|sprandn|sprint|spzeros|sqrt|sqrtm|squeeze|srand|stacktrace|start|startswith|stat|std|stdm|step|stride|strides|string|stringmime|strip|strwidth|sub|sub2ind|subtypes|success|sum|sum!|sum_kbn|sumabs|sumabs!|sumabs2|sumabs2!|summary|super|supertype|svd|svdfact|svdfact!|svds|svdvals|svdvals!|sylvester|symbol|symdiff|symdiff!|symlink|symperm|systemerror|take|take!|takebuf_array|takebuf_string|tan|tand|tanh|task_local_storage|tempdir|tempname|tic|time|time_ns|timedwait|toc|toq|touch|trace|trailing_ones|trailing_zeros|trailingsize|transcode|transpose|transpose!|trigamma|tril|tril!|triu|triu!|trues|trunc|truncate|trylock|tryparse|typeintersect|typejoin|typemax|typemin|ucfirst|unescape_string|union|union!|unique|unlock|unmark|unsafe_copy!|unsafe_load|unsafe_pointer_to_objref|unsafe_read|unsafe_store!|unsafe_string|unsafe_trunc|unsafe_wrap|unsafe_write|unshift!|unsigned|uperm|uppercase|utf8|valtype|values|var|varm|vcat|vec|vecdot|vecnorm|versioninfo|view|wait|walkdir|warn|watch_file|which|whos|widemul|widen|with_bigfloat_precision|with_rounding|withenv|workers|workspace|write|writecsv|writedlm|xcorr|xdump|yield|yieldto|zero|zeros|zeta|zip|applicable|eval|fieldtype|getfield|invoke|is|isa|isdefined|issubtype|nfields|nothing|setfield!|throw|tuple|typeassert|typeof)(?!{{symb_id}}) # julia> join(string.(filter!(x -> isa(eval(x), Module), [names(Base); names(Core)])), "|") base_modules: \b(?:BLAS|Base|Collections|Dates|Docs|FFTW|LAPACK|LibGit2|Libc|Libdl|LinAlg|Markdown|Meta|Mmap|Operators|Pkg|Profile|Serializer|SparseArrays|StackTraces|Sys|Test|Threads|Core|Main)\b # Highlight exported functions from base modules # julia> base_modules = filter!(x -> isa(eval(x), Module) && x != :Main , [names(Base); names(Core)]) # julia> modulefunctions(m) = join(filter!(x -> isascii(x[1]) && isalpha(x[1]) && islower(x[1]), string.(names(eval(m)))), "|") # julia> regexify(m) = "$(string(m))\\.(?:$(modulefunctions(m)))" # julia> rows = join(regexify.(base_modules), "|") # julia> print("([^{}]+|\g<-1>)*}' # Don't use the following ones for lookaheads! May lead to unwanted matches. # These match unfinished nested braces, to highlight during typing. nested_curly_sloppy: '(?:{(?>[^{}]+|\g<-1>)*}|\{[^\}\)\] ]*)' nested_curly_and_round_sloppy: (?:(?>{(?>[^{}]+|\g<-1>)*}|\((?>[^()]+|\g<-1>)*\))|[\{\(][^\}\)\] ]*) # Recursively match nested brackets (of any type) and strings # Must be wrapped in a matching group when used. It is best to do this explicitly when used (not here) to avoid confusion. # NOTE: Use of atomic groups speeds up parsing immensely. string: '"(?>(?>\\"|[^"])*|\g<-1>)*"' nested_brackets_and_strings: |- (?x) (?> {(?>{{string}}|[^{}]+|\g<-1>)*}| \((?>{{string}}|[^()]+|\g<-1>)*\)| \[(?>{{string}}|[^\[\]]+|\g<-1>)*\]| {{string}} ) # Helpers for function declaration type_comparison_regex: (\$?{{symb_id}}+({{nested_curly_and_round_sloppy}})?)\s*(<:|>:)\s*((?:(?!\.\.)(?:[$.]|{{symb_id}}))+({{nested_curly_and_round_sloppy}})?) func_name_standard: |- (?x) (?!!) # Function name doesn't start with ! ([^\s{{symb_lang}}]+) # Function name ({{nested_curly}})? # Match type annotation (?=[\( ]) func_name_paren: |- (?x) \( # Function name is wrapped in parentheses (?!!) # Function name doesn't start with ! (::)? # Function name can start with :: ((?: # Rest of function name ({{nested_curly}})| # Match nested curly brackets [^)] # or anything that doesn't close paren )+) \) ({{nested_curly}})? # Match type annotation (?=\() func_params: |- (?x) \( # Open function parameters # We are lazy here and don't parse the exact form of a parameter list # with types, default values, splats etc. It is not needed. ( ({{nested_brackets_and_strings}})| # Match nested brackets, can occur in parameter default value etc. [^(){}\[\]"] # or anything that doesn't close the argument list )* \) # Close function parameters ( # Allow where keyword \s*where\s+ ( {{type_comparison_regex}}| {{nested_curly}}| {{symb_id}}+ ) )* \s*=(?!=) # Followed by exactly one equal sign contexts: main: - include: declarations - include: expressions expressions: - include: comments - include: symbols - include: type-annotation - include: type-comparison - include: literals - include: operators - include: strings - include: keywords - include: macros - include: support-functions - include: function-call - include: anonymous-function - include: variable - include: nested_parens - include: nested_squarebrackets declarations: - include: decl-func - include: decl-func-assignment-form - include: decl-type - include: decl-macro - include: decl-typealias comments: - match: '#=' push: comment-block - match: '#.*' scope: comment.line.number-sign.julia comment-block: - meta_scope: comment.block.number-sign-equals.julia - match: '#=' push: comment-block - match: '=#' pop: true keywords: - match: \b(begin|end|function|type|macro|quote|let|local|global|const|abstract|typealias|bitstype|immutable|module|baremodule|using|import|export|importall|in)\b scope: keyword.other.julia - match: \b(if|else|elseif|for|while|do|try|catch|finally|return|break|continue)\b scope: keyword.control.julia operators: # Bang is not only an operator symbol, it can also be part of a function name, thus it is treated separately. # Single quote is not only an operator symbol, it can also start a string. It is an operator if it is preceded by an identifier, dot, single-quote, right round bracket or right square bracket - match: (\.?)(=) captures: 1: keyword.operator.broadcast.julia 2: keyword.operator.assignment.julia - match: (\.)({{symb_op}}|') captures: 1: keyword.operator.broadcast.julia 2: keyword.operator.julia - match: |- (?x) ( {{symb_op}}| !| (?<= ( {{symb_id}}| [.')\]] ) ) ' ) scope: keyword.operator.julia support-functions: - match: '(?={{base_module_func}}\.?({{nested_curly}})?\()' push: - match: ({{base_modules}})\. captures: 1: support.module.julia - match: (?<=\.)({{symb_id}}+) scope: variable.function.julia support.function.julia meta.function-call.julia push: function-call-helper - match: '' pop: true - match: '(?={{base_module_func}})' push: - match: ({{symb_id}}+)\. captures: 1: support.module.julia - match: (?<=\.)({{symb_id}}+) scope: variable.function.julia support.function.julia - match: '' pop: true function-call: - match: '(?:)\s*((?:(?!\.\.)(?:[$.]|{{symb_id}}))*({{nested_curly_and_round_sloppy}})?) captures: 1: keyword.operator.julia 2: support.type.julia type-comparison: - match: '{{type_comparison_regex}}' captures: 1: support.type.julia 3: keyword.operator.julia 4: support.type.julia where-type: - match: (\{){{type_comparison_regex}}(\}) captures: 1: support.type.julia 2: support.type.julia 4: keyword.operator.julia 5: support.type.julia 7: support.type.julia - match: '{{type_comparison_regex}}' captures: 1: support.type.julia 3: keyword.operator.julia 4: support.type.julia - match: '({{nested_curly_sloppy}})' scope: support.type.julia - match: '{{symb_id}}+' scope: support.type.julia - match: \s*(where)\s+ captures: 1: keyword.other.julia push: where-type - match: '' pop: true decl-func: - match: '\b(?)' set: function-parameters - match: '({{symb_id}}+)(::)?({{symb_id}}+)?({{nested_curly}})?\s*(->)' captures: 1: variable.parameter 2: keyword.operator 3: support.type 4: support.type 5: keyword.operator - match: '({{symb_id}}+)\s*(->)' captures: 1: variable.parameter 2: keyword.operator # Do lookaheads to distinguish function calls from function definitions on assignment form decl-func-assignment-form: - match: |- (?x) (?= {{func_name_paren}} {{func_params}} ) push: func-name-paren - match: |- (?x) (?= {{func_name_standard}} {{func_params}} ) push: func-name-standard - match: |- (?x) (?= (?!!) ([^\s{{symb_lang}}]+\.)+ {{func_name_standard}} {{func_params}} ) push: - match: '({{base_modules}})\.(?=[^\s{{symb_lang}}])' captures: 1: support.module.julia push: func-name-standard pop: true - match: '(([^\s{{symb_lang}}]+\.)+)(?=[^\s{{symb_lang}}])' captures: 1: variable.other.julia push: func-name-standard pop: true func-name-standard: - match: '{{func_name_standard}}' captures: 1: entity.name.function.julia 2: support.type.julia set: function-parameters func-name-paren: - match: '{{func_name_paren}}' captures: 1: keyword.operator.julia 2: entity.name.function.julia 4: support.type.julia set: function-parameters function-parameters: - meta_content_scope: meta.function.parameters.julia - match: end scope: keyword.other pop: true - match: \)\s*(where)\s+ captures: 1: keyword.other set: where-type - match: \) pop: true - include: comments - match: '=' scope: keyword.operator.assignment.julia set: - meta_scope: meta.function.parameters.default-value.julia - match: '(?=[,;)])' set: function-parameters - include: expressions - include: type-annotation - match: \.\.\. # Splat after type scope: keyword.operator.julia - match: ({{symb_id}}+)(\.\.\.)? captures: 1: variable.parameter.julia 2: keyword.operator.julia decl-macro: - match: '\b(macro)\s+([^(]+)\(' captures: 1: keyword.other.julia 2: entity.name.macro.julia set: function-parameters decl-type: # Dollar is ok because type names can be interpolated. - match: \b(?:(mutable)\s+(struct)|(abstract)\s+(type)|(primitive)\s+(type))\s+((?:\$|{{symb_id}})+)({{nested_curly}})? scope: meta.type.julia captures: # Make this less repetitive? 1: keyword.other.julia 2: keyword.other.julia 3: keyword.other.julia 4: keyword.other.julia 5: keyword.other.julia 6: keyword.other.julia 7: entity.name.type.julia 8: support.type.julia - match: \b(type|struct|immutable|abstract)\s+((?:\$|{{symb_id}})+)({{nested_curly}})? scope: meta.type.julia captures: 1: keyword.other.julia 2: entity.name.type.julia 3: support.type.julia - match: \b(bitstype)\s+(\d+)\s+({{symb_id}}+({{nested_curly}})?) captures: 1: keyword.other.julia 2: constant.numeric.julia 3: entity.name.type.julia decl-typealias: # DEPRECATED 0.6 - match: \b(typealias)\s+({{symb_id}}+)({{nested_curly}})?\s+({{symb_id}}+({{nested_curly}})?)? captures: 1: keyword.other.julia 2: entity.name.type.julia 3: entity.name.type.julia # Duplication because {{nested_curly}} must be wrapped in a matching group 4: support.type.julia symbols: # This is slightly more involved than what one might first expect # because, for example, in `:aa` the symbol is `aa` but in `:+a` only `+` is the symbol. # Also take some extra steps to not mess up ternary a?b:c syntax. - match: |- (?x) (?