Syntax highlighting in Python, by default all the digits or any integer or float are blue but when we type number like 069 the last 9 changes to white. The problem seems to persist for the following pattern
All digits should be blue
The bold digits in regex shown above are white
Operating system and version:
Sublime Text:
numbers starting with 0 in Python are in the Octal base, and so it seems correct that 8 and 9 wouldn't be scoped as a number. https://stackoverflow.com/questions/11620151/what-do-numbers-starting-with-0-mean-in-python
>>> print(089)
File "<string>", line 1
print(089)
^
SyntaxError: invalid token
It might make sense to keep this issue open so we can discuss whether the unexpected digits should be scoped as invalid or not - I'd vote for yes as it's a syntax error.
CopyingMoving myself from the other issue (https://github.com/SublimeTextIssues/Core/issues/1747):
Not sure what you're expecting, but 069 is invalid syntax and that's why it's not colorized entirely. You could argue that the offending parts of a token should be highlighted, which I also considered doing, but instead continued highlighting it the way it has before.
fichte@pinaceae> python
Python 3.6.1 (default, Mar 27 2017, 00:27:06)
[GCC 6.3.1 20170306] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 069
File "<stdin>", line 1
069
^
SyntaxError: invalid token
>>> exit()
fichte@pinaceae> python2
Python 2.7.13 (default, Feb 11 2017, 12:22:40)
[GCC 6.3.1 20170109] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 069
File "<stdin>", line 1
069
^
SyntaxError: invalid token
I'm +1 for highlighting something as invalid, just not sure what. Should it be the entire number or just the offending and trailing part? The latter is probably less intrusive while typing. Might also be worth to take a look at other languages.
Oh, and please elaborate on the [0-9]*.[0-9]*[0-9] regex, that matches 35345.2234, as per your example, but is scoped correctly for me (as constant.numeric.float.python).
@FichteFoll Initially in the given example, last digit was coming out to be white. But I think that issue has been resolved when I updated my Sublime text styling packages from this repo.
Most helpful comment
Oh, and please elaborate on the
[0-9]*.[0-9]*[0-9]regex, that matches35345.2234, as per your example, but is scoped correctly for me (asconstant.numeric.float.python).