76 lines
3.6 KiB
Plaintext
76 lines
3.6 KiB
Plaintext
|
# OpenCL syntax file for Diffuse
|
||
|
# Copyright (C) 2012 Derrick Moser <derrick_moser@yahoo.com>
|
||
|
syntax OpenCL normal text
|
||
|
syntax_files OpenCL '\.cl$'
|
||
|
|
||
|
# colours
|
||
|
colour opencl_comment 0.2 0.4 0.64
|
||
|
colour opencl_fixme 1.0 0.5 0.0
|
||
|
colour opencl_keyword 0.77 0.63 0.0
|
||
|
colour opencl_type 0.3 0.6 0.02
|
||
|
colour opencl_cpp 0.8 0.0 0.0
|
||
|
colour opencl_cppkeyword 0.46 0.31 0.48
|
||
|
colour opencl_literal 1.0 0.2 0.8
|
||
|
colour opencl_string 0.8 0.0 0.0
|
||
|
colour opencl_escapedchar 0.46 0.31 0.48
|
||
|
colour opencl_punctuation 0.5 0.5 0.5
|
||
|
|
||
|
# preprocessor
|
||
|
syntax_pattern normal cpp opencl_cppkeyword '^[ \t]*#[ \t]*(define|elif|else|endif|error|if|ifdef|ifndef|include|line|pragma|undef|warning)\b'
|
||
|
syntax_pattern cpp normal opencl_cppkeyword '(\r\n|\r|\n)$'
|
||
|
|
||
|
# whitespace
|
||
|
syntax_pattern normal normal text '[ \t\r\n]+'
|
||
|
|
||
|
# C++ style comments
|
||
|
syntax_pattern normal cpp_comment opencl_comment '//'
|
||
|
syntax_pattern cpp cpp_comment opencl_comment '//'
|
||
|
syntax_pattern cpp_comment normal opencl_comment '(\r\n|\r|\n)$'
|
||
|
syntax_pattern cpp_comment cpp_comment opencl_comment '\\(\r\n|\r|\n)$'
|
||
|
syntax_pattern cpp_comment cpp_comment opencl_fixme '\b(TODO|FIXME|XXX)\b'
|
||
|
syntax_pattern cpp_comment cpp_comment opencl_comment '.[^\\TFX\r\n]*'
|
||
|
|
||
|
# C style comments
|
||
|
syntax_pattern normal comment opencl_comment '/\*'
|
||
|
syntax_pattern comment normal opencl_comment '\*/'
|
||
|
syntax_pattern comment comment opencl_fixme '\b(TODO|FIXME|XXX)\b'
|
||
|
syntax_pattern comment comment opencl_comment '.[^\*TFX]*'
|
||
|
|
||
|
syntax_pattern cpp comment_cpp opencl_comment '/\*'
|
||
|
syntax_pattern comment_cpp cpp opencl_comment '\*/'
|
||
|
syntax_pattern comment_cpp comment_cpp opencl_fixme '\b(TODO|FIXME|XXX)\b'
|
||
|
syntax_pattern comment_cpp comment_cpp opencl_comment '.[^\*TFX]*'
|
||
|
|
||
|
# preprocessor args
|
||
|
syntax_pattern cpp cpp opencl_cpp '\\(\r\n|\r|\n)$'
|
||
|
syntax_pattern cpp cpp opencl_cpp '.[^\\/\r\n]*'
|
||
|
|
||
|
# char
|
||
|
syntax_pattern normal char opencl_string "L?'"
|
||
|
syntax_pattern char normal opencl_string "'"
|
||
|
syntax_pattern char char opencl_escapedchar '(\\([0-7]{1,3}|x[0-9a-f]{1,2}|.))+' ignorecase
|
||
|
syntax_pattern char char opencl_string ".[^\\\\']*"
|
||
|
|
||
|
# string
|
||
|
syntax_pattern normal string opencl_string 'L?"'
|
||
|
syntax_pattern string normal opencl_string '"'
|
||
|
syntax_pattern string string opencl_escapedchar '(\\([0-7]{1,3}|x[0-9a-f]{1,2}|.))+' ignorecase
|
||
|
syntax_pattern string string opencl_string '.[^\\"]*'
|
||
|
|
||
|
# literals
|
||
|
syntax_pattern normal normal opencl_literal '((([0-9]+\.[0-9]*|\.[0-9]+)(e[\+\-]?[0-9]+)?|[0-9]+e[\+\-]?[0-9]+)[fl]?|(0|[1-9][0-9]*)f|(0x[0-9a-f]+|0[0-7]*|[1-9][0-9]*)(ul?|lu?)?)' ignorecase
|
||
|
syntax_pattern normal normal opencl_literal '\b(true|false|M_E|M_LOG2E|M_LOG10E|M_LN2|M_LN10|M_PI|M_PI_2|M_PI_4|M_1_PI|M_2_PI|M_2_SQRTPI|M_SQRT2|M_SQRT1_2|NULL)\b'
|
||
|
|
||
|
# typing keywords
|
||
|
syntax_pattern normal normal opencl_type '\b(auto|bool|class|const|enum|explicit|export|extern|event_t|image[123]d_t|image[12]d_array_t|image1d_buffer_t|inline|u?intptr_t|mutable|namespace|ptrdiff_t|register|sampler_t|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t|(u?(char|int|long|short)|double|float|half)(2|3|4|8|16)?|(__)?(constant|global|kernel|local|read_only|read_write|write_only))\b'
|
||
|
|
||
|
# keywords
|
||
|
syntax_pattern normal normal opencl_keyword '\b(asm|break|case|catch|const_cast|continue|default|delete|do|dynamic_cast|else|for|friend|goto|if|new|operator|(__)?private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while)\b'
|
||
|
|
||
|
# punctuation
|
||
|
syntax_pattern normal normal opencl_punctuation '[!~%\|\&\^\(\)\<\>\*\-\+=\{\}\[\]:;,\?]+'
|
||
|
syntax_pattern normal normal opencl_punctuation '[/\.]'
|
||
|
|
||
|
# parsing optimisation
|
||
|
syntax_pattern normal normal text '[a-z_][a-z_0-9]*' ignorecase
|