Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(parser): support negative number literals - #195

Merged
brunomendola merged 1 commit into
queritylib:mainfrom
vage88sg1:fix/negative-number-literals
Jul 13, 2026
Merged

brunomendola merged 1 commit into
queritylib:mainfrom
vage88sg1:fix/negative-number-literals

Conversation

@vage88sg1

Copy link
Copy Markdown
Contributor

INT_VALUE and DECIMAL_VALUE only matched unsigned numbers, so a query like price = -10 produced a token recognition error on '-' and ANTLR's error recovery silently dropped the sign, parsing the value as +10. Negative literals are now accepted wherever a number literal is valid: condition values, IN arrays and function arguments.

Integer.parseInt and new BigDecimal already handle the leading minus, so no visitor changes are needed.

INT_VALUE and DECIMAL_VALUE only matched unsigned numbers, so a query
like `price = -10` produced a token recognition error on '-' and
ANTLR's error recovery silently dropped the sign, parsing the value as
+10. Negative literals are now accepted wherever a number literal is
valid: condition values, IN arrays and function arguments.

Integer.parseInt and new BigDecimal already handle the leading minus,
so no visitor changes are needed.
@brunomendola
brunomendola merged commit 03956f6 into queritylib:main Jul 13, 2026
1 of 2 checks passed
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