Skip to content

Commit

Permalink
Fix something commented in PrismJS#780
Browse files Browse the repository at this point in the history
  • Loading branch information
makenowjust committed Sep 27, 2015
1 parent 3bfc7fa commit 4916ab6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
13 changes: 6 additions & 7 deletions components/prism-crystal.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
(function(Prism) {
Prism.languages.crystal = Prism.languages.extend('ruby', {
number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[0-9a-fA-F_]*[0-9a-fA-F]|(?:[0-9][0-9_]*[0-9]|[0-9])(?:\.[0-9_]*[0-9])?(?:[eE][+-]?[0-9_]*[0-9])?)(?:_[uif](?:8|16|32|64|))?\b/,
});

Prism.languages.insertBefore('crystal', 'operator', {
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|undef|union|unless|until|when|while|with|yield|__DIR__|__FILE__|__LINE__)\b/,
{
pattern: /(\.\s*)(is_a|responds_to)\?/,
pattern: /(\.\s*)(?:is_a|responds_to)\?/,
lookbehind: true
}
]
],

number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[0-9a-fA-F_]*[0-9a-fA-F]|(?:[0-9](?:[0-9_]*[0-9])?)(?:\.[0-9_]*[0-9])?(?:[eE][+-]?[0-9_]*[0-9])?)(?:_(?:[uif](?:8|16|32|64))?)?\b/,
});

var rest = Prism.util.clone(Prism.languages.crystal);
Expand All @@ -25,8 +23,9 @@
alias: 'tag'
},
rest: rest
},
}
},

expansion: [
{
pattern: /\{\{.+?\}\}/,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-crystal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions examples/prism-crystal.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ <h2>Known failures</h2>
If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
</p>

<h3>Numbers ending underscore</h3>
<pre><code>123_</code></pre>
<h3>Attriubte-like substrings</h3>
<pre><code>" @[AlwaysInline] "</code></pre>

<h3>Macro expansions in strings</h3>
<pre><code>" {{ foo }} "
" {% bar %} "</code></pre>

0 comments on commit 4916ab6

Please sign in to comment.