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) Don't highlight C++ std types #4103

Open
data-man opened this issue Aug 29, 2024 · 4 comments · May be fixed by #4107
Open

(C) Don't highlight C++ std types #4103

data-man opened this issue Aug 29, 2024 · 4 comments · May be fixed by #4107
Labels
bug help welcome Could use help from community language

Comments

@data-man
Copy link

Describe the issue
C++ std types are highlighted in C sources.

Which language seems to have the issue?
C.

Are you using highlight or highlightAuto?
highlight.

Expected behavior
C++ std types should't be highlighted in C sources.

Additional context
From src/languages/c.js:

  const KEYWORDS = {
    keyword: C_KEYWORDS,
    type: C_TYPES,
    literal: 'true false NULL',
    // TODO: apply hinting work similar to what was done in cpp.js
    built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream '
      + 'auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set '
      + 'unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos '
      + 'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp '
      + 'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper '
      + 'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow '
      + 'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp '
      + 'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan '
      + 'vfprintf vprintf vsprintf endl initializer_list unique_ptr',
  };

Why?

@data-man data-man added bug help welcome Could use help from community language labels Aug 29, 2024
@joshgoebel
Copy link
Member

C++ std types should't be highlighted in C sources.

Agree - no doubt left over from when we forked c from the cpp grammar. How many of these would that remove if we cleaned this up?

@Dxuian
Copy link
Contributor

Dxuian commented Aug 30, 2024

can this be assigned to me ?

@Dxuian Dxuian linked a pull request Aug 30, 2024 that will close this issue
1 task
@Dxuian
Copy link
Contributor

Dxuian commented Aug 30, 2024

ive added a PR @joshgoebel please review

@data-man
Copy link
Author

data-man commented Sep 5, 2024

How many of these would that remove if we cleaned this up?

Would be nice to add all functions and types from https://en.cppreference.com/w/c/header.
And support https://en.cppreference.com/w/c/23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants