Skip to content
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

fix(python) def, class keywords detected mid-identifier #3381

Merged
merged 4 commits into from Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -2,6 +2,7 @@

Grammars:

- fix(python) def, class keywords detected mid-identifier (#3381) [Josh Goebel][]
- fix(python) Fix recognition of numeric literals followed by keywords without whitespace (#2985) [Richard Gibson][]
- enh(swift) add SE-0290 unavailability condition (#3382) [Bradley Mackey][]
- enh(java) add `sealed` and `non-sealed` keywords (#3386) [Bradley Mackey][]
Expand All @@ -22,6 +23,7 @@ Developer Tools:
[Richard Gibson]: https://github.com/gibson042
[Bradley Mackey]: https://github.com/bradleymackey
[Björn Ebbinghaus]: https://github.com/MrEbbinghaus
[Josh Goebel]: https://github.com/joshgoebel

## Version 11.3.1

Expand Down
6 changes: 3 additions & 3 deletions src/languages/python.js
Expand Up @@ -384,7 +384,7 @@ export default function(hljs) {
hljs.HASH_COMMENT_MODE,
{
match: [
/def/, /\s+/,
/\bdef/, /\s+/,
IDENT_RE,
],
scope: {
Expand All @@ -397,14 +397,14 @@ export default function(hljs) {
variants: [
{
match: [
/class/, /\s+/,
/\bclass/, /\s+/,
IDENT_RE, /\s*/,
/\(\s*/, IDENT_RE,/\s*\)/
],
},
{
match: [
/class/, /\s+/,
/\bclass/, /\s+/,
IDENT_RE
],
}
Expand Down
5 changes: 5 additions & 0 deletions test/markup/python/false_positives.expect.txt
@@ -0,0 +1,5 @@
foo = _undef
bar

booger = _unclass
burger
5 changes: 5 additions & 0 deletions test/markup/python/false_positives.txt
@@ -0,0 +1,5 @@
foo = _undef
bar

booger = _unclass
burger