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

C++ syntax highlight error #207184

Closed
clysto opened this issue Mar 8, 2024 · 2 comments
Closed

C++ syntax highlight error #207184

clysto opened this issue Mar 8, 2024 · 2 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@clysto
Copy link

clysto commented Mar 8, 2024

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.87.1
  • OS Version: MacOS Sonoma 14.3.1

Steps to Reproduce:

  1. input this code:
#include <vector>

std::vector<uint64_t> test(1 << 22);

int main() {
  for (int i = 0; i < (1 << 22); i++) {
    test[i] = i;
  }
  while (true) {
    switch (test[0] % 4) {
      case 0:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
      case 1:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
      case 2:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
      case 3:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
    }
  }
  return 0;
}
image
@alexandruavadanii
Copy link

alexandruavadanii commented Mar 8, 2024

The C++ grammar (which has been frozen in eb03486, so don't hold your breath waiting for a fix for this, unless #50140 actually lands this month + an alternative grammar for C++ is found) does not like your 1 << 22 used when defining the vector. Use a define or extra parenthesis to work around that..

std::vector<uint64_t> test((1<<22));

@alexr00
Copy link
Member

alexr00 commented Mar 11, 2024

Thanks for the analysis @alexandruavadanii, you are correct.

Nonetheless, I've opened jeff-hykin/better-cpp-syntax#654 in the upstream repo. There's some chance that the owner of the repo there changes the license back at some point.

@alexr00 alexr00 closed this as completed Mar 11, 2024
@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream labels Mar 11, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

4 participants