Skip to content

Conversation

@roopeshor
Copy link

The old regex for detecting number doesn't work in following edge cases:
0xf_f_f_f_ffn,
0xf_f_f_f_f,
0b1_1_1_1,
0b0_0_1_0_1_0_1n,
0o1_1_3_2,
0o1_1_3_2n,
2.2_4_54e64_33,
2.2_4_54e+64_33,
2.2_4_54e-64_33,
3_4_5,
3_4_5.5_5_6

The new one also detects these kind of numbers. (I know these are rare and not encouraged, but I think it should be also supported because they are also valid numbers).

@github-actions
Copy link

github-actions bot commented Jul 11, 2021

JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of -1 B (-0.1%).

Details
file master pull size diff % diff
components/prism-javascript.min.js 1.5 KB 1.5 KB -1 B -0.1%

Generated by 🚫 dangerJS against 0464021

@RunDevelopment
Copy link
Member

Thank you for the PR @Roopesh2!

Please rebuild Prism by running npm ci && npm run build. Also, please add your discovered edge cases to the JS number test and run npm run test:languages -- --update to update the snapshot (if needed, more info about tests can be found here).

@roopeshor
Copy link
Author

roopeshor commented Jul 12, 2021

@RunDevelopment I've rebuilt code and updated test codes

@roopeshor
Copy link
Author

@RunDevelopment Please don't merge this PR now. I've to work more on this as I found another critical bug. Bug is that number in a variable starting with '$' gets matched.

@roopeshor roopeshor marked this pull request as draft July 13, 2021 07:56
@RunDevelopment
Copy link
Member

Closed in favor of #3149.

Thank you for reporting these problems!

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