glsl-highlight-easily.mtsx
{
// GLSL Code Highlight Easy Edition
name: ["GLSL", ".glsl", ".vert", ".frag", ".geom"],
colors: [
"preprocessor" > "meta",
"constant" > "number"
],
comment: {startsWith: "//"},
comment: {startsWith: "/*", endsWith: "*/"},
contains: [
{builtin: #C_QUOTED_STRING#},
{builtin: #C_NUMBER#},
{match: /(?m)^[ \t](#[ \t]define)(\s+\S+)/, 1: "preprocessor", 2: "constant"},
{match: /(?m)^[ \t](#[ \t]ifn?def)(\s+\S+)/, 1: "preprocessor", 2: "constant"},
{match: /(?m)^[ \t]#[ \t]\S+/, 0: "preprocessor"},
{match: keywordsToRegex(
"attribute const uniform varying buffer centroid flat smooth noperspective"
"patch sample subroutine in out inout"
"float double int void bool true false"
"mat2 mat3 mat4 dmat2 dmat3 dmat4"
"mat2x2 mat2x3 mat2x4 dmat2x2 dmat2x3 dmat2x4"
"mat3x2 mat3x3 mat3x4 dmat3x2 dmat3x3 dmat3x4"
"mat4x2 mat4x3 mat4x4 dmat4x2 dmat4x3 dmat4x4"
"vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4"
"uint uvec2 uvec3 uvec4 sampler1D sampler2D sampler3D samplerCube"
"sampler1DShadow sampler2DShadow samplerCubeShadow"
"sampler1DArray sampler2DArray sampler1DArrayShadow sampler2DArrayShadow"
"isampler1D isampler2D isampler3D isamplerCube"
"isampler1DArray isampler2DArray"
"usampler1D usampler2D usampler3D usamplerCube"
"usampler1DArray usampler2DArray usamplerCubeArray sampler2DRect"
"sampler2DRectShadow isampler2DRect usampler2DRect"
"samplerBuffer isamplerBuffer usamplerBuffer sampler2DMS"
"isampler2DMS usampler2DMS sampler2DMSArray isampler2DMSArray usampler2DMSArray"
), 0: "keyword"}
]
}