]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/crystal.yaml
Merge pull request #1412 from tommyshem/batSyntaxHighlighting
[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             - special: "#\\{[^}]*\\}"
40
41     - constant.string:
42         start: "'"
43         end: "'"
44         skip: "\\\\."
45         rules:
46             - constant.specialChar: "\\\\."
47
48     - comment:
49         start: "#"
50         end: "$"
51         rules:
52             - todo: "(TODO|XXX|FIXME):?"
53
54     - comment.bright:
55         start: "##"
56         end: "$"
57         rules:
58             - todo: "(TODO|XXX|FIXME):?"
59
60     - constant:
61         start: "<<-?'?EOT'?"
62         end: "^EOT"
63         rules: []
64