Skip to content

"expected identifier" error for date-like table name #571

@Garmelon

Description

@Garmelon

When opening a toml file containing the following table, the plugin reports the error "expected identifier":

[2024-01-01]

image

According to the toml spec for tables,

Naming rules for tables are the same as for keys (see definition of Keys above).

Checking the toml spec for keys, we find that

A key may be either bare, quoted, or dotted.

Bare keys may only contain ASCII letters, ASCII digits, underscores, and dashes (A-Za-z0-9_-). Note that bare keys are allowed to be composed of only ASCII digits, e.g. 1234, but are always interpreted as strings.

Following that definition, the key 2024-01-01, even though it looks like a date, is a valid key equivalent to the quoted key "2024-01-01". The vscode plugin recognizes this because using it as a normal key instead of a table key works without errors:
image

This appears to be date-specific. Invalid dates or keys that look like other values don't cause errors.
image

I am using version 0.19.2 of the tamasfe.even-better-toml VSCode extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions