]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/ruby.yaml
c55feb4b6999c1e75faae139abe1cbdbdd3d2f8c
[micro.git] / runtime / syntax / ruby.yaml
1 filetype: ruby
2
3 detect: 
4     filename: "\\.(rb|rake|gemspec)$|^(Gemfile|config.ru|Rakefile|Capfile|Vagrantfile|Guardfile|Appfile|Fastfile|Pluginfile|Podfile|\\.?[Bb]rewfile)$"
5     header: "^#!.*/(env +)?ruby( |$)"
6
7 rules:
8     - comment.bright:
9         start: "##"
10         end: "$"
11         rules:
12             - todo: "(XXX|TODO|FIXME|BUG|\\?\\?\\?)"
13     - comment:
14         start: "#"
15         end: "$"
16         rules:
17             - todo: "(XXX|TODO|FIXME|BUG|\\?\\?\\?)"
18
19     - statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|for|if|in|module|next|nil|not|or|private|protected|public|redo|rescue|retry|return|self|super|then|undef|unless|until|when|while|yield)\\b"
20     - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
21     - constant.number: "(?i)\\b0x[0-9a-f][0-9a-f_]*\\b"
22     - constant.number: "(?i)\\b0b[01][01_]*\\b"
23     - constant.number: "(?i)\\b[0-9][0-9_]*(['.'][0-9_]+)?(e[\\-]?[0-9_]+)?\\b"
24     # Ruby "Symbols"
25     - constant: "(i?)([         ]|^):[0-9A-Z_]+\\b"
26     - constant: "\\b(__FILE__|__LINE__)\\b"
27     - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
28
29     - constant.string:
30         start: "'"
31         end: "'"
32         skip: "\\\\."
33         rules: []
34
35     - constant.string:
36         start: "\""
37         end: "\""
38         skip: "\\\\."
39         rules:
40             - symbol.brackets:
41                 start: "#\\{"
42                 end: "\\}"
43                 rules:
44                     - default: ".*"
45
46     - constant.string.exec:
47         start: "`"
48         end: "`"
49         skip: "\\\\."
50         rules:
51             - symbol.brackets:
52                 start: "#\\{"
53                 end: "\\}"
54                 rules:
55                     - default: ".*"
56
57     - constant.string: "%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
58     - constant.string: "%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
59     - constant.string.exec: "%[x]\\{[^}]*\\}|%[x]\\([^)]*\\)|%[x]<[^>]*>|%[x]\\[[^]]*\\]|%[x]\\$[^$]*\\$|%[x]\\^[^^]*\\^|%[x]![^!]*!"
60     - constant.bool: "\\b(true|false|nil|TRUE|FALSE|NIL)\\b"
61     - symbol.operator: "[-+/*=<>!~%&|^]|\\b:"
62     - symbol.brackets: "([(){}]|\\[|\\])"
63     - constant.macro:
64         start: "<<-?'?EOT'?"
65         end: "^EOT"
66         rules: []
67
68     - preproc.shebang: "^#!.+?( |$)"