Skip to content

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.
arp242 added a commit to toml-lang/toml-test that referenced this pull request Apr 16, 2025
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