comparison runtime/syntax/gdscript.vim @ 29996:e37754a13778

Update runtime files Commit: https://github.com/vim/vim/commit/9b03d3e75b4274493bbe76772d7b92238791964c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 30 20:26:34 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Tue, 30 Aug 2022 21:30:04 +0200
parents
children ebed259f919f
comparison
equal deleted inserted replaced
29995:29bc4a7d4995 29996:e37754a13778
1 " Vim syntax file for Godot gdscript
2 " Language: gdscript
3 " Maintainer: Maxim Kim <habamax@gmail.com>
4 " Filenames: *.gd
5
6 if exists("b:current_syntax")
7 finish
8 endif
9
10 let s:keepcpo= &cpo
11 set cpo&vim
12
13 syntax sync maxlines=100
14
15 syn keyword gdscriptConditional if else elif match
16 syn keyword gdscriptRepeat for while break continue
17
18 syn keyword gdscriptOperator is as not and or in
19
20 syn match gdscriptClass "\v<\u\w+>"
21 syn match gdscriptConstant "\<[_A-Z]\+[0-9_A-Z]*\>"
22 syn match gdscriptBlockStart ":\s*$"
23
24 syn keyword gdscriptKeyword null self owner parent tool
25 syn keyword gdscriptBoolean false true
26
27 syn keyword gdscriptStatement remote master puppet remotesync mastersync puppetsync sync
28 syn keyword gdscriptStatement return pass
29 syn keyword gdscriptStatement static const enum
30 syn keyword gdscriptStatement breakpoint assert
31 syn keyword gdscriptStatement onready
32 syn keyword gdscriptStatement class_name extends
33
34 syn keyword gdscriptType void bool int float String contained
35
36 syn keyword gdscriptStatement var nextgroup=gdscriptTypeDecl skipwhite
37 syn keyword gdscriptStatement const nextgroup=gdscriptTypeDecl skipwhite
38 syn match gdscriptTypeDecl "\h\w*\s*:\s*\h\w*" contains=gdscriptOperator,gdscriptType,gdscriptClass contained skipwhite
39 syn match gdscriptTypeDecl "->\s*\h\w*" contains=gdscriptOperator,gdscriptType,gdscriptClass skipwhite
40
41 syn keyword gdscriptStatement export nextgroup=gdscriptExportTypeDecl skipwhite
42 syn match gdscriptExportTypeDecl "(.\{-}[,)]" contains=gdscriptOperator,gdscriptType,gdscriptClass contained skipwhite
43
44 syn keyword gdscriptStatement setget nextgroup=gdscriptSetGet,gdscriptSetGetSeparator skipwhite
45 syn match gdscriptSetGet "\h\w*" nextgroup=gdscriptSetGetSeparator display contained skipwhite
46 syn match gdscriptSetGetSeparator "," nextgroup=gdscriptSetGet display contained skipwhite
47
48 syn keyword gdscriptStatement class func signal nextgroup=gdscriptFunctionName skipwhite
49 syn match gdscriptFunctionName "\h\w*" nextgroup=gdscriptFunctionParams display contained skipwhite
50 syn match gdscriptFunctionParams "(.*)" contains=gdscriptTypeDecl display contained skipwhite
51
52 syn match gdscriptNode "\$\h\w*\%(/\h\w*\)*"
53
54 syn match gdscriptComment "#.*$" contains=@Spell,gdscriptTodo
55
56 syn region gdscriptString matchgroup=gdscriptQuotes
57 \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
58 \ contains=gdscriptEscape,@Spell
59
60 syn region gdscriptString matchgroup=gdscriptTripleQuotes
61 \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend
62 \ contains=gdscriptEscape,@Spell
63
64 syn match gdscriptEscape +\\[abfnrtv'"\\]+ contained
65 syn match gdscriptEscape "\\$"
66
67 " Numbers
68 syn match gdscriptNumber "\<0x\%(_\=\x\)\+\>"
69 syn match gdscriptNumber "\<0b\%(_\=[01]\)\+\>"
70 syn match gdscriptNumber "\<\d\%(_\=\d\)*\>"
71 syn match gdscriptNumber "\<\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>"
72 syn match gdscriptNumber "\<\d\%(_\=\d\)*\.\%(e[+-]\=\d\%(_\=\d\)*\)\=\%(\W\|$\)\@="
73 syn match gdscriptNumber "\%(^\|\W\)\@1<=\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>"
74
75 " XXX, TODO, etc
76 syn keyword gdscriptTodo TODO XXX FIXME HACK NOTE BUG contained
77
78 hi def link gdscriptStatement Statement
79 hi def link gdscriptKeyword Keyword
80 hi def link gdscriptConditional Conditional
81 hi def link gdscriptBoolean Boolean
82 hi def link gdscriptOperator Operator
83 hi def link gdscriptRepeat Repeat
84 hi def link gdscriptSetGet Function
85 hi def link gdscriptFunctionName Function
86 hi def link gdscriptClass Type
87 hi def link gdscriptConstant Constant
88 hi def link gdscriptBuiltinStruct Typedef
89 hi def link gdscriptComment Comment
90 hi def link gdscriptString String
91 hi def link gdscriptQuotes String
92 hi def link gdscriptTripleQuotes String
93 hi def link gdscriptEscape Special
94 hi def link gdscriptNode PreProc
95 hi def link gdscriptType Type
96 hi def link gdscriptNumber Number
97 hi def link gdscriptBlockStart Special
98 hi def link gdscriptTodo Todo
99
100
101 let b:current_syntax = "gdscript"
102
103 let &cpo = s:keepcpo
104 unlet s:keepcpo