Skip to content

Conversation

@OverflowCat
Copy link

According to the spec, an <ident-token> cannot start with a digit. However, for variables that begin with a double-hyphen --, the name following it CAN start with a digit.

For example, --7-grid-columns-minus-last-gap (found by @yzqzss in GitHub's landing page) is a completely valid variable name.

Current grammar does not properly highlight it:

This change to the lexical grammar was made in 2014, although they didn't mention it clearly:

Change the definition of ident-like tokens to allow "--" to start an ident. As part of this, rearrange the ordering of the clauses in the "-" step of consume a token so that s are recognized as such instead of becoming a -- .

The old definition:

@OverflowCat
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Contributor

@romainmenke romainmenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the detailed description and fix!
LGTM

@yzqzss
Copy link

yzqzss commented Jun 17, 2025

@microsoft-github-policy-service agree

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.

4 participants