annotate runtime/syntax/go.vim @ 28813:3626ca6a20ea v8.2.4930

patch 8.2.4930: interpolated string expression requires escaping Commit: https://github.com/vim/vim/commit/0abc2871c105882ed1c1effb9a7757fad8a395bd Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 10 13:24:30 2022 +0100 patch 8.2.4930: interpolated string expression requires escaping Problem: Interpolated string expression requires escaping. Solution: Do not require escaping in the expression.
author Bram Moolenaar <Bram@vim.org>
date Tue, 10 May 2022 14:30:04 +0200
parents 65de67669df3
children 20cf2080f1ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
1 " Copyright 2009 The Go Authors. All rights reserved.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
2 " Use of this source code is governed by a BSD-style
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
3 " license that can be found in the LICENSE file.
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 "
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
5 " go.vim: Vim syntax file for Go.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
6 " Language: Go
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
7 " Maintainer: Billie Cleek <bhcleek@gmail.com>
25836
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25161
diff changeset
8 " Latest Revision: 2021-09-18
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
9 " License: BSD-style. See LICENSE file in source repository.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
10 " Repository: https://github.com/fatih/vim-go
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 " Quit when a (custom) syntax file was already loaded
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
13 if exists("b:current_syntax")
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 finish
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
17 let s:keepcpo = &cpo
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
18 set cpo&vim
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
19
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
20 function! s:FoldEnable(...) abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
21 if a:0 > 0
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
22 return index(s:FoldEnable(), a:1) > -1
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
23 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
24 return get(g:, 'go_fold_enable', ['block', 'import', 'varconst', 'package_comment'])
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
25 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
26
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
27 function! s:HighlightArrayWhitespaceError() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
28 return get(g:, 'go_highlight_array_whitespace_error', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
29 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
30
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
31 function! s:HighlightChanWhitespaceError() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
32 return get(g:, 'go_highlight_chan_whitespace_error', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
33 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
34
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
35 function! s:HighlightExtraTypes() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
36 return get(g:, 'go_highlight_extra_types', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
37 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
38
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
39 function! s:HighlightSpaceTabError() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
40 return get(g:, 'go_highlight_space_tab_error', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
41 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
42
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
43 function! s:HighlightTrailingWhitespaceError() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
44 return get(g:, 'go_highlight_trailing_whitespace_error', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
45 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
46
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
47 function! s:HighlightOperators() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
48 return get(g:, 'go_highlight_operators', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
49 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
50
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
51 function! s:HighlightFunctions() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
52 return get(g:, 'go_highlight_functions', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
53 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
54
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
55 function! s:HighlightFunctionParameters() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
56 return get(g:, 'go_highlight_function_parameters', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
57 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
58
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
59 function! s:HighlightFunctionCalls() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
60 return get(g:, 'go_highlight_function_calls', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
61 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
62
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
63 function! s:HighlightFields() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
64 return get(g:, 'go_highlight_fields', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
65 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
66
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
67 function! s:HighlightTypes() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
68 return get(g:, 'go_highlight_types', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
69 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
70
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
71 function! s:HighlightBuildConstraints() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
72 return get(g:, 'go_highlight_build_constraints', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
73 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
74
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
75 function! s:HighlightStringSpellcheck() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
76 return get(g:, 'go_highlight_string_spellcheck', 1)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
77 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
78
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
79 function! s:HighlightFormatStrings() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
80 return get(g:, 'go_highlight_format_strings', 1)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
81 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
82
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
83 function! s:HighlightGenerateTags() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
84 return get(g:, 'go_highlight_generate_tags', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
85 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
86
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
87 function! s:HighlightVariableAssignments() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
88 return get(g:, 'go_highlight_variable_assignments', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
89 endfunction
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
90
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
91 function! s:HighlightVariableDeclarations() abort
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
92 return get(g:, 'go_highlight_variable_declarations', 0)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
93 endfunction
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 syn case match
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
97 syn keyword goPackage package
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
98 syn keyword goImport import contained
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
99 syn keyword goVar var contained
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
100 syn keyword goConst const contained
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
102 hi def link goPackage Statement
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
103 hi def link goImport Statement
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
104 hi def link goVar Keyword
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
105 hi def link goConst Keyword
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106 hi def link goDeclaration Keyword
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
107
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 " Keywords within functions
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109 syn keyword goStatement defer go goto return break continue fallthrough
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110 syn keyword goConditional if else switch select
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
111 syn keyword goLabel case default
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
112 syn keyword goRepeat for range
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
114 hi def link goStatement Statement
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
115 hi def link goConditional Conditional
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 hi def link goLabel Label
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
117 hi def link goRepeat Repeat
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 " Predefined types
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
120 syn keyword goType chan map bool string error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
121 syn keyword goSignedInts int int8 int16 int32 int64 rune
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
122 syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
123 syn keyword goFloats float32 float64
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
124 syn keyword goComplexes complex64 complex128
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
125
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
126 hi def link goType Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
127 hi def link goSignedInts Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
128 hi def link goUnsignedInts Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
129 hi def link goFloats Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
130 hi def link goComplexes Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
131
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
132 " Predefined functions and values
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
133 syn keyword goBuiltins append cap close complex copy delete imag len
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
134 syn keyword goBuiltins make new panic print println real recover
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
135 syn keyword goBoolean true false
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
136 syn keyword goPredefinedIdentifiers nil iota
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
137
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
138 hi def link goBuiltins Identifier
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
139 hi def link goBoolean Boolean
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
140 hi def link goPredefinedIdentifiers goBoolean
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
141
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
142 " Comments; their contents
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
143 syn keyword goTodo contained TODO FIXME XXX BUG
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
144 syn cluster goCommentGroup contains=goTodo
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
145
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
146 syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
147 if s:FoldEnable('comment')
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
148 syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell fold
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
149 syn match goComment "\v(^\s*//.*\n)+" contains=goGenerate,@goCommentGroup,@Spell fold
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
150 else
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
151 syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
152 endif
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
154 hi def link goComment Comment
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
155 hi def link goTodo Todo
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
156
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
157 if s:HighlightGenerateTags()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
158 syn match goGenerateVariables contained /\%(\$GOARCH\|\$GOOS\|\$GOFILE\|\$GOLINE\|\$GOPACKAGE\|\$DOLLAR\)\>/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
159 syn region goGenerate start="^\s*//go:generate" end="$" contains=goGenerateVariables
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
160 hi def link goGenerate PreProc
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
161 hi def link goGenerateVariables Special
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
162 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
163
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
164 " Go escapes
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
165 syn match goEscapeOctal display contained "\\[0-7]\{3}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
166 syn match goEscapeC display contained +\\[abfnrtv\\'"]+
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
167 syn match goEscapeX display contained "\\x\x\{2}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
168 syn match goEscapeU display contained "\\u\x\{4}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
169 syn match goEscapeBigU display contained "\\U\x\{8}"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
170 syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
171
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
172 hi def link goEscapeOctal goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
173 hi def link goEscapeC goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
174 hi def link goEscapeX goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
175 hi def link goEscapeU goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
176 hi def link goEscapeBigU goSpecialString
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
177 hi def link goSpecialString Special
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
178 hi def link goEscapeError Error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
179
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
180 " Strings and their contents
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
181 syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
182 if s:HighlightStringSpellcheck()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
183 syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup,@Spell
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
184 syn region goRawString start=+`+ end=+`+ contains=@Spell
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
185 else
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
186 syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
187 syn region goRawString start=+`+ end=+`+
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
188 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
189
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
190 if s:HighlightFormatStrings()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
191 " [n] notation is valid for specifying explicit argument indexes
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
192 " 1. Match a literal % not preceded by a %.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
193 " 2. Match any number of -, #, 0, space, or +
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
194 " 3. Match * or [n]* or any number or nothing before a .
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
195 " 4. Match * or [n]* or any number or nothing after a .
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
196 " 5. Match [n] or nothing before a verb
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
197 " 6. Match a formatting verb
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
198 syn match goFormatSpecifier /\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
199 \%([^%]\%(%%\)*\)\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
200 \@<=%[-#0 +]*\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
201 \%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
202 \%(\.\%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\)\=\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
203 \%(\[\d\+\]\)\=[vTtbcdoqxXUeEfFgGspw]/ contained containedin=goString,goRawString
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
204 hi def link goFormatSpecifier goSpecialString
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
205 endif
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
206
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
207 hi def link goString String
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
208 hi def link goRawString String
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
209
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
210 " Characters; their contents
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
211 syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
212 syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
213
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
214 hi def link goCharacter Character
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
215
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
216 " Regions
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
217 syn region goParen start='(' end=')' transparent
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
218 if s:FoldEnable('block')
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
219 syn region goBlock start="{" end="}" transparent fold
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
220 else
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
221 syn region goBlock start="{" end="}" transparent
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
222 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
223
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
224 " import
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
225 if s:FoldEnable('import')
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
226 syn region goImport start='import (' end=')' transparent fold contains=goImport,goString,goComment
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
227 else
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
228 syn region goImport start='import (' end=')' transparent contains=goImport,goString,goComment
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
229 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
230
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
231 " var, const
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
232 if s:FoldEnable('varconst')
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
233 syn region goVar start='var (' end='^\s*)$' transparent fold
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
234 \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
235 syn region goConst start='const (' end='^\s*)$' transparent fold
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
236 \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
237 else
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
238 syn region goVar start='var (' end='^\s*)$' transparent
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
239 \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
240 syn region goConst start='const (' end='^\s*)$' transparent
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
241 \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
242 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
243
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
244 " Single-line var, const, and import.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
245 syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
246
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
247 " Integers
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
248 syn match goDecimalInt "\<-\=\(0\|[1-9]_\?\(\d\|\d\+_\?\d\+\)*\)\%([Ee][-+]\=\d\+\)\=\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
249 syn match goDecimalError "\<-\=\(_\(\d\+_*\)\+\|\([1-9]\d*_*\)\+__\(\d\+_*\)\+\|\([1-9]\d*_*\)\+_\+\)\%([Ee][-+]\=\d\+\)\=\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
250 syn match goHexadecimalInt "\<-\=0[xX]_\?\(\x\+_\?\)\+\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
251 syn match goHexadecimalError "\<-\=0[xX]_\?\(\x\+_\?\)*\(\([^ \t0-9A-Fa-f_)]\|__\)\S*\|_\)\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
252 syn match goOctalInt "\<-\=0[oO]\?_\?\(\o\+_\?\)\+\>"
25836
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25161
diff changeset
253 syn match goOctalError "\<-\=0[0-7oO_]*\(\([^ \t0-7oOxX_/)\]\}\:;]\|[oO]\{2,\}\|__\)\S*\|_\|[oOxX]\)\>"
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
254 syn match goBinaryInt "\<-\=0[bB]_\?\([01]\+_\?\)\+\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
255 syn match goBinaryError "\<-\=0[bB]_\?[01_]*\([^ \t01_)]\S*\|__\S*\|_\)\>"
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
256
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
257 hi def link goDecimalInt Integer
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
258 hi def link goDecimalError Error
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
259 hi def link goHexadecimalInt Integer
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
260 hi def link goHexadecimalError Error
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
261 hi def link goOctalInt Integer
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
262 hi def link goOctalError Error
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
263 hi def link goBinaryInt Integer
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
264 hi def link goBinaryError Error
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
265 hi def link Integer Number
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
266
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
267 " Floating point
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
268 syn match goFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
269 syn match goFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=\>"
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
270
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
271 hi def link goFloat Float
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
272
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
273 " Imaginary literals
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
274 syn match goImaginary "\<-\=\d\+i\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
275 syn match goImaginary "\<-\=\d\+[Ee][-+]\=\d\+i\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
276 syn match goImaginaryFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=i\>"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
277 syn match goImaginaryFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=i\>"
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
278
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
279 hi def link goImaginary Number
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
280 hi def link goImaginaryFloat Float
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
281
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
282 " Spaces after "[]"
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
283 if s:HighlightArrayWhitespaceError()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
284 syn match goSpaceError display "\%(\[\]\)\@<=\s\+"
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
285 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
286
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
287 " Spacing errors around the 'chan' keyword
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
288 if s:HighlightChanWhitespaceError()
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
289 " receive-only annotation on chan type
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
290 "
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
291 " \(\<chan\>\)\@<!<- (only pick arrow when it doesn't come after a chan)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
292 " this prevents picking up 'chan<- chan<-' but not '<- chan'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
293 syn match goSpaceError display "\%(\%(\<chan\>\)\@<!<-\)\@<=\s\+\%(\<chan\>\)\@="
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
294
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
295 " send-only annotation on chan type
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
296 "
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
297 " \(<-\)\@<!\<chan\> (only pick chan when it doesn't come after an arrow)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
298 " this prevents picking up '<-chan <-chan' but not 'chan <-'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
299 syn match goSpaceError display "\%(\%(<-\)\@<!\<chan\>\)\@<=\s\+\%(<-\)\@="
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
300
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
301 " value-ignoring receives in a few contexts
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
302 syn match goSpaceError display "\%(\%(^\|[={(,;]\)\s*<-\)\@<=\s\+"
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
303 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
304
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
305 " Extra types commonly seen
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
306 if s:HighlightExtraTypes()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
307 syn match goExtraType /\<bytes\.\%(Buffer\)\>/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
308 syn match goExtraType /\<context\.\%(Context\)\>/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
309 syn match goExtraType /\<io\.\%(Reader\|ReadSeeker\|ReadWriter\|ReadCloser\|ReadWriteCloser\|Writer\|WriteCloser\|Seeker\)\>/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
310 syn match goExtraType /\<reflect\.\%(Kind\|Type\|Value\)\>/
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
311 syn match goExtraType /\<unsafe\.Pointer\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
312 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
313
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
314 " Space-tab error
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
315 if s:HighlightSpaceTabError()
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
316 syn match goSpaceError display " \+\t"me=e-1
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
317 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
318
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
319 " Trailing white space error
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
320 if s:HighlightTrailingWhitespaceError()
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
321 syn match goSpaceError display excludenl "\s\+$"
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
322 endif
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
323
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
324 hi def link goExtraType Type
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
325 hi def link goSpaceError Error
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
326
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
327
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
328
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
329 " included from: https://github.com/athom/more-colorful.vim/blob/master/after/syntax/go.vim
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
330 "
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
331 " Comments; their contents
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
332 syn keyword goTodo contained NOTE
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
333 hi def link goTodo Todo
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
334
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
335 syn match goVarArgs /\.\.\./
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
336
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
337 " Operators;
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
338 if s:HighlightOperators()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
339 " match single-char operators: - + % < > ! & | ^ * =
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
340 " and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= ==
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
341 syn match goOperator /[-+%<>!&|^*=]=\?/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
342 " match / and /=
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
343 syn match goOperator /\/\%(=\|\ze[^/*]\)/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
344 " match two-char operators: << >> &^
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
345 " and corresponding three-char operators: <<= >>= &^=
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
346 syn match goOperator /\%(<<\|>>\|&^\)=\?/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
347 " match remaining two-char operators: := && || <- ++ --
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
348 syn match goOperator /:=\|||\|<-\|++\|--/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
349 " match ...
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
350
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
351 hi def link goPointerOperator goOperator
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
352 hi def link goVarArgs goOperator
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
353 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
354 hi def link goOperator Operator
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
355
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
356 " Functions;
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
357 if s:HighlightFunctions() || s:HighlightFunctionParameters()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
358 syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleParams skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
359 syn match goReceiverVar /\w\+\ze\s\+\%(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
360 syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
361 syn match goFunction /\w\+/ nextgroup=goSimpleParams contained skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
362 syn match goReceiverType /\w\+/ contained
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
363 if s:HighlightFunctionParameters()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
364 syn match goSimpleParams /(\%(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType nextgroup=goFunctionReturn skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
365 syn match goFunctionReturn /(\%(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goParamName,goType skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
366 syn match goParamName /\w\+\%(\s*,\s*\w\+\)*\ze\s\+\%(\w\|\.\|\*\|\[\)/ contained nextgroup=goParamType skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
367 syn match goParamType /\%([^,)]\|\_s\)\+,\?/ contained nextgroup=goParamName skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
368 \ contains=goVarArgs,goType,goSignedInts,goUnsignedInts,goFloats,goComplexes,goDeclType,goBlock
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
369 hi def link goReceiverVar goParamName
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
370 hi def link goParamName Identifier
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
371 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
372 syn match goReceiver /(\s*\w\+\%(\s\+\*\?\s*\w\+\)\?\s*)\ze\s*\w/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
373 else
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
374 syn keyword goDeclaration func
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
375 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
376 hi def link goFunction Function
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
377
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
378 " Function calls;
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
379 if s:HighlightFunctionCalls()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
380 syn match goFunctionCall /\w\+\ze(/ contains=goBuiltins,goDeclaration
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
381 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
382 hi def link goFunctionCall Type
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
383
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
384 " Fields;
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
385 if s:HighlightFields()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
386 " 1. Match a sequence of word characters coming after a '.'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
387 " 2. Require the following but dont match it: ( \@= see :h E59)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
388 " - The symbols: / - + * % OR
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
389 " - The symbols: [] {} <> ) OR
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
390 " - The symbols: \n \r space OR
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
391 " - The symbols: , : .
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
392 " 3. Have the start of highlight (hs) be the start of matched
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
393 " pattern (s) offsetted one to the right (+1) (see :h E401)
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
394 syn match goField /\.\w\+\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
395 \%(\%([\/\-\+*%]\)\|\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
396 \%([\[\]{}<\>\)]\)\|\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
397 \%([\!=\^|&]\)\|\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
398 \%([\n\r\ ]\)\|\
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
399 \%([,\:.]\)\)\@=/hs=s+1
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
400 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
401 hi def link goField Identifier
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
402
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
403 " Structs & Interfaces;
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
404 if s:HighlightTypes()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
405 syn match goTypeConstructor /\<\w\+{\@=/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
406 syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
407 syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
408 syn match goDeclType /\<\%(interface\|struct\)\>/ skipwhite skipnl
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
409 hi def link goReceiverType Type
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
410 else
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
411 syn keyword goDeclType struct interface
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
412 syn keyword goDeclaration type
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
413 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
414 hi def link goTypeConstructor Type
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
415 hi def link goTypeName Type
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
416 hi def link goTypeDecl Keyword
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
417 hi def link goDeclType Keyword
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
418
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
419 " Variable Assignments
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
420 if s:HighlightVariableAssignments()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
421 syn match goVarAssign /\v[_.[:alnum:]]+(,\s*[_.[:alnum:]]+)*\ze(\s*([-^+|^\/%&]|\*|\<\<|\>\>|\&\^)?\=[^=])/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
422 hi def link goVarAssign Special
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
423 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
424
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
425 " Variable Declarations
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
426 if s:HighlightVariableDeclarations()
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
427 syn match goVarDefs /\v\w+(,\s*\w+)*\ze(\s*:\=)/
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
428 hi def link goVarDefs Special
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
429 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
430
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
431 " Build Constraints
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
432 if s:HighlightBuildConstraints()
25836
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25161
diff changeset
433 syn match goBuildKeyword display contained "+build\|go:build"
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
434 " Highlight the known values of GOOS, GOARCH, and other +build options.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
435 syn keyword goBuildDirectives contained
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
436 \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
437 \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
438 \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
439 \ s390 s390x sparc sparc64 cgo ignore race
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
440
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
441 " Other words in the build directive are build tags not listed above, so
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
442 " avoid highlighting them as comments by using a matchgroup just for the
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
443 " start of the comment.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
444 " The rs=s+2 option lets the \s*+build portion be part of the inner region
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
445 " instead of the matchgroup so it will be highlighted as a goBuildKeyword.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
446 syn region goBuildComment matchgroup=goBuildCommentStart
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
447 \ start="//\s*+build\s"rs=s+2 end="$"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
448 \ contains=goBuildKeyword,goBuildDirectives
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
449 hi def link goBuildCommentStart Comment
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
450 hi def link goBuildDirectives Type
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
451 hi def link goBuildKeyword PreProc
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
452 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
453
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
454 if s:HighlightBuildConstraints() || s:FoldEnable('package_comment')
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
455 " One or more line comments that are followed immediately by a "package"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
456 " declaration are treated like package documentation, so these must be
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
457 " matched as comments to avoid looking like working build constraints.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
458 " The he, me, and re options let the "package" itself be highlighted by
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
459 " the usual rules.
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
460 exe 'syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
461 \ . ' end=/\v\n\s*package/he=e-7,me=e-7,re=e-7'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
462 \ . ' contains=@goCommentGroup,@Spell'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
463 \ . (s:FoldEnable('package_comment') ? ' fold' : '')
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
464 exe 'syn region goPackageComment start=/\v^\s*\/\*.*\n(.*\n)*\s*\*\/\npackage/'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
465 \ . ' end=/\v\*\/\n\s*package/he=e-7,me=e-7,re=e-7'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
466 \ . ' contains=@goCommentGroup,@Spell'
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
467 \ . (s:FoldEnable('package_comment') ? ' fold' : '')
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
468 hi def link goPackageComment Comment
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
469 endif
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
470
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
471 " :GoCoverage commands
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
472 hi def link goCoverageNormalText Comment
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
473
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
474 " Search backwards for a global declaration to start processing the syntax.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
475 "syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
476
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
477 " 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
478 " following as a more expensive/less precise workaround.
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
479 syn sync minlines=500
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
480
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
481 let b:current_syntax = "go"
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
482
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
483 let &cpo = s:keepcpo
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 6153
diff changeset
484 unlet s:keepcpo
6153
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
485
1e8ebf870720 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
486 " vim: sw=2 sts=2 et