Skip to content

[PHP] Numeral syntax improvements#2701

Merged
RunDevelopment merged 1 commit intoPrismJS:masterfrom
Ayesh:php/number
Jan 6, 2021
Merged

[PHP] Numeral syntax improvements#2701
RunDevelopment merged 1 commit intoPrismJS:masterfrom
Ayesh:php/number

Conversation

@Ayesh
Copy link
Copy Markdown
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
Copy Markdown

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%).

Details
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
Copy Markdown
Member

Thank you very much for contributing @Ayesh!

@Ayesh
Copy link
Copy Markdown
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.

2 participants