rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.32k stars 731 forks source link

lexer: TOML: Support more integer and floating formats #1832

Closed ToruNiina closed 2 years ago

ToruNiina commented 2 years ago

Hi, I wrote this patch to fix #1831 .

I added hex, bin, oct integers and special floating point numbers to the rule. And I modified the existing definition of integer and floating point numbers to allow underscores. I also added some examples of those new features to spec/visual/samples/toml.

Then I visually checked that the examples of the features I mentioned in the issue.

rouge-toml-lexer

In the screenshot I included some invalid examples to check if those are highlighted as an error, but I didn't include them in the spec/visual/sample to avoid confusion. If those invalid examples are beneficial, I will add them.

Please check it when you have time. Thanks!

ToruNiina commented 2 years ago

Thank you for your time and effort on the request and many helpful suggestions.

I totally agree with the suggestions. I applied all the changes. Could you check it again? Thanks!

tancnle commented 2 years ago

Awesome work @ToruNiina 👍🏼 Let's ship it 🚀