You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/07/23 20:36:00 UTC
[jira] [Commented] (TINKERPOP-3151) Allow floats with no leading digits
[ https://issues.apache.org/jira/browse/TINKERPOP-3151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18098595#comment-18098595 ]
ASF GitHub Bot commented on TINKERPOP-3151:
-------------------------------------------
kirill-stepanishin opened a new pull request, #3558:
URL: https://github.com/apache/tinkerpop/pull/3558
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).
> Allow floats with no leading digits
> -----------------------------------
>
> Key: TINKERPOP-3151
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3151
> Project: TinkerPop
> Issue Type: Improvement
> Components: language
> Affects Versions: 3.7.3
> Reporter: Cole Greer
> Priority: Trivial
>
> Currently floatLiterals without a leading digit such as .5f or .5d are not permitted by the grammar. This is a minor inconvenience for users as well as a subtle incompatibility from groovy.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)