Skip to content

[TINKERPOP-3151] Allow floats with no leading digits#3558

Merged
Cole-Greer merged 1 commit into
apache:3.7-devfrom
kirill-stepanishin:allow-float-literals-without-leading-digit
Jul 24, 2026
Merged

[TINKERPOP-3151] Allow floats with no leading digits#3558
Cole-Greer merged 1 commit into
apache:3.7-devfrom
kirill-stepanishin:allow-float-literals-without-leading-digit

Conversation

@kirill-stepanishin

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/TINKERPOP-3151

Makes the leading digit optional in float literals, so forms like .5, .5f, and .5m parse, aligning the Gremlin grammar with Groovy.

Changes:

  • Grammar: added a DecimalFloatingPointLiteral alternative for the leading-dot form. Added a RANGE : '..' token so 1..5 still tokenizes correctly (otherwise .. gets swallowed into a .5 float), and pointed genericLiteralRange at it, with a matching index fix in GenericLiteralVisitor.
  • Tests: added ValidFloatLiteralTest cases and Gherkin scenarios g_injectXpoint5X/fX/dX, plus g_injectX1to5X to cover the new RANGE token. Regenerated the Python/JS/Go/.NET GLV feature files.
  • .NET: ignored g_injectXpoint5fX because the .NET translator emits a bare 0.5, dropping the float type on round-trip (a pre-existing limitation only .NET's strict typing surfaces, not fixing it here).

@codecov-commenter

codecov-commenter commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.53%. Comparing base (4722890) to head (4d33d95).
⚠️ Report is 41 commits behind head on 3.7-dev.

Additional details and impacted files
@@              Coverage Diff              @@
##             3.7-dev    #3558      +/-   ##
=============================================
+ Coverage      75.49%   75.53%   +0.03%     
- Complexity     13161    13178      +17     
=============================================
  Files           1092     1093       +1     
  Lines          67208    67233      +25     
  Branches        7391     7395       +4     
=============================================
+ Hits           50742    50784      +42     
+ Misses         13837    13828       -9     
+ Partials        2629     2621       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiazcy

xiazcy commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

VOTE +1 pending comment resolution

Assisted-by: Claude Code:claude-opus-4-8
@kirill-stepanishin
kirill-stepanishin force-pushed the allow-float-literals-without-leading-digit branch from e453c90 to 4d33d95 Compare July 24, 2026 00:18
@Cole-Greer

Copy link
Copy Markdown
Contributor

VOTE +1, merging as CTR

@Cole-Greer
Cole-Greer merged commit 50de6da into apache:3.7-dev Jul 24, 2026
21 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.

4 participants