Skip to content

Conversation

@MorphCodeBot
Copy link
Collaborator

This PR fixes an issue where Python keywords directly following numbers were not being properly detected and highlighted.

Problem:

  • In code like 1if, the if keyword was not highlighted because the number token wasn't properly terminated
  • This affected any keyword that followed a number without spaces

Solution:

  • Updated the NUMBER token definition in the Python grammar to enforce word boundaries
  • This ensures proper separation between numeric literals and subsequent keywords
  • Keywords following numbers are now correctly detected and highlighted

Example:

print(1if 0==0else"b")

Now properly highlights both if and else keywords even when they directly follow numbers.

Testing:

  • Verified that keywords following numbers are properly highlighted
  • Confirmed numeric literal highlighting still works correctly
  • Checked that existing Python syntax highlighting remains unaffected

Additional ticket processing details

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.

2 participants