]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/julia.yaml
Julia syntax improvements (#2415)
[micro.git] / runtime / syntax / julia.yaml
1 filetype: julia
2
3 detect:
4     filename: "\\.jl$"
5     header: "^#!.*/(env +)?julia( |$)"
6
7 rules:
8
9     # built-in objects
10     - constant.bool: "\\b(true|false)\\b"
11     - constant: "\\b(nothing|missing)\\b"
12       # built-in attributes
13     - constant: "__[A-Za-z0-9_]+__"
14       # definitions
15     - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
16       # keywords
17     - statement: "\\b(baremodule|begin|break|catch|const|continue|do|else|elseif|end|export|finally|for|function|global|if|import|let|local|macro|module|quote|return|struct|try|using|while)\\b"
18     - statement: "\\b(abstract\\s+type|primitive\\s+type|mutable\\s+struct)\\b"
19       # decorators
20     - identifier.macro: "@[A-Za-z0-9_]+"
21       # operators
22     - symbol.operator: "[:+*|=!%~<>/\\-?&\\\\รทโˆˆโˆ‰โˆ˜]|\\b(in|isa|where)\\b"
23       # for some reason having ^ in the same regex with the other operators broke things
24     - symbol.operator: "\\^"
25       # parentheses
26     - symbol.brackets: "([(){}]|\\[|\\])"
27       # numbers
28     - constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*|Inf(16|32|64)?|NaN(16|32|64)?)\\b"
29
30     - constant.string:
31         start: "\"\"\""
32         end: "\"\"\""
33         rules: []
34
35     - constant.string:
36         start: "\""
37         end: "\""
38         skip: "\\\\."
39         rules:
40             - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{1,4}|U[0-9A-Fa-f]{1,8})"
41
42     - constant.string:
43         start: "'"
44         end: "'"
45         skip: "\\\\."
46         rules:
47             - error: "..+"
48             - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{1,4}|U[0-9A-Fa-f]{1,8})"
49
50     - comment:
51         start: "#="
52         end: "=#"
53         rules: []
54
55     - comment:
56         start: "#"
57         end: "$"
58         rules: []