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

Where condition with negative number value(s) cause "Unexpected 'MATH'" error. #6

Closed
dbaranau opened this issue Aug 12, 2018 · 1 comment

Comments

@dbaranau
Copy link

Where condition with negative numbers cause "Unexpected 'MATH'" error. To reproduce change 1 to -1 in your example page: select * from test where a = -1 and foo = "bar"

There is a logical or regex problem in your Lexer:
MATH = ['+', '-', '||', '&&'];
and
NUMBER = /^[0-9]+(.[0-9]+)?/;

I was trying to add sign to your number regex but it did not help: NUMBER = /^[-+]?[0-9]+(.[0-9]+)?/;

Can you fix the problem as it make component much less useful?

Thanks,

Dmitry

@dbaranau
Copy link
Author

Actually this fork https://github.com/davegraziosi/sql-parser has the problem fixed:
//NUMBER = /^[0-9]+(.[0-9]+)?/;
NUMBER =/^\s*[+-]?[0-9]+(.[0-9]+)?/

mistic100 added a commit that referenced this issue Aug 18, 2018
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

No branches or pull requests

1 participant