github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.11k stars 4.2k forks source link

Lightshow with Sublime syntax doesn't work as expected #2753

Closed L-EARN closed 8 years ago

L-EARN commented 8 years ago

Hi,

I was making a syntax highlighting file for the JSFX language using Sublime. It works as expected on Sublime (Even if there is some improvments to make when taking invalid code).

I tested it using Lightshow but it seems not to be recognized properly.

Here is a sample : https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_url=https%3A%2F%2Fgithub.com%2FL-EARN%2FSublime-JSFX%2Fblob%2Fmaster%2Fjsfx.tmLanguage&grammar_text=&code_source=from-url&code_url=https%3A%2F%2Fgithub.com%2Fbelangeo%2Fcookdsp%2Fblob%2Fmaster%2FPobjects_examples%2FPobjects_bp&code=

It seems everything is grey, like commented.

I don't really believe the error comes from Lightshow.

Here are the possible things that might go wrong :

Thanks for reading.

arfon commented 8 years ago

/ cc @aroben incase he has any insights here.

pchaigno commented 8 years ago

GitHub doesn't use the same regular expression engine as Sublime Text (PCRE-based vs. Oniguruma if I'm not mistaken). The issue might come from the few differences in the way regular expressions are interpreted by these two engines.

I submitted a pull request on your grammar repository to remove the only Oniguruma-specific syntax I'm aware of. It doesn't seem to fix the current issue but it would have been problematic in any case.

L-EARN commented 8 years ago

Thanks pchaigno for your help.

I arrived to get some coloring on Lightshow by effectively replacing \z with \n after the merge of your pr. I don't know why I didn't tested it already before asking for help ...

Here is what I get now : https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_url=https%3A%2F%2Fgithub.com%2FL-EARN%2FSublime-JSFX%2Fblob%2Feol-instead-of-eos%2Fjsfx.JSON-tmLanguage&grammar_text=&code_source=from-url&code_url=https%3A%2F%2Fgithub.com%2Fbelangeo%2Fcookdsp%2Fblob%2Fmaster%2FPobjects_examples%2FPobjects_bp&code=

As you can see now (slider definition lines), it seems to break down the regex that goes next the \n character ...

L-EARN commented 8 years ago

The syntax seems to be more stable now.

But I don't know if I should leave this issue open ...

pchaigno commented 8 years ago

The syntax seems to be more stable now.

:tada:

But I don't know if I should leave this issue open...

Isn't the initial issue fixed?

L-EARN commented 8 years ago

Well, it depends if the "end of string not working" is really an issue or not ... or if it was designed like that (And I think it is).

pchaigno commented 8 years ago

The syntax file is using \z (End of string) instead of \n (End of line) for the regexs.

@vmg Is the regular expression engine not recognizing \z tokens on purpose?