highlightjs / highlight.js

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

Added list of false positiitives #3999

Open akhtarmdsaad opened 4 months ago

akhtarmdsaad commented 4 months ago

Issue: (cpp) Keywords followed by parens are treated as built_in image

Resolves #3980

Changes

Added list of false positives to FUNCTION_DISPATCH

The List:

      /(?!decltype)/,
      /(?!if)/,
      /(?!for)/,
      /(?!switch)/,
      /(?!while)/,
      /(?!alignas)/,
      /(?!alignof)/,
      /(?!asm)/,
      /(?!catch)/,
      /(?!const_cast)/,
      /(?!dynamic_cast)/,
      /(?!noexcept)/,
      /(?!reinterpret_cast)/,
      /(?!sizeof)/,
      /(?!static_assert)/,
      /(?!static_cast)/,
      /(?!typeid)/,
      /(?!requires)/,
      /(?!explicit)/,
      /(?!case)/,
      /(?!delete)/,

      // compound operators
      /(?!bitand_eq)/,
      /(?!bitor_eq)/,
      /(?!xor_eq)/,
      /(?!not_eq)/,
      /(?!or_eq)/,
      /(?!and_eq)/,

      // operators
      /(?!and)/,
      /(?!or)/,
      /(?!bitand)/,
      /(?!bitor)/,
      /(?!xor)/,

      // unary operators
      /(?!not)/,
      /(?!compl)/,
      /(?!co_await)/,
      /(?!co_return)/,
      /(?!co_yield)/,

      // Reserved types
      /(?!int)/, 
      /(?!char)/, 
      /(?!double)/, 
      /(?!float)/, 
      /(?!bool)/,
      /(?!auto)/,

Before:

image

After:

image

Checklist

github-actions[bot] commented 4 months ago

Build Size Report

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

5 files changed

Total change +551 B

View Changes | file | base | pr | diff | | --- | --- | --- | --- | | es/languages/arduino.min.js | 4.61 KB | 4.74 KB | +137 B | | es/languages/cpp.min.js | 2.59 KB | 2.73 KB | +139 B | | highlight.min.js | 8.21 KB | 8.21 KB | -1 B | | languages/arduino.min.js | 4.61 KB | 4.75 KB | +137 B | | languages/cpp.min.js | 2.6 KB | 2.73 KB | +139 B |