-
Notifications
You must be signed in to change notification settings - Fork 747
Closed
Labels
A-lexingarea: changes to individual lexersarea: changes to individual lexersgood first issueGood for newcomersGood for newcomers
Milestone
Description
In python floats are sometimes written as fractions where decimal part is not written for example:
a = .3 # instead of 0.3But seems like pygments does not consider them as float, considers a dot (operator) and a number.
Code to reproduce:
from pygments import lex
from pygments.lexers.python import PythonLexer
from pygments.token import Number as Number
content = "a = .5"
lineno = 0
for token in lex(content, PythonLexer()):
print(token)Results:
(Token.Name, 'a')
(Token.Text, ' ')
(Token.Operator, '=')
(Token.Text, ' ')
(Token.Operator, '.')
(Token.Literal.Number.Integer, '5')
(Token.Text, '\n')
Interestingly does consider 5. as float.
Metadata
Metadata
Assignees
Labels
A-lexingarea: changes to individual lexersarea: changes to individual lexersgood first issueGood for newcomersGood for newcomers