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

Allow dates in identifiers #749

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Garmelon
Copy link

@Garmelon Garmelon commented Feb 20, 2025

According to the toml standard, bare keys may only contain the characters A-Za-z0-9_- and they must contain at least one character. This allows identifiers to look like dates, e.g. 2024-01-01.

Due to a bug in the lexing library logos, date-like identifiers in assignments are incorrectly being parsed as INTEGER tokens, while date-like identifiers in table names are being parsed as DATE tokens (as they should be). Due to this bug, date-like identifiers were being accepted in some situations by taplo while they were rejected in other situations.

This commit only allows DATE tokens in identifiers (as they should be, according to the standard). It does not fix the underlying bug that sometimes produces incorrect INTEGER tokens instead of DATE tokens.

Fixes #571

According to the toml standard, bare keys may only contain the
characters A-Za-z0-9_- and they must contain at least one character.
This allows identifiers to look like dates, e.g. 2024-01-01.

Due to a bug in the lexing library logos, some-like identifiers are
incorrectly being parsed as INTEGER tokens, while date-like identifiers
in table names are being parsed as DATE tokens as they should be. Due to
this bug, date-like identifiers were being accepted in some situations
by taplo while they were rejected in other situations.

This commit only allows DATE tokens in identifiers (as they should be,
according to the standard). It does not fix the underlying bug that
sometimes produces incorrect INTEGER tokens instead of DATE tokens.
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.

"expected identifier" error for date-like table name
1 participant