Skip to content

Fix JavaScript number tokenization - #1314

Open
nightcityblade wants to merge 1 commit into
python-babel:masterfrom
nightcityblade:fix/issue-789
Open

Fix JavaScript number tokenization#1314
nightcityblade wants to merge 1 commit into
python-babel:masterfrom
nightcityblade:fix/issue-789

Conversation

@nightcityblade

Copy link
Copy Markdown

Fixes #789

Prevent JavaScript identifier rules from matching tokens that start with a digit, allowing decimal, fractional, and exponent literals to reach the number rule. The number rule now checks hexadecimal literals before the shorter 0 alternative so their full token is preserved.

Adds focused regression coverage for all four supported number forms.

Tests:

  • python -m pytest -q — 7736 passed, 7 skipped, 2 xfailed
  • pre-commit run --files babel/messages/jslexer.py tests/messages/test_jslexer.py
  • python -m compileall -q babel/messages/jslexer.py tests/messages/test_jslexer.py

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.

Minor bug in JavaScript lexer; failing to recognize numbers

1 participant