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

Support parsing numbers beginning with minus and decimal (e.g. -.12) #559

Closed
mty2015 opened this issue Jan 16, 2018 · 5 comments
Closed
Assignees

Comments

@mty2015
Copy link
Contributor

mty2015 commented Jan 16, 2018

BUG

当前最新分支上,io.shardingjdbc.core.parsing.lexer.Lexer中代码:

private boolean isNumberBegin() {
        return CharType.isDigital(getCurrentChar(0)) || ('.' == getCurrentChar(0) && CharType.isDigital(getCurrentChar(1)) && !isIdentifierBegin(getCurrentChar(-1))
                || ('-' == getCurrentChar(0) && ('.' == getCurrentChar(0) || CharType.isDigital(getCurrentChar(1)))));
    }

最后一个判断负数的逻辑,应该是 ('-' == getCurrentChar(0) && ('.' == getCurrentChar(1) || CharType.isDigital(getCurrentChar(1)))),才能解析出 -.12 这种情况

@terrymanu
Copy link
Member

能否提供pr和相关的测试用例?

@mty2015
Copy link
Contributor Author

mty2015 commented Jan 16, 2018

没有pr。只是看源码和写了个main测试的。

@terrymanu
Copy link
Member

可以的话还是提交一个pull request吧。开源重在参与

@mty2015
Copy link
Contributor Author

mty2015 commented Jan 16, 2018

好的。

@mty2015 mty2015 mentioned this issue Jan 16, 2018
terrymanu added a commit that referenced this issue Jan 17, 2018
@terrymanu terrymanu changed the title bug: Lexer模块解析 -.12 这种number Support parsing numbers beginning with minus and decimal (e.g. -.12) Aug 8, 2018
@terrymanu
Copy link
Member

fixed at 2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants