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

Added list of false positiitives #3999

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

akhtarmdsaad
Copy link
Contributor

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

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

Copy link

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

/(?!char)/,
/(?!double)/,
/(?!float)/,
/(?!bool)/,

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Contributor Author

@akhtarmdsaad akhtarmdsaad Mar 10, 2024

Choose a reason for hiding this comment

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

image

i think this is already working properly. No need to change anything.

Choose a reason for hiding this comment

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

What I've mentioned above only happens without ;

Just forget it.

@joshgoebel
Copy link
Member

Keywords followed by parens are treated as built_in

Could we build the exclude list dynamically from our keywords list then instead of repeating ourselves?

@akhtarmdsaad
Copy link
Contributor Author

Keywords followed by parens are treated as built_in

Could we build the exclude list dynamically from our keywords list then instead of repeating ourselves?

Sure

Copy link

github-actions bot commented Jul 9, 2024

Build Size Report

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

7 files changed

Total change +136 B

View Changes
file base pr diff
es/core.min.js 8.2 KB 8.2 KB +3 B
es/highlight.min.js 8.2 KB 8.2 KB +3 B
es/languages/arduino.min.js 4.61 KB 4.63 KB +28 B
es/languages/cpp.min.js 2.59 KB 2.63 KB +35 B
highlight.min.js 8.23 KB 8.23 KB +3 B
languages/arduino.min.js 4.61 KB 4.64 KB +29 B
languages/cpp.min.js 2.6 KB 2.63 KB +35 B

Copy link

github-actions bot commented Jul 9, 2024

Build Size Report

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

7 files changed

Total change +133 B

View Changes
file base pr diff
es/core.min.js 8.2 KB 8.2 KB +2 B
es/highlight.min.js 8.2 KB 8.2 KB +2 B
es/languages/arduino.min.js 4.61 KB 4.63 KB +28 B
es/languages/cpp.min.js 2.59 KB 2.63 KB +35 B
highlight.min.js 8.23 KB 8.23 KB +2 B
languages/arduino.min.js 4.61 KB 4.64 KB +29 B
languages/cpp.min.js 2.6 KB 2.63 KB +35 B

Copy link

github-actions bot commented Jul 9, 2024

Build Size Report

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

7 files changed

Total change +135 B

View Changes
file base pr diff
es/core.min.js 8.2 KB 8.2 KB +3 B
es/highlight.min.js 8.2 KB 8.2 KB +3 B
es/languages/arduino.min.js 4.61 KB 4.63 KB +28 B
es/languages/cpp.min.js 2.59 KB 2.63 KB +35 B
highlight.min.js 8.23 KB 8.23 KB +2 B
languages/arduino.min.js 4.61 KB 4.64 KB +29 B
languages/cpp.min.js 2.6 KB 2.63 KB +35 B

@akhtarmdsaad
Copy link
Contributor Author

Its working fine now.

Screenshot 2024-07-09 at 12 01 01 PM

@akhtarmdsaad
Copy link
Contributor Author

hi @joshgoebel, can you please tell me if our engine has a priority based highlighting or it is just limited to regex. if no such feature exists, should we add this feature to our engine for better control over it?

@@ -61,6 +61,7 @@ CAVEATS / POTENTIALLY BREAKING CHANGES

Core Grammars:

- fix(cpp) Keywords followed by parens are treated as built_in [Md Saad Akhtar][]
Copy link
Member

Choose a reason for hiding this comment

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

Please add your author link below as well.

Copy link
Member

Choose a reason for hiding this comment

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

Ping.

Copy link
Member

Choose a reason for hiding this comment

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

Ping.

Copy link

Build Size Report

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

7 files changed

Total change +130 B

View Changes
file base pr diff
es/core.min.js 8.18 KB 8.18 KB +1 B
es/highlight.min.js 8.18 KB 8.18 KB +1 B
es/languages/arduino.min.js 4.61 KB 4.63 KB +28 B
es/languages/cpp.min.js 2.59 KB 2.63 KB +35 B
highlight.min.js 8.22 KB 8.22 KB +1 B
languages/arduino.min.js 4.61 KB 4.64 KB +29 B
languages/cpp.min.js 2.6 KB 2.63 KB +35 B

Copy link
Member

@joshgoebel joshgoebel left a comment

Choose a reason for hiding this comment

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

All we need is that link then we can get this merged! Thanks for your patience.

/(?!switch)/,
/(?!while)/,
// adds all keywords dynamically
...allKeywords.map(keyword => new RegExp(`(?!${keyword})`)),
Copy link
Member

Choose a reason for hiding this comment

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

Actually don't we only care about keywords here that can potentially have a ( following them? That's not ALL keywords, is it?

Copy link
Member

Choose a reason for hiding this comment

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

We can ignore this for now since I already said this was ready but need your author link...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(cpp) Keywords followed by parens are treated as built_in
4 participants