Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug when tokenize an InfixExpression ends with a decimal number #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bytezzz
Copy link

@bytezzz bytezzz commented Feb 8, 2023

A bug occurs when I was trying to tokenize an infixExpression ends with a decimal number, and I tried to fix this problem.

Python 3.10.4 (main, Jan 25 2023, 00:13:50) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import javalang
>>> list(javalang.tokenizer.tokenize('a == 0'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/workspaces/javalang/javalang/tokenizer.py", line 538, in tokenize
    token_type = self.read_integer_or_float(c, c_next)
  File "/workspaces/javalang/javalang/tokenizer.py", line 370, in read_integer_or_float
    if c == '0' and c_next in 'xX':
TypeError: 'in <string>' requires string as left operand, not NoneType

@JoachimCoenen
Copy link

This happens only for the single-digit decimal integer '0'?

@bytezzz
Copy link
Author

bytezzz commented Aug 29, 2024

Sorry, It has been a long time and I can't remember it.

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.

2 participants