X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fsyntax%2Fcrystal.yaml;h=de80e531981317ebe4b7bf6e0b648813aae073c8;hb=60eec0eccd0d1bd9b8aaebcd17b02d6bfbc7b20a;hp=a4351641f9a5c5bf32bc2dff7f9717224cfeed41;hpb=b977bf5cca84f7dc762fe8d9967831502ee5cc87;p=micro.git diff --git a/runtime/syntax/crystal.yaml b/runtime/syntax/crystal.yaml index a4351641..de80e531 100644 --- a/runtime/syntax/crystal.yaml +++ b/runtime/syntax/crystal.yaml @@ -1,25 +1,64 @@ filetype: crystal -detect: - filename: "\\.cr$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile" - header: "^#!.*/(env +)?crystal( |$)" +detect: + filename: "\\.cr$" rules: + # Asciibetical list of reserved words - 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" + # Constants - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" - constant.number: "\\b[0-9]+\\b" - - constant: "([ ]|^):[0-9A-Z_]+\\b" + # Crystal "symbols" + - constant: "([ ]|^):[0-9A-Z_]+\\b" + # Some unique things we want to stand out - constant: "\\b(__FILE__|__LINE__)\\b" + # Regular expressions - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*" + + # Shell command expansion is in `backticks` or like %x{this}. These are + # "double-quotish" (to use a perlism). - constant.string: "`[^`]*`|%x\\{[^}]*\\}" - - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!" - - special: "#\\{[^}]*\\}" - - constant.string.char: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!" - - comment: "#[^{].*$|#$" - - comment.bright: "##[^{].*$|##$" + + - constant.string: + start: "`" + end: "`" + rules: [] + + - constant.string: + start: "%x\\{" + end: "\\}" + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - special: "#\\{[^}]*\\}" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment.bright: + start: "##" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + - constant: start: "<<-?'?EOT'?" end: "^EOT" rules: [] - - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"