Add CUDA C++ syntax support - #3987
Open
Matei02355 wants to merge 2 commits into
Open
Conversation
Matei02355
marked this pull request as ready for review
September 7, 2026 16:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add CUDA C++ highlighting for .cu and .cuh files, with original kernel, vector/header and launch examples for syntax regression tests.
Adapt the CUDA patterns from harrism/sublimetext-cuda-cpp at 2bf66d15322717284a6d101f99ec8b72c98c1c1d, preserving its NVIDIA BSD license. The original top-level C++ include consumes nested function contexts before the CUDA patterns can match. Derive the native CUDA syntax from the pinned Sublime Packages C++ grammar instead, applying a small patch to its modifiers, types, variables and expression contexts. Preserve the Sublime grammar's permissive license as well.
Handle CUDA qualifiers, vector types, built-in variables, intrinsics, launch bounds and kernel launch delimiters, including templated, namespaced and multiline launches. Keep comments, quoted strings and raw strings in their C++ contexts. Correct the original printf regex. Ordinary C++ mappings are unchanged.
The asset build creates the derived syntax, builds the cache, then removes the generated file through its cleanup trap. The source patch must apply without fuzz, so future C++ updates require review. No generated binary cache is committed.
Validation: three new syntax fixtures match an actual source-built cache; 43 parser-scope assertions cover CUDA tokens and comment/string isolation. All existing context references still link. C++ and .h control output is byte-for-byte unchanged. The generator reproduced the expected syntax, acknowledgement generation accepted both licenses, shell syntax checks passed, and the repository license check passed. The updated-assets CI job will exercise the complete asset-build integration.
Fixes #1054.