babel
babel copied to clipboard
Minor bug in JavaScript lexer; failing to recognize numbers
There is a regex mistake:
https://github.com/python-babel/babel/blob/7ebdf5a249ff8861bbcd3f7e4cc1ba9555c3fb65/babel/messages/jslexer.py#L25
Here is how it is applied:
https://github.com/python-babel/babel/blob/7ebdf5a249ff8861bbcd3f7e4cc1ba9555c3fb65/babel/messages/jslexer.py#L41-L47
According to Python manual, \w matches [a-zA-Z0-9_], so a number literal of some small positive integer, e.g., 42, will always be recognized as a "name", not a number. This probably does not affect the result, but is a potential source of error when refactoring.