Skip to content

Commit

Permalink
Update Crystal keywords (#1092)
Browse files Browse the repository at this point in the history
- Add `select`, `uninitialized` and `__END_LINE__`
- Remove `ifdef`
  • Loading branch information
makenowjust authored and Golmote committed Mar 2, 2017
1 parent 224fdb8 commit 125bff1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/prism-crystal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function(Prism) {
Prism.languages.crystal = Prism.languages.extend('ruby', {
keyword: [
/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|ifdef|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|self|sizeof|struct|super|then|type|typeof|union|unless|until|when|while|with|yield|__DIR__|__FILE__|__LINE__)\b/,
/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/,
{
pattern: /(\.\s*)(?:is_a|responds_to)\?/,
lookbehind: true
Expand Down
18 changes: 10 additions & 8 deletions tests/languages/crystal/keyword_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ abstract alias as asm begin break case
class;
def do else elsif
end ensure enum extend for fun
if ifdef include instance_sizeof
if include instance_sizeof
.is_a?
lib macro module next of out pointerof
private protected rescue
.responds_to?
return require self sizeof struct super
then type typeof union unless until when
while with yield __DIR__ __FILE__ __LINE__
return require select self sizeof struct super
then type typeof uninitialized union unless
until when while with yield __DIR__ __END_LINE__
__FILE__ __LINE__

----------------------------------------------------

Expand All @@ -18,14 +19,15 @@ while with yield __DIR__ __FILE__ __LINE__
["keyword", "class"], ["punctuation", ";"],
["keyword", "def"], ["keyword", "do"], ["keyword", "else"], ["keyword", "elsif"],
["keyword", "end"], ["keyword", "ensure"], ["keyword", "enum"], ["keyword", "extend"], ["keyword", "for"], ["keyword", "fun"],
["keyword", "if"], ["keyword", "ifdef"], ["keyword", "include"], ["keyword", "instance_sizeof"],
["keyword", "if"], ["keyword", "include"], ["keyword", "instance_sizeof"],
["punctuation", "."], ["keyword", "is_a?"],
["keyword", "lib"], ["keyword", "macro"], ["keyword", "module"], ["keyword", "next"], ["keyword", "of"], ["keyword", "out"], ["keyword", "pointerof"],
["keyword", "private"], ["keyword", "protected"], ["keyword", "rescue"],
["punctuation", "."], ["keyword", "responds_to?"],
["keyword", "return"], ["keyword", "require"], ["keyword", "self"], ["keyword", "sizeof"], ["keyword", "struct"], ["keyword", "super"],
["keyword", "then"], ["keyword", "type"], ["keyword", "typeof"], ["keyword", "union"], ["keyword", "unless"], ["keyword", "until"], ["keyword", "when"],
["keyword", "while"], ["keyword", "with"], ["keyword", "yield"], ["keyword", "__DIR__"], ["keyword", "__FILE__"], ["keyword", "__LINE__"]
["keyword", "return"], ["keyword", "require"], ["keyword", "select"], ["keyword", "self"], ["keyword", "sizeof"], ["keyword", "struct"], ["keyword", "super"],
["keyword", "then"], ["keyword", "type"], ["keyword", "typeof"], ["keyword", "uninitialized"], ["keyword", "union"], ["keyword", "unless"],
["keyword", "until"], ["keyword", "when"], ["keyword", "while"], ["keyword", "with"], ["keyword", "yield"], ["keyword", "__DIR__"], ["keyword", "__END_LINE__"],
["keyword", "__FILE__"], ["keyword", "__LINE__"]
]

----------------------------------------------------
Expand Down

0 comments on commit 125bff1

Please sign in to comment.