]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/crystal.yaml
Merge branch 'python-highlight-zero' of https://github.com/a11ce/micro into a11ce...
[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(abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|in|include|instance_sizeof|lib|loop|macro|module|next|of|out|pointerof|private|protected|raise|require|rescue|return|select|self|sizeof|spawn|struct|super|then|type|typeof|uninitialized|union|unless|until|verbatim|when|while|with|yield)\\b"
9       # Constants
10     - constant: "\\b(true|false|nil)\\b"
11     - constant.number: "\\b[0-9]+\\b"
12       # Ones that can't be in the same regex because they include non-words.
13       # The nil? one has to be after the constants.
14     - statement: "\\b(nil\\?|as(\\?|\\b)|is_a\\?|responds_to\\?)"
15     - type: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
16       # Crystal "symbols"
17     - constant:  "([    ]|^):[0-9A-Z_]+\\b"
18       # Some unique things we want to stand out
19     - constant: "\\b(__FILE__|__LINE__)\\b"
20       # Regular expressions
21     - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
22
23       # Shell command expansion is in `backticks` or like %x{this}.  These are
24       # "double-quotish" (to use a perlism).
25     - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
26
27     - constant.string:
28         start: "`"
29         end: "`"
30         rules: []
31
32     - constant.string:
33         start: "%x\\{"
34         end: "\\}"
35         rules: []
36
37     - constant.string:
38         start: "\""
39         end: "\""
40         skip: "\\\\."
41         rules:
42             - constant.specialChar: "\\\\."
43             - symbol.brackets:
44                 start: "#\\{"
45                 end: "\\}"
46                 rules:
47                     - default: ".*"
48
49     - constant.string:
50         start: "'"
51         end: "'"
52         skip: "\\\\."
53         rules:
54             - constant.specialChar: "\\\\."
55
56     - comment:
57         start: "#"
58         end: "$"
59         rules:
60             - todo: "(TODO|XXX|FIXME):?"
61
62     - comment.bright:
63         start: "##"
64         end: "$"
65         rules:
66             - todo: "(TODO|XXX|FIXME):?"
67
68     - constant:
69         start: "<<-?'?EOT'?"
70         end: "^EOT"
71         rules: []
72