micro/runtime/syntax/crystal.yaml

65 lines
1.8 KiB
YAML
Raw Normal View History

2017-03-21 21:55:22 +03:00
filetype: crystal
detect:
filename: "\\.cr$"
2017-03-21 21:55:22 +03:00
rules:
# Asciibetical list of reserved words
2017-03-21 21:55:22 +03:00
- 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
2017-03-21 21:55:22 +03:00
- constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
- constant.number: "\\b[0-9]+\\b"
# Crystal "symbols"
- constant: "([ ]|^):[0-9A-Z_]+\\b"
# Some unique things we want to stand out
2017-03-21 21:55:22 +03:00
- constant: "\\b(__FILE__|__LINE__)\\b"
# Regular expressions
2017-03-21 21:55:22 +03:00
- constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
# Shell command expansion is in `backticks` or like %x{this}. These are
# "double-quotish" (to use a perlism).
2017-03-21 21:55:22 +03:00
- constant.string: "`[^`]*`|%x\\{[^}]*\\}"
- constant.string:
start: "`"
end: "`"
rules: []
- constant.string:
start: "%x\\{"
end: "\\}"
rules: []
- constant.string:
start: "\""
end: "\""
2017-03-29 16:45:16 +03:00
skip: "\\\\."
rules:
2017-03-29 16:45:16 +03:00
- constant.specialChar: "\\\\."
- special: "#\\{[^}]*\\}"
- constant.string:
start: "'"
end: "'"
2017-03-29 16:45:16 +03:00
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- comment:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- comment.bright:
start: "##"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
2017-03-21 21:55:22 +03:00
- constant:
start: "<<-?'?EOT'?"
end: "^EOT"
rules: []