]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/crystal.yaml
Merge branch 'master' into view-refactor
[micro.git] / runtime / syntax / crystal.yaml
1 filetype: crystal
2
3 detect:
4     filename: "\\.cr$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile"
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         rules:
37             - constant.specialchar: "\\\\."
38             - special: "#\\{[^}]*\\}"
39
40     - constant.string:
41         start: "'"
42         end: "(?<!\\\\)'"
43         rules: []
44
45     - comment:
46         start: "#"
47         end: "$"
48         rules:
49             - todo: "(TODO|XXX|FIXME):?"
50
51     - comment.bright:
52         start: "##"
53         end: "$"
54         rules:
55             - todo: "(TODO|XXX|FIXME):?"
56
57     - constant:
58         start: "<<-?'?EOT'?"
59         end: "^EOT"
60         rules: []
61