-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(python) Keywords directly following numbers are not detected #2985
Comments
First facts: This if of course broken since our number regex in Python requires word boundaries (which do not exist between
This is terrible style though and it doesn't bother me much if we don't support it (and code golf in general). I also imagine it could result in potential false positives if we remove the boundary checks for numbers. If someone wants to play around with a fix happy to review a PR. But if the fix has ill effects for regular (non golf code) code or detrimental effects on auto-detection then that's an issue.
See comments in |
It's also possible one half of this might be more easily fixed than the other... perhaps the keyword can be fixed just by declaring that keywords in Python can never start with a numeral? Is this true? |
I absolutely agree, but wanted to create the issue anyway just in case it's easier to fix than I thought.
I don't think there are keywords that start with a number, but not entirely sure. |
https://docs.python.org/3.8/reference/lexical_analysis.html#keywords So I think just altering |
Reaching out to the author of the PR for our Python numeric support so see if there is a reason for all those |
…without whitespace Fixes highlightjs#2985
…without whitespace Fixes highlightjs#2985
…without whitespace Fixes highlightjs#2985
…without whitespace Fixes highlightjs#2985
…without whitespace Fixes highlightjs#2985
Describe the issue
As keywords and variables cannot start with a number in Python, the space between a number and a keyword can be skipped.
The highlighting should separate the number and the keyword part.
Which language seems to have the issue?
python
Are you using
highlight
orhighlightAuto
?highlight
Sample Code to Reproduce
Expected behavior
(Also see GitHub's highlighting above)
(Also, also should
print
be a built-in here?)Additional context
Found on this StackExchange answer:
https://codegolf.stackexchange.com/a/218451/25026
The text was updated successfully, but these errors were encountered: