annotate runtime/syntax/go.vim @ 23640:8dcb2255ff9a v8.2.2362

patch 8.2.2362: Vim9: check of builtin function argument type is incomplete Commit: https://github.com/vim/vim/commit/351ead09dd365ebdee2bfa27ab22542d4920c779 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 16 16:07:01 2021 +0100 patch 8.2.2362: Vim9: check of builtin function argument type is incomplete Problem: Vim9: check of builtin function argument type is incomplete. Solution: Use need_type() instead of check_arg_type().
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Jan 2021 16:15:04 +0100
parents 1e8ebf870720
children 84c7dc0fdcd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: Go
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 " Maintainer: David Barnett (https://github.com/google/vim-ft-go)
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 " Last Change: 2014 Aug 16
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 " Options:
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 " There are some options for customizing the highlighting; the recommended
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 " settings are the default values, but you can write:
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 " let OPTION_NAME = 0
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 " in your ~/.vimrc file to disable particular options. You can also write:
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 " let OPTION_NAME = 1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 " to enable particular options. At present, all options default to on.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 "
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 " - g:go_highlight_array_whitespace_error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 " Highlights white space after "[]".
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 " - g:go_highlight_chan_whitespace_error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 " Highlights white space around the communications operator that don't
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 " follow the standard style.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 " - g:go_highlight_extra_types
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 " Highlights commonly used library types (io.Reader, etc.).
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 " - g:go_highlight_space_tab_error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 " Highlights instances of tabs following spaces.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 " - g:go_highlight_trailing_whitespace_error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 " Highlights trailing white space.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 " Quit when a (custom) syntax file was already loaded
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 if exists('b:current_syntax')
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 finish
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 if !exists('g:go_highlight_array_whitespace_error')
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 let g:go_highlight_array_whitespace_error = 1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 if !exists('g:go_highlight_chan_whitespace_error')
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 let g:go_highlight_chan_whitespace_error = 1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 if !exists('g:go_highlight_extra_types')
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 let g:go_highlight_extra_types = 1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 if !exists('g:go_highlight_space_tab_error')
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 let g:go_highlight_space_tab_error = 1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 if !exists('g:go_highlight_trailing_whitespace_error')
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 let g:go_highlight_trailing_whitespace_error = 1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 syn case match
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 syn keyword goDirective package import
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 syn keyword goDeclaration var const type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 syn keyword goDeclType struct interface
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 hi def link goDirective Statement
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 hi def link goDeclaration Keyword
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 hi def link goDeclType Keyword
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 " Keywords within functions
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 syn keyword goStatement defer go goto return break continue fallthrough
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 syn keyword goConditional if else switch select
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 syn keyword goLabel case default
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 syn keyword goRepeat for range
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 hi def link goStatement Statement
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 hi def link goConditional Conditional
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 hi def link goLabel Label
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66 hi def link goRepeat Repeat
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 " Predefined types
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 syn keyword goType chan map bool string error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 syn keyword goSignedInts int int8 int16 int32 int64 rune
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 syn keyword goFloats float32 float64
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 syn keyword goComplexes complex64 complex128
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 hi def link goType Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 hi def link goSignedInts Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 hi def link goUnsignedInts Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 hi def link goFloats Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 hi def link goComplexes Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 " Treat func specially: it's a declaration at the start of a line, but a type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 " elsewhere. Order matters here.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 syn match goType /\<func\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 syn match goDeclaration /^func\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 " Predefined functions and values
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 syn keyword goBuiltins append cap close complex copy delete imag len
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 syn keyword goBuiltins make new panic print println real recover
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 syn keyword goConstants iota true false nil
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 hi def link goBuiltins Keyword
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 hi def link goConstants Keyword
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 " Comments; their contents
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 syn keyword goTodo contained TODO FIXME XXX BUG
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 syn cluster goCommentGroup contains=goTodo
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97 syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
98 syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
99
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
100 hi def link goComment Comment
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101 hi def link goTodo Todo
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
103 " Go escapes
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
104 syn match goEscapeOctal display contained "\\[0-7]\{3}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
105 syn match goEscapeC display contained +\\[abfnrtv\\'"]+
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106 syn match goEscapeX display contained "\\x\x\{2}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
107 syn match goEscapeU display contained "\\u\x\{4}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 syn match goEscapeBigU display contained "\\U\x\{8}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109 syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
111 hi def link goEscapeOctal goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
112 hi def link goEscapeC goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113 hi def link goEscapeX goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
114 hi def link goEscapeU goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
115 hi def link goEscapeBigU goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 hi def link goSpecialString Special
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
117 hi def link goEscapeError Error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
118
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
119 " Strings and their contents
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
120 syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
121 syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
122 syn region goRawString start=+`+ end=+`+
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
123
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
124 hi def link goString String
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
125 hi def link goRawString String
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
126
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
127 " Characters; their contents
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
128 syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
129 syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
130
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
131 hi def link goCharacter Character
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
132
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
133 " Regions
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
134 syn region goBlock start="{" end="}" transparent fold
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
135 syn region goParen start='(' end=')' transparent
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
136
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
137 " Integers
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
138 syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
139 syn match goHexadecimalInt "\<0x\x\+\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
140 syn match goOctalInt "\<0\o\+\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
141 syn match goOctalError "\<0\o*[89]\d*\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
142
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
143 hi def link goDecimalInt Integer
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
144 hi def link goHexadecimalInt Integer
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
145 hi def link goOctalInt Integer
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
146 hi def link Integer Number
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
147
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
148 " Floating point
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
149 syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
150 syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
151 syn match goFloat "\<\d\+[Ee][-+]\d\+\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
152
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
153 hi def link goFloat Float
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
154
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
155 " Imaginary literals
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
156 syn match goImaginary "\<\d\+i\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
157 syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
158 syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
159 syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
160
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
161 hi def link goImaginary Number
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
162
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
163 " Spaces after "[]"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
164 if go_highlight_array_whitespace_error != 0
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
165 syn match goSpaceError display "\(\[\]\)\@<=\s\+"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
166 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
167
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
168 " Spacing errors around the 'chan' keyword
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
169 if go_highlight_chan_whitespace_error != 0
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
170 " receive-only annotation on chan type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
171 syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@="
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
172 " send-only annotation on chan type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
173 syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@="
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
174 " value-ignoring receives in a few contexts
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
175 syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
176 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
177
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
178 " Extra types commonly seen
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
179 if go_highlight_extra_types != 0
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
180 syn match goExtraType /\<bytes\.\(Buffer\)\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
181 syn match goExtraType /\<io\.\(Reader\|Writer\|ReadWriter\|ReadWriteCloser\)\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
182 syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
183 syn match goExtraType /\<unsafe\.Pointer\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
184 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
185
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
186 " Space-tab error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
187 if go_highlight_space_tab_error != 0
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
188 syn match goSpaceError display " \+\t"me=e-1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
189 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
190
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
191 " Trailing white space error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
192 if go_highlight_trailing_whitespace_error != 0
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
193 syn match goSpaceError display excludenl "\s\+$"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
194 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
195
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
196 hi def link goExtraType Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
197 hi def link goSpaceError Error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
198
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
199 " Search backwards for a global declaration to start processing the syntax.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
200 "syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
201
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
202 " There's a bug in the implementation of grouphere. For now, use the
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
203 " following as a more expensive/less precise workaround.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
204 syn sync minlines=500
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
205
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
206 let b:current_syntax = 'go'
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
207
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
208 " vim: sw=2 sts=2 et