highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.31k stars 3.52k forks source link

fix(haxe) fix new keyword false positives #3993

Closed ninjamuffin99 closed 3 months ago

ninjamuffin99 commented 4 months ago

Changes the regex in the haxe.js highlighting to only highlight new as a keyword if it's not used within a variable/class name, using beginKeywords: 'new' instead of new *

Resolves #3992

Changes

Chnages the regex to use beginKeywords: 'new' instead of *, so that it can capture new as a keyword, but not when it's used within a variable name

Checklist

ninjamuffin99 commented 4 months ago

I will look into the markup tests sometime soon / hopefully later today.

I am regex noob but I believe this should work okay!

ninjamuffin99 commented 4 months ago

added markup tests, and changed to use beginKeywords: new

github-actions[bot] commented 4 months ago

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

12 files changed

Total change -58 B

View Changes | file | base | pr | diff | | --- | --- | --- | --- | | es/core.min.js | 8.17 KB | 8.17 KB | +1 B | | es/highlight.min.js | 8.17 KB | 8.17 KB | +1 B | | es/languages/css.min.js | 3.81 KB | 3.8 KB | -8 B | | es/languages/haxe.min.js | 987 B | 989 B | +2 B | | es/languages/less.min.js | 4.21 KB | 4.21 KB | -8 B | | es/languages/scss.min.js | 4.25 KB | 4.24 KB | -8 B | | es/languages/stylus.min.js | 3.91 KB | 3.9 KB | -8 B | | languages/css.min.js | 3.81 KB | 3.8 KB | -8 B | | languages/haxe.min.js | 995 B | 997 B | +2 B | | languages/less.min.js | 4.22 KB | 4.21 KB | -8 B | | languages/scss.min.js | 4.26 KB | 4.25 KB | -8 B | | languages/stylus.min.js | 3.92 KB | 3.91 KB | -8 B |
github-actions[bot] commented 3 months ago

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

3 files changed

Total change +2 B

View Changes | file | base | pr | diff | | --- | --- | --- | --- | | es/languages/haxe.min.js | 987 B | 989 B | +2 B | | highlight.min.js | 8.23 KB | 8.23 KB | -2 B | | languages/haxe.min.js | 995 B | 997 B | +2 B |