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

Support non-quoted integer path segments #123

Open
ktff opened this issue Apr 20, 2021 · 0 comments
Open

Support non-quoted integer path segments #123

ktff opened this issue Apr 20, 2021 · 0 comments
Labels
type: enhancement A value-adding code change that enhances its existing functionality vrl: syntax Changes to the syntax

Comments

@ktff
Copy link
Contributor

ktff commented Apr 20, 2021

Enable usage of non-quoted integers in path segments. Some examples would be .0, .field.12, .2.label etc...

vectordotdev/vector#7045 enabled usage of non-quoted path identifiers that start with a number. Originally, support for non-quoted integers as path segments was also planned but was scraped once the issues around it became clear and it's usefulness was questioned.

Issue

Main issue is _ chars in integers. Currently the parser will parse 1_000 as an integer and will erase underscores. A naive implementation would use the parsed integer as a key which would result in following { "1_000": "a", "1000": "b"}.1_000 to evaluate as "b".

There are two known approaches:

  • Introduce more context into lexer so that it can know when it's in a path so to parse integers as identifiers.
  • Raise construction of integers to grammar where we have context.

Both options would introduce quite the complexity for a feature that is at best a nice to have and at worst could introduce more confusion than it would resolve.

Alternatives

Quoted integers are supported, ."0" works, so in the case of not going through with this change no other change is required.

Follow up on vectordotdev/vector#7045, vectordotdev/vector#6780

@ktff ktff added the type: enhancement A value-adding code change that enhances its existing functionality label Apr 20, 2021
@JeanMertz JeanMertz added the vrl: syntax Changes to the syntax label Jun 7, 2022
@fuchsnj fuchsnj transferred this issue from vectordotdev/vector Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A value-adding code change that enhances its existing functionality vrl: syntax Changes to the syntax
Projects
None yet
Development

No branches or pull requests

2 participants