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

[PHP] Numeral syntax improvements #2701

Merged
merged 1 commit into from Jan 6, 2021
Merged

[PHP] Numeral syntax improvements #2701

merged 1 commit into from Jan 6, 2021

Conversation

Ayesh
Copy link
Contributor

@Ayesh Ayesh commented Jan 6, 2021

Improves numeral literal handling in the Prism PHP component in two ways:

  1. Since PHP 7.4, it is possible to use underscore numeric separator. Prism correctly handles this for decimal numbers, but not for binary, octal, and hex numerals although PHP supports the underscore separator for binary, octal, and hex numeric literals as well.
  2. In upcoming PHP 8.1, PHP supports an explicit octal numeral prefix 0o/0O. The existing 0 prefix is not removed.

This commit updates the PHP number regex to accommodate both cases above, and expands the tests for new syntax.

Thank you.

Improves numeral literal handling in the Prism PHP component in two ways:

1. Since PHP 7.4, it is possible to use [underscore numeric separator](https://php.watch/versions/7.4/underscore_numeric_separator). Prism correctly handles this for decimal numbers, but not for binary, octal, and hex numerals although PHP supports the underscore separator for binary, octal, and hex numeric literals as well.
2. In upcoming PHP 8.1, PHP supports an [explicit octal numeral prefix `0o`/`0O`](https://php.watch/versions/8.1/explicit-octal-notation). The existing `0` prefix is not removed.

This commit updates the PHP number regex to accommodate both cases above, and expands the tests for new syntax.
@github-actions
Copy link

github-actions bot commented Jan 6, 2021

JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of +17 B (+0.9%).

file master pull size diff % diff
components/prism-php.min.js 1.82 KB 1.84 KB +17 B +0.9%

Generated by 🚫 dangerJS against a4ab9aa

@RunDevelopment RunDevelopment merged commit 01af04e into PrismJS:master Jan 6, 2021
@RunDevelopment
Copy link
Member

Thank you very much for contributing @Ayesh!

@Ayesh
Copy link
Contributor Author

Ayesh commented Jan 6, 2021

Thanks a lot for the quick responses and merging :) 🙏🏼

@Ayesh Ayesh deleted the php/number branch January 6, 2021 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants