Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/languages/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export default function(hljs) {
match: regex.concat(
/\b/,
noneOf([
...ECMAScript.BUILT_IN_GLOBALS,
...ECMAScript.BUILT_IN_GLOBALS.map((x) => x + '\\('),
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need this same protection for super and import also? And wouldn't just adding a \b on the other side of noneOf get the job done here without explicitly looking for a (?

Copy link
Author

Choose a reason for hiding this comment

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

yes, there might be more bugs in the way the parser handles keywords and other keywords affected. I haven't tested that and I'm not sure of what the logic behind the original code was, but your suggestion seems reasonable.

Same thing for using \b instead of (, again I'm not sure of what the original logic was so I tried to find a minimal solution that would fix the test case I encountered.

Copy link
Member

Choose a reason for hiding this comment

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

Happy to review again after you update.

Copy link
Author

Choose a reason for hiding this comment

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

That PR was just a suggestion. I'll let someone with a better understanding of the codebase to contribute a fix.

"super",
"import"
]),
Expand Down