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