Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crystal support #780

Merged
merged 3 commits into from
Sep 27, 2015
Merged

Crystal support #780

merged 3 commits into from
Sep 27, 2015

Conversation

makenowjust
Copy link
Contributor

I added Crystal language definition, tests and examples.

makenowjust referenced this pull request in makenowjust/commlog Sep 26, 2015
[これ](https://github.com/PrismJS/prism/pull/780)。まだマージされてはいない。マージされるといいなぁ

Prism.jsは後読みが使えるから正規表現リテラルがhighlight.jsよりは上手く扱えると思うんだけど、GitHubのプロジェクトのデフォルトのリポジトリが`gh-pages`なのが残念なところ。あとドキュメントがhighlight.jsほどしっかりしてない。
Virtual DOMを生成するシンタックスハイライターが求められている気がする‥‥。
@@ -0,0 +1,54 @@
(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/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part (?:[0-9][0-9_]*[0-9]|[0-9]) could probably be rewritten as [0-9](?:[0-9_]*[0-9])?.
Also, the last group (?:8|16|32|64|) might be more explicit written as (?:8|16|32|64)?.

@Golmote
Copy link
Contributor

Golmote commented Sep 26, 2015

Hi! Thanks for contributing. With example and tests, this is a great PR!

Would you mind taking a look at the few comments I made?

makenowjust added a commit to makenowjust/prism that referenced this pull request Sep 27, 2015
@makenowjust
Copy link
Contributor Author

@Golmote Thanks for reviewing my code. I fixed them.

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)\?/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the indentation of this line? It needs 4 tabs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I'll fix it. My editor uses spaces as indent. Why doesn't this project use linter or .editorconfig?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, there is no reason. And this is a good idea. I'll definitely think about adding it. ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a basic .editorconfig file. Thanks for suggesting this.

@Golmote
Copy link
Contributor

Golmote commented Sep 27, 2015

Thanks. For some reason, the indentation of one line went crazy, can you check it out? Once this is fixed, I can merge the PR.

Golmote added a commit that referenced this pull request Sep 27, 2015
@Golmote Golmote merged commit 5b473de into PrismJS:gh-pages Sep 27, 2015
@makenowjust makenowjust deleted the crystal-lang branch February 4, 2017 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants