Skip to content

Conversation

@gibson042
Copy link
Contributor

Fixes #2985

Changes

Allow numeric literals to be followed by a word boundary OR keyword.

Checklist

  • Added markup tests
  • Updated the changelog at CHANGES.md

@gibson042 gibson042 force-pushed the gh-2985-keyword-after-numeric-literal branch from 5091bd6 to 2a2dac1 Compare October 19, 2021 21:24
// https://docs.python.org/3.9/reference/lexical_analysis.html#whitespace-between-tokens
// We deviate slightly, requiring a word boundary or a keyword
// to avoid accidentally recognizing *prefixes* (e.g., `0` in `0x41` or `08` or `0__1`)
const lookahead = `\\b|${RESERVED_WORDS.join('|')}`;
Copy link
Member

Choose a reason for hiding this comment

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

Well if that isn't rather clever. :)

@joshgoebel joshgoebel merged commit 7028658 into highlightjs:main Oct 22, 2021
@joshgoebel
Copy link
Member

Thanks!

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.

(python) Keywords directly following numbers are not detected

2 participants