]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/crystal.yaml
Merge branch 'diff-gutter' of https://github.com/p-e-w/micro
[micro.git] / runtime / syntax / crystal.yaml
1 filetype: crystal
2
3 detect:
4     filename: "\\.cr$"
5
6 rules:
7     # Asciibetical list of reserved words
8     - statement: "\\b(BEGIN|END|abstract|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|enum|false|for|fun|if|in|include|lib|loop|macro|module|next|nil|not|of|or|pointerof|private|protected|raise|redo|require|rescue|retry|return|self|sizeof|spawn|struct|super|then|true|type|undef|union|uninitialized|unless|until|when|while|yield)\\b"
9       # Constants
10     - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
11     - constant.number: "\\b[0-9]+\\b"
12       # Crystal "symbols"
13     - constant:  "([    ]|^):[0-9A-Z_]+\\b"
14       # Some unique things we want to stand out
15     - constant: "\\b(__FILE__|__LINE__)\\b"
16       # Regular expressions
17     - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
18
19       # Shell command expansion is in `backticks` or like %x{this}.  These are
20       # "double-quotish" (to use a perlism).
21     - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
22
23     - constant.string:
24         start: "`"
25         end: "`"
26         rules: []
27
28     - constant.string:
29         start: "%x\\{"
30         end: "\\}"
31         rules: []
32
33     - constant.string:
34         start: "\""
35         end: "\""
36         skip: "\\\\."
37         rules:
38             - constant.specialChar: "\\\\."
39             - symbol.brackets:
40                 start: "#\\{"
41                 end: "\\}"
42                 rules:
43                     - default: ".*"
44
45     - constant.string:
46         start: "'"
47         end: "'"
48         skip: "\\\\."
49         rules:
50             - constant.specialChar: "\\\\."
51
52     - comment:
53         start: "#"
54         end: "$"
55         rules:
56             - todo: "(TODO|XXX|FIXME):?"
57
58     - comment.bright:
59         start: "##"
60         end: "$"
61         rules:
62             - todo: "(TODO|XXX|FIXME):?"
63
64     - constant:
65         start: "<<-?'?EOT'?"
66         end: "^EOT"
67         rules: []
68