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

Changed regex Prism.languages.javascript.number #63

Merged
merged 4 commits into from
May 18, 2013

Conversation

mseeboeck
Copy link
Contributor

Regex treated var names matching /[a-f]+/ as numbers.
Added support for scientific notation (e.g. 1.23e-4).
Added support for upper case notation (e.g. 0xBEEF).
Trimmed empty lines (sorry for the mess).

Small issues remaining:

  • Leading decimal point is marked up as 'punctuation', instead as part of the
    number (e.g. .1; 0.1 is matched correctly). Maybe a problem with the
    tokenizer?
  • Maybe Prism.languages.clike.number should be changed as well?

Regex treated var names matching /[a-f]+/ as numbers.
Added support for scientific notation (e.g. 1.23e-4).
Added support for upper case notation (e.g. 0xBEEF).

Small issues remaining:
* Leading decimal point is marked up as 'punctuation', instead as part of the
number (e.g. .1; 0.1 is matched correctly). Maybe a problem with the
tokenizer?
* Maybe Prism.languages.clike.number should be changed as well?
@LeaVerou
Copy link
Member

Hi there,

Thanks for this contribution! It looks like your editor changed the whitespace, causing the diff to be all messed up, which makes it impossible for me to review changes. Could you please fix that? Thanks!

Also, it would be great if you ported these changes to the clike language as well!

@kizu
Copy link
Contributor

kizu commented Dec 17, 2012

@LeaVerou btw, GitHub have a way to see any diff without the changes in whitespaces: you can just add ?w=1 to any url with diff and get it nice and clean, so diff of this PR would be this: https://github.com/LeaVerou/prism/pull/63/files?w=1

Changes:
* Variable names matching /[a-f]+/ are no longer treated as numbers.
* Added support for upper case and scientific notation.
* Also changed corresponding files in /components.

Minor issues:
* No support for type suffixes (e.g. 300f for float).
* Leading decimal point is marked up as 'punctuation', instead as part of
* the number (e.g. .1; 0.1 is matched correctly).
@zeitgeist87
Copy link
Collaborator

This should be merged. It correctly fixes a bug.

@LeaVerou
Copy link
Member

LeaVerou commented Apr 5, 2013

Gah, can't merge this any more. Could you please submit a new one? Sorry :(
Btw, JavaScript inherits from clike, so since you added them there, they don't need to be in the JS definition any more.

@LeaVerou LeaVerou closed this Apr 5, 2013
@LeaVerou LeaVerou reopened this May 18, 2013
@LeaVerou
Copy link
Member

Thanks to @kizu’s suggestion (thanks!) I was able to review this and it looks great. Disregard my previous comment, I will merge this manually.

@LeaVerou LeaVerou merged commit ad010ea into PrismJS:gh-pages May 18, 2013
@LeaVerou
Copy link
Member

Merged, thank you @mseeboeck!

@Golmote Golmote mentioned this pull request Dec 13, 2014
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.

4 participants