blob: f0d9f7edd98856b06342f36d08dc5fcca9d84ca3 [file] [log] [blame]
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +01001" Vim syntax file for Godot shading language
2" Language: gdshader
3" Maintainer: Maxim Kim <habamax@gmail.com>
4" Filenames: *.gdshader
5
6if exists("b:current_syntax")
7 finish
8endif
9
10syn keyword gdshaderConditional if else switch case default
11syn keyword gdshaderRepeat for while do
12syn keyword gdshaderStatement return discard
13syn keyword gdshaderBoolean true false
14
15syn keyword gdshaderKeyword shader_type render_mode
16syn keyword gdshaderKeyword in out inout
17syn keyword gdshaderKeyword lowp mediump highp
18syn keyword gdshaderKeyword uniform varying const
19syn keyword gdshaderKeyword flat smooth
20
21syn keyword gdshaderType float vec2 vec3 vec4
22syn keyword gdshaderType uint uvec2 uvec3 uvec4
23syn keyword gdshaderType int ivec2 ivec3 ivec4
24syn keyword gdshaderType void bool
25syn keyword gdshaderType bvec2 bvec3 bvec4
26syn keyword gdshaderType mat2 mat3 mat4
27syn keyword gdshaderType sampler2D isampler2D usampler2D samplerCube
28
29syn match gdshaderMember "\v<(\.)@<=[a-z_]+\w*>"
30syn match gdshaderBuiltin "\v<[A-Z_]+[A-Z0-9_]*>"
31syn match gdshaderFunction "\v<\w*>(\()@="
32
33syn match gdshaderNumber "\v<\d+(\.)@!>"
34syn match gdshaderFloat "\v<\d*\.\d+(\.)@!>"
35syn match gdshaderFloat "\v<\d*\.=\d+(e-=\d+)@="
36syn match gdshaderExponent "\v(\d*\.=\d+)@<=e-=\d+>"
37
38syn match gdshaderComment "\v//.*$" contains=@Spell
39syn region gdshaderComment start="/\*" end="\*/" contains=@Spell
40syn keyword gdshaderTodo TODO FIXME XXX NOTE BUG HACK OPTIMIZE containedin=gdshaderComment
41
42hi def link gdshaderConditional Conditional
43hi def link gdshaderRepeat Repeat
44hi def link gdshaderStatement Statement
45hi def link gdshaderBoolean Boolean
46hi def link gdshaderKeyword Keyword
47hi def link gdshaderMember Identifier
48hi def link gdshaderBuiltin Identifier
49hi def link gdshaderFunction Function
50hi def link gdshaderType Type
51hi def link gdshaderNumber Number
52hi def link gdshaderFloat Float
53hi def link gdshaderExponent Special
54hi def link gdshaderComment Comment
55hi def link gdshaderTodo Todo
56
57let b:current_syntax = "gdshader"