Keep keyword before leading-dot float literal (issue #601)#868
Merged
andialbrecht merged 1 commit intoJul 25, 2026
Merged
Conversation
The SQL_REGEX rule that tags a word followed by a period as a Name (to support ``schema . name`` member access) also matched a keyword sitting in front of a float literal written without a leading zero, e.g. the ``BETWEEN`` in ``x BETWEEN .03 AND .06``. As a result BETWEEN was demoted to a Name, the statement was grouped incorrectly, and the bounds were no longer standalone number tokens. Add a ``(?!\d)`` negative lookahead so the Name-before-period rule ignores a period that starts a numeric literal, while ``schema . name`` grouping is preserved. Adds regression tests covering both the fix and the member-access behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #868 +/- ##
==========================================
+ Coverage 97.13% 97.16% +0.03%
==========================================
Files 31 31
Lines 3663 3704 +41
Branches 328 331 +3
==========================================
+ Hits 3558 3599 +41
Misses 63 63
Partials 42 42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #601.
Problem
Parsing a
BETWEENbound written as a float without a leading zero mis-tokenizes the statement:BETWEENgets demoted from a keyword to aName, theWHEREbody is grouped wrong, and.03/.06stop being standalone number tokens.Cause
The lexer rule that supports
schema . namemember access:matches any word followed by whitespace + a period — including a keyword sitting in front of a float literal like
.03. Sobetweenmatched this rule and was tagged as aName.Fix
Add a
(?!\d)negative lookahead so the rule ignores a period that begins a numeric literal:schema.name/schema . name/a.b.cmember access is unchanged; only the keyword-before-float case is corrected.Tests
test_between_leading_dot_float_issue601—BETWEENstays a keyword,ANDstays a keyword, and.03/.06areNumber.Floattokens (upper and lower case).test_keyword_before_qualified_name_still_grouped— guards that qualified-name grouping keeps working.Full suite:
494 passed, 2 xfailed, 1 xpassed.