X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fsyntax%2Fcrystal.yaml;h=896864ffe28fcc07095ba5df27c18ef469aa5dc0;hb=54c23cae72d7237bc898a59f79aad0acffdf0ffe;hp=657b6cec9c528ce4501a61d97576f2a2fab3b8d3;hpb=54bb99d7580cc1bc76507ce64ff78ef2038c8066;p=micro.git diff --git a/runtime/syntax/crystal.yaml b/runtime/syntax/crystal.yaml index 657b6cec..896864ff 100644 --- a/runtime/syntax/crystal.yaml +++ b/runtime/syntax/crystal.yaml @@ -1,14 +1,18 @@ filetype: crystal detect: - filename: "\\.cr$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile" + 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" + - 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" # Constants - - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" + - constant: "\\b(true|false|nil)\\b" - constant.number: "\\b[0-9]+\\b" + # Ones that can't be in the same regex because they include non-words. + # The nil? one has to be after the constants. + - statement: "\\b(nil\\?|as(\\?|\\b)|is_a\\?|responds_to\\?)" + - type: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" # Crystal "symbols" - constant: "([ ]|^):[0-9A-Z_]+\\b" # Some unique things we want to stand out @@ -33,14 +37,21 @@ rules: - constant.string: start: "\"" end: "\"" + skip: "\\\\." rules: - - constant.specialchar: "\\\\." - - special: "#\\{[^}]*\\}" + - constant.specialChar: "\\\\." + - symbol.brackets: + start: "#\\{" + end: "\\}" + rules: + - default: ".*" - constant.string: start: "'" end: "'" - rules: [] + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." - comment: start: "#" @@ -58,3 +69,4 @@ rules: start: "<<-?'?EOT'?" end: "^EOT" rules: [] +