Add highlighting of builtin functions

Taken from gtk sourceview https://github.com/adjohnson916/gtksourceview-files/blob/master/language-specs/cuda.lang
This commit is contained in:
Sergey Vinokurov 2013-07-21 00:26:24 +03:00
parent 23fc0802be
commit 04f6eae349

View File

@ -100,6 +100,166 @@ contain type identifiers."
;; MSVC extension.
"__declspec"))
(defconst cuda-builtins
'(;; atom
"atomicAdd"
"atomicAnd"
"atomicCAS"
"atomicDec"
"atomicExch"
"atomicInc"
"atomicMax"
"atomicMin"
"atomicOr"
"atomicSub"
"atomicXor"
;; dev
"tex1D"
"tex1Dfetch"
"tex2D"
"__float_as_int"
"__int_as_float"
"__float2int_rn"
"__float2int_rz"
"__float2int_ru"
"__float2int_rd"
"__float2uint_rn"
"__float2uint_rz"
"__float2uint_ru"
"__float2uint_rd"
"__int2float_rn"
"__int2float_rz"
"__int2float_ru"
"__int2float_rd"
"__uint2float_rn"
"__uint2float_rz"
"__uint2float_ru"
"__uint2float_rd"
"__fadd_rz"
"__fmul_rz"
"__fdividef"
"__mul24"
"__umul24"
"__mulhi"
"__umulhi"
"__mul64hi"
"__umul64hi"
"min"
"umin"
"fminf"
"fmin"
"max"
"umax"
"fmaxf"
"fmax"
"abs"
"fabsf"
"fabs"
"sqrtf"
"sqrt"
"sinf"
"__sinf"
"sin"
"cosf"
"__cosf"
"cos"
"sincosf"
"__sincosf"
"expf"
"__expf"
"exp"
"logf"
"__logf"
"log"
;; runtime
"cudaBindTexture"
"cudaBindTextureToArray"
"cudaChooseDevice"
"cudaConfigureCall"
"cudaCreateChannelDesc"
"cudaD3D10GetDevice"
"cudaD3D10MapResources"
"cudaD3D10RegisterResource"
"cudaD3D10ResourceGetMappedArray"
"cudaD3D10ResourceGetMappedPitch"
"cudaD3D10ResourceGetMappedPointer"
"cudaD3D10ResourceGetMappedSize"
"cudaD3D10ResourceGetSurfaceDimensions"
"cudaD3D10ResourceSetMapFlags"
"cudaD3D10SetDirect3DDevice"
"cudaD3D10UnmapResources"
"cudaD3D10UnregisterResource"
"cudaD3D9GetDevice"
"cudaD3D9GetDirect3DDevice"
"cudaD3D9MapResources"
"cudaD3D9RegisterResource"
"cudaD3D9ResourceGetMappedArray"
"cudaD3D9ResourceGetMappedPitch"
"cudaD3D9ResourceGetMappedPointer"
"cudaD3D9ResourceGetMappedSize"
"cudaD3D9ResourceGetSurfaceDimensions"
"cudaD3D9ResourceSetMapFlags"
"cudaD3D9SetDirect3DDevice"
"cudaD3D9UnmapResources"
"cudaD3D9UnregisterResource"
"cudaEventCreate"
"cudaEventDestroy"
"cudaEventElapsedTime"
"cudaEventQuery"
"cudaEventRecord"
"cudaEventSynchronize"
"cudaFree"
"cudaFreeArray"
"cudaFreeHost "
"cudaGetChannelDesc"
"cudaGetDevice"
"cudaGetDeviceCount"
"cudaGetDeviceProperties"
"cudaGetErrorString"
"cudaGetLastError"
"cudaGetSymbolAddress"
"cudaGetSymbolSize"
"cudaGetTextureAlignmentOffset"
"cudaGetTextureReference"
"cudaGLMapBufferObject"
"cudaGLRegisterBufferObject"
"cudaGLSetGLDevice"
"cudaGLUnmapBufferObject"
"cudaGLUnregisterBufferObject"
"cudaLaunch"
"cudaMalloc"
"cudaMalloc3D"
"cudaMalloc3DArray"
"cudaMallocArray"
"cudaMallocHost"
"cudaMallocPitch"
"cudaMemcpy"
"cudaMemcpy2D"
"cudaMemcpy2DArrayToArray"
"cudaMemcpy2DFromArray"
"cudaMemcpy2DToArray"
"cudaMemcpy3D"
"cudaMemcpyArrayToArray"
"cudaMemcpyFromArray"
"cudaMemcpyFromSymbol"
"cudaMemcpyToArray"
"cudaMemcpyToSymbol"
"cudaMemset"
"cudaMemset2D"
"cudaMemset3D"
"cudaSetDevice"
"cudaSetupArgument"
"cudaStreamCreate"
"cudaStreamDestroy"
"cudaStreamQuery"
"cudaStreamSynchronize"
"cudaThreadExit"
"cudaThreadSynchronize"
"cudaUnbindTexture"
;; other
"__syncthreads")
"Names of built-in cuda functions.")
(defcustom cuda-font-lock-extra-types nil
"*List of extra types to recognize in Cuda mode.
Each list item should be a regexp matching a single identifier."
@ -117,7 +277,12 @@ Each list item should be a regexp matching a single identifier."
(c-lang-const c-matchers-3 cuda)
"Accurate normal highlighting for CUDA mode.")
(defvar cuda-font-lock-keywords cuda-font-lock-keywords-3
(defvar cuda-font-lock-keywords
(append cuda-font-lock-keywords-3
(list
(list
(regexp-opt cuda-builtins 'symbols)
(0 'font-lock-builtin-face))))
"Default expressions to highlight in CUDA mode.")
(defvar cuda-mode-syntax-table nil