[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New cuda-ts-mode.
From: |
Ergus |
Subject: |
New cuda-ts-mode. |
Date: |
Fri, 17 Jan 2025 19:43:12 +0100 |
Hi:
Yesterday I wrote an initial version of the cuda-ts-mode.
Some months ago I was asking for a feature to simplify the
implementation as Cuda tressitter is just the same C++ grammar with very
little extensions (a few keywords and the <<< >>> brakets)
My initial idea was to reuse all the c++-ts-mode and just add a couple
of changes.
This was actually quite hard for 3 reasons:
1. The treesit-language-remap-alist sometimes updated the grammar to
cuda's but sometimes was still using the c++ one.
2. In c++-ts-mode--simple-indent-rules the conditions are limited to c
and C++, so I needed to "hack" a bit to get the rules and set them in a
cuda entry
3. There was no way to reuse the c-ts-mode--font-lock-settings function
because of the :language entries + compilation. I needed to basically
copy-paste the same code and remove the conditions (eq mode 'c++) to
make it work.
Also the function c-ts-mode--test-virtual-named-p hardcodes 'cpp
I have a preliminar functional version that I would like to simplify and
propose for to elpa.
https://github.com/Ergus/cuda-ts-mode
If we could modify c-ts-mode to reuse it's code, probably we could add
Cuda (and maybe OpenCl) support to vanilla with VERY LITTLE code. I
mean, I have now 250 lines o code for something that may be actually
~20-50.
- New cuda-ts-mode.,
Ergus <=