xref: /vim-8.2.3635/runtime/syntax/kconfig.vim (revision f2571c61)
1" Vim syntax file
2" Maintainer:           Christian Brabandt <[email protected]>
3" Previous Maintainer:  Nikolai Weibull <[email protected]>
4" Latest Revision:      2015-05-29
5" License:              Vim (see :h license)
6" Repository:		https://github.com/chrisbra/vim-kconfig
7
8if exists("b:current_syntax")
9  finish
10endif
11
12let s:cpo_save = &cpo
13set cpo&vim
14
15if exists("g:kconfig_syntax_heavy")
16
17syn match   kconfigBegin              '^' nextgroup=kconfigKeyword
18                                      \ skipwhite
19
20syn keyword kconfigTodo               contained TODO FIXME XXX NOTE
21
22syn match   kconfigComment            display '#.*$' contains=kconfigTodo
23
24syn keyword kconfigKeyword            config nextgroup=kconfigSymbol
25                                      \ skipwhite
26
27syn keyword kconfigKeyword            menuconfig nextgroup=kconfigSymbol
28                                      \ skipwhite
29
30syn keyword kconfigKeyword            comment menu mainmenu
31                                      \ nextgroup=kconfigKeywordPrompt
32                                      \ skipwhite
33
34syn keyword kconfigKeyword            choice
35                                      \ nextgroup=@kconfigConfigOptions
36                                      \ skipwhite skipnl
37
38syn keyword kconfigKeyword            endmenu endchoice
39
40syn keyword kconfigPreProc            source
41                                      \ nextgroup=kconfigPath
42                                      \ skipwhite
43
44" TODO: This is a hack.  The who .*Expr stuff should really be generated so
45" that we can reuse it for various nextgroups.
46syn keyword kconfigConditional        if endif
47                                      \ nextgroup=@kconfigConfigOptionIfExpr
48                                      \ skipwhite
49
50syn match   kconfigKeywordPrompt      '"[^"\\]*\%(\\.[^"\\]*\)*"'
51                                      \ contained
52                                      \ nextgroup=@kconfigConfigOptions
53                                      \ skipwhite skipnl
54
55syn match   kconfigPath               '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
56                                      \ contained
57
58syn match   kconfigSymbol             '\<\k\+\>'
59                                      \ contained
60                                      \ nextgroup=@kconfigConfigOptions
61                                      \ skipwhite skipnl
62
63" FIXME: There is – probably – no reason to cluster these instead of just
64" defining them in the same group.
65syn cluster kconfigConfigOptions      contains=kconfigTypeDefinition,
66                                      \        kconfigInputPrompt,
67                                      \        kconfigDefaultValue,
68                                      \        kconfigDependencies,
69                                      \        kconfigReverseDependencies,
70                                      \        kconfigNumericalRanges,
71                                      \        kconfigHelpText,
72                                      \        kconfigDefBool,
73                                      \        kconfigOptional
74
75syn keyword kconfigTypeDefinition     bool boolean tristate string hex int
76                                      \ contained
77                                      \ nextgroup=kconfigTypeDefPrompt,
78                                      \           @kconfigConfigOptions
79                                      \ skipwhite skipnl
80
81syn match   kconfigTypeDefPrompt      '"[^"\\]*\%(\\.[^"\\]*\)*"'
82                                      \ contained
83                                      \ nextgroup=kconfigConfigOptionIf,
84                                      \           @kconfigConfigOptions
85                                      \ skipwhite skipnl
86
87syn match   kconfigTypeDefPrompt      "'[^'\\]*\%(\\.[^'\\]*\)*'"
88                                      \ contained
89                                      \ nextgroup=kconfigConfigOptionIf,
90                                      \           @kconfigConfigOptions
91                                      \ skipwhite skipnl
92
93syn keyword kconfigInputPrompt        prompt
94                                      \ contained
95                                      \ nextgroup=kconfigPromptPrompt
96                                      \ skipwhite
97
98syn match   kconfigPromptPrompt       '"[^"\\]*\%(\\.[^"\\]*\)*"'
99                                      \ contained
100                                      \ nextgroup=kconfigConfigOptionIf,
101                                      \           @kconfigConfigOptions
102                                      \ skipwhite skipnl
103
104syn match   kconfigPromptPrompt       "'[^'\\]*\%(\\.[^'\\]*\)*'"
105                                      \ contained
106                                      \ nextgroup=kconfigConfigOptionIf,
107                                      \           @kconfigConfigOptions
108                                      \ skipwhite skipnl
109
110syn keyword   kconfigDefaultValue     default
111                                      \ contained
112                                      \ nextgroup=@kconfigConfigOptionExpr
113                                      \ skipwhite
114
115syn match   kconfigDependencies       'depends on\|requires'
116                                      \ contained
117                                      \ nextgroup=@kconfigConfigOptionIfExpr
118                                      \ skipwhite
119
120syn keyword kconfigReverseDependencies select
121                                      \ contained
122                                      \ nextgroup=@kconfigRevDepSymbol
123                                      \ skipwhite
124
125syn cluster kconfigRevDepSymbol       contains=kconfigRevDepCSymbol,
126                                      \        kconfigRevDepNCSymbol
127
128syn match   kconfigRevDepCSymbol      '"[^"\\]*\%(\\.[^"\\]*\)*"'
129                                      \ contained
130                                      \ nextgroup=kconfigConfigOptionIf,
131                                      \           @kconfigConfigOptions
132                                      \ skipwhite skipnl
133
134syn match   kconfigRevDepCSymbol      "'[^'\\]*\%(\\.[^'\\]*\)*'"
135                                      \ contained
136                                      \ nextgroup=kconfigConfigOptionIf,
137                                      \           @kconfigConfigOptions
138                                      \ skipwhite skipnl
139
140syn match   kconfigRevDepNCSymbol     '\<\k\+\>'
141                                      \ contained
142                                      \ nextgroup=kconfigConfigOptionIf,
143                                      \           @kconfigConfigOptions
144                                      \ skipwhite skipnl
145
146syn keyword kconfigNumericalRanges    range
147                                      \ contained
148                                      \ nextgroup=@kconfigRangeSymbol
149                                      \ skipwhite
150
151syn cluster kconfigRangeSymbol        contains=kconfigRangeCSymbol,
152                                      \        kconfigRangeNCSymbol
153
154syn match   kconfigRangeCSymbol       '"[^"\\]*\%(\\.[^"\\]*\)*"'
155                                      \ contained
156                                      \ nextgroup=@kconfigRangeSymbol2
157                                      \ skipwhite skipnl
158
159syn match   kconfigRangeCSymbol       "'[^'\\]*\%(\\.[^'\\]*\)*'"
160                                      \ contained
161                                      \ nextgroup=@kconfigRangeSymbol2
162                                      \ skipwhite skipnl
163
164syn match   kconfigRangeNCSymbol      '\<\k\+\>'
165                                      \ contained
166                                      \ nextgroup=@kconfigRangeSymbol2
167                                      \ skipwhite skipnl
168
169syn cluster kconfigRangeSymbol2       contains=kconfigRangeCSymbol2,
170                                      \        kconfigRangeNCSymbol2
171
172syn match   kconfigRangeCSymbol2      "'[^'\\]*\%(\\.[^'\\]*\)*'"
173                                      \ contained
174                                      \ nextgroup=kconfigConfigOptionIf,
175                                      \           @kconfigConfigOptions
176                                      \ skipwhite skipnl
177
178syn match   kconfigRangeNCSymbol2     '\<\k\+\>'
179                                      \ contained
180                                      \ nextgroup=kconfigConfigOptionIf,
181                                      \           @kconfigConfigOptions
182                                      \ skipwhite skipnl
183
184syn region  kconfigHelpText           contained
185      \ matchgroup=kconfigConfigOption
186      \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
187      \ skip='^$'
188      \ end='^\z1\@!'
189      \ nextgroup=@kconfigConfigOptions
190      \ skipwhite skipnl
191
192" XXX: Undocumented
193syn keyword kconfigDefBool            def_bool
194                                      \ contained
195                                      \ nextgroup=@kconfigDefBoolSymbol
196                                      \ skipwhite
197
198syn cluster kconfigDefBoolSymbol      contains=kconfigDefBoolCSymbol,
199                                      \        kconfigDefBoolNCSymbol
200
201syn match   kconfigDefBoolCSymbol     '"[^"\\]*\%(\\.[^"\\]*\)*"'
202                                      \ contained
203                                      \ nextgroup=kconfigConfigOptionIf,
204                                      \           @kconfigConfigOptions
205                                      \ skipwhite skipnl
206
207syn match   kconfigDefBoolCSymbol     "'[^'\\]*\%(\\.[^'\\]*\)*'"
208                                      \ contained
209                                      \ nextgroup=kconfigConfigOptionIf,
210                                      \           @kconfigConfigOptions
211                                      \ skipwhite skipnl
212
213syn match   kconfigDefBoolNCSymbol    '\<\k\+\>'
214                                      \ contained
215                                      \ nextgroup=kconfigConfigOptionIf,
216                                      \           @kconfigConfigOptions
217                                      \ skipwhite skipnl
218
219" XXX: This is actually only a valid option for “choice”, but treating it
220" specially would require a lot of extra groups.
221syn keyword kconfigOptional           optional
222                                      \ contained
223                                      \ nextgroup=@kconfigConfigOptions
224                                      \ skipwhite skipnl
225
226syn keyword kconfigConfigOptionIf     if
227                                      \ contained
228                                      \ nextgroup=@kconfigConfigOptionIfExpr
229                                      \ skipwhite
230
231syn cluster kconfigConfigOptionIfExpr contains=@kconfigConfOptIfExprSym,
232                                      \        kconfigConfOptIfExprNeg,
233                                      \        kconfigConfOptIfExprGroup
234
235syn cluster kconfigConfOptIfExprSym   contains=kconfigConfOptIfExprCSym,
236                                      \        kconfigConfOptIfExprNCSym
237
238syn match   kconfigConfOptIfExprCSym  '"[^"\\]*\%(\\.[^"\\]*\)*"'
239                                      \ contained
240                                      \ nextgroup=@kconfigConfigOptions,
241                                      \           kconfigConfOptIfExprAnd,
242                                      \           kconfigConfOptIfExprOr,
243                                      \           kconfigConfOptIfExprEq,
244                                      \           kconfigConfOptIfExprNEq
245                                      \ skipwhite skipnl
246
247syn match   kconfigConfOptIfExprCSym  "'[^'\\]*\%(\\.[^'\\]*\)*'"
248                                      \ contained
249                                      \ nextgroup=@kconfigConfigOptions,
250                                      \           kconfigConfOptIfExprAnd,
251                                      \           kconfigConfOptIfExprOr,
252                                      \           kconfigConfOptIfExprEq,
253                                      \           kconfigConfOptIfExprNEq
254                                      \ skipwhite skipnl
255
256syn match   kconfigConfOptIfExprNCSym '\<\k\+\>'
257                                      \ contained
258                                      \ nextgroup=@kconfigConfigOptions,
259                                      \           kconfigConfOptIfExprAnd,
260                                      \           kconfigConfOptIfExprOr,
261                                      \           kconfigConfOptIfExprEq,
262                                      \           kconfigConfOptIfExprNEq
263                                      \ skipwhite skipnl
264
265syn cluster kconfigConfOptIfExprSym2  contains=kconfigConfOptIfExprCSym2,
266                                      \        kconfigConfOptIfExprNCSym2
267
268syn match   kconfigConfOptIfExprEq    '='
269                                      \ contained
270                                      \ nextgroup=@kconfigConfOptIfExprSym2
271                                      \ skipwhite
272
273syn match   kconfigConfOptIfExprNEq   '!='
274                                      \ contained
275                                      \ nextgroup=@kconfigConfOptIfExprSym2
276                                      \ skipwhite
277
278syn match   kconfigConfOptIfExprCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
279                                      \ contained
280                                      \ nextgroup=@kconfigConfigOptions,
281                                      \           kconfigConfOptIfExprAnd,
282                                      \           kconfigConfOptIfExprOr
283                                      \ skipwhite skipnl
284
285syn match   kconfigConfOptIfExprNCSym2 '\<\k\+\>'
286                                      \ contained
287                                      \ nextgroup=@kconfigConfigOptions,
288                                      \           kconfigConfOptIfExprAnd,
289                                      \           kconfigConfOptIfExprOr
290                                      \ skipwhite skipnl
291
292syn match   kconfigConfOptIfExprNeg   '!'
293                                      \ contained
294                                      \ nextgroup=@kconfigConfigOptionIfExpr
295                                      \ skipwhite
296
297syn match   kconfigConfOptIfExprAnd   '&&'
298                                      \ contained
299                                      \ nextgroup=@kconfigConfigOptionIfExpr
300                                      \ skipwhite
301
302syn match   kconfigConfOptIfExprOr    '||'
303                                      \ contained
304                                      \ nextgroup=@kconfigConfigOptionIfExpr
305                                      \ skipwhite
306
307syn match   kconfigConfOptIfExprGroup '('
308                                      \ contained
309                                      \ nextgroup=@kconfigConfigOptionIfGExp
310                                      \ skipwhite
311
312" TODO: hm, this kind of recursion doesn't work right.  We need another set of
313" expressions that have kconfigConfigOPtionIfGExp as nextgroup and a matcher
314" for '(' that sets it all off.
315syn cluster kconfigConfigOptionIfGExp contains=@kconfigConfOptIfGExpSym,
316                                      \        kconfigConfOptIfGExpNeg,
317                                      \        kconfigConfOptIfExprGroup
318
319syn cluster kconfigConfOptIfGExpSym   contains=kconfigConfOptIfGExpCSym,
320                                      \        kconfigConfOptIfGExpNCSym
321
322syn match   kconfigConfOptIfGExpCSym  '"[^"\\]*\%(\\.[^"\\]*\)*"'
323                                      \ contained
324                                      \ nextgroup=@kconfigConfigIf,
325                                      \           kconfigConfOptIfGExpAnd,
326                                      \           kconfigConfOptIfGExpOr,
327                                      \           kconfigConfOptIfGExpEq,
328                                      \           kconfigConfOptIfGExpNEq
329                                      \ skipwhite skipnl
330
331syn match   kconfigConfOptIfGExpCSym  "'[^'\\]*\%(\\.[^'\\]*\)*'"
332                                      \ contained
333                                      \ nextgroup=@kconfigConfigIf,
334                                      \           kconfigConfOptIfGExpAnd,
335                                      \           kconfigConfOptIfGExpOr,
336                                      \           kconfigConfOptIfGExpEq,
337                                      \           kconfigConfOptIfGExpNEq
338                                      \ skipwhite skipnl
339
340syn match   kconfigConfOptIfGExpNCSym '\<\k\+\>'
341                                      \ contained
342                                      \ nextgroup=kconfigConfOptIfExprGrpE,
343                                      \           kconfigConfOptIfGExpAnd,
344                                      \           kconfigConfOptIfGExpOr,
345                                      \           kconfigConfOptIfGExpEq,
346                                      \           kconfigConfOptIfGExpNEq
347                                      \ skipwhite skipnl
348
349syn cluster kconfigConfOptIfGExpSym2  contains=kconfigConfOptIfGExpCSym2,
350                                      \        kconfigConfOptIfGExpNCSym2
351
352syn match   kconfigConfOptIfGExpEq    '='
353                                      \ contained
354                                      \ nextgroup=@kconfigConfOptIfGExpSym2
355                                      \ skipwhite
356
357syn match   kconfigConfOptIfGExpNEq   '!='
358                                      \ contained
359                                      \ nextgroup=@kconfigConfOptIfGExpSym2
360                                      \ skipwhite
361
362syn match   kconfigConfOptIfGExpCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
363                                      \ contained
364                                      \ nextgroup=kconfigConfOptIfExprGrpE,
365                                      \           kconfigConfOptIfGExpAnd,
366                                      \           kconfigConfOptIfGExpOr
367                                      \ skipwhite skipnl
368
369syn match   kconfigConfOptIfGExpCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
370                                      \ contained
371                                      \ nextgroup=kconfigConfOptIfExprGrpE,
372                                      \           kconfigConfOptIfGExpAnd,
373                                      \           kconfigConfOptIfGExpOr
374                                      \ skipwhite skipnl
375
376syn match   kconfigConfOptIfGExpNCSym2 '\<\k\+\>'
377                                      \ contained
378                                      \ nextgroup=kconfigConfOptIfExprGrpE,
379                                      \           kconfigConfOptIfGExpAnd,
380                                      \           kconfigConfOptIfGExpOr
381                                      \ skipwhite skipnl
382
383syn match   kconfigConfOptIfGExpNeg   '!'
384                                      \ contained
385                                      \ nextgroup=@kconfigConfigOptionIfGExp
386                                      \ skipwhite
387
388syn match   kconfigConfOptIfGExpAnd   '&&'
389                                      \ contained
390                                      \ nextgroup=@kconfigConfigOptionIfGExp
391                                      \ skipwhite
392
393syn match   kconfigConfOptIfGExpOr    '||'
394                                      \ contained
395                                      \ nextgroup=@kconfigConfigOptionIfGExp
396                                      \ skipwhite
397
398syn match   kconfigConfOptIfExprGrpE  ')'
399                                      \ contained
400                                      \ nextgroup=@kconfigConfigOptions,
401                                      \           kconfigConfOptIfExprAnd,
402                                      \           kconfigConfOptIfExprOr
403                                      \ skipwhite skipnl
404
405
406syn cluster kconfigConfigOptionExpr   contains=@kconfigConfOptExprSym,
407                                      \        kconfigConfOptExprNeg,
408                                      \        kconfigConfOptExprGroup
409
410syn cluster kconfigConfOptExprSym     contains=kconfigConfOptExprCSym,
411                                      \        kconfigConfOptExprNCSym
412
413syn match   kconfigConfOptExprCSym    '"[^"\\]*\%(\\.[^"\\]*\)*"'
414                                      \ contained
415                                      \ nextgroup=kconfigConfigOptionIf,
416                                      \           kconfigConfOptExprAnd,
417                                      \           kconfigConfOptExprOr,
418                                      \           kconfigConfOptExprEq,
419                                      \           kconfigConfOptExprNEq,
420                                      \           @kconfigConfigOptions
421                                      \ skipwhite skipnl
422
423syn match   kconfigConfOptExprCSym    "'[^'\\]*\%(\\.[^'\\]*\)*'"
424                                      \ contained
425                                      \ nextgroup=kconfigConfigOptionIf,
426                                      \           kconfigConfOptExprAnd,
427                                      \           kconfigConfOptExprOr,
428                                      \           kconfigConfOptExprEq,
429                                      \           kconfigConfOptExprNEq,
430                                      \           @kconfigConfigOptions
431                                      \ skipwhite skipnl
432
433syn match   kconfigConfOptExprNCSym   '\<\k\+\>'
434                                      \ contained
435                                      \ nextgroup=kconfigConfigOptionIf,
436                                      \           kconfigConfOptExprAnd,
437                                      \           kconfigConfOptExprOr,
438                                      \           kconfigConfOptExprEq,
439                                      \           kconfigConfOptExprNEq,
440                                      \           @kconfigConfigOptions
441                                      \ skipwhite skipnl
442
443syn cluster kconfigConfOptExprSym2    contains=kconfigConfOptExprCSym2,
444                                      \        kconfigConfOptExprNCSym2
445
446syn match   kconfigConfOptExprEq      '='
447                                      \ contained
448                                      \ nextgroup=@kconfigConfOptExprSym2
449                                      \ skipwhite
450
451syn match   kconfigConfOptExprNEq     '!='
452                                      \ contained
453                                      \ nextgroup=@kconfigConfOptExprSym2
454                                      \ skipwhite
455
456syn match   kconfigConfOptExprCSym2   '"[^"\\]*\%(\\.[^"\\]*\)*"'
457                                      \ contained
458                                      \ nextgroup=kconfigConfigOptionIf,
459                                      \           kconfigConfOptExprAnd,
460                                      \           kconfigConfOptExprOr,
461                                      \           @kconfigConfigOptions
462                                      \ skipwhite skipnl
463
464syn match   kconfigConfOptExprCSym2   "'[^'\\]*\%(\\.[^'\\]*\)*'"
465                                      \ contained
466                                      \ nextgroup=kconfigConfigOptionIf,
467                                      \           kconfigConfOptExprAnd,
468                                      \           kconfigConfOptExprOr,
469                                      \           @kconfigConfigOptions
470                                      \ skipwhite skipnl
471
472syn match   kconfigConfOptExprNCSym2  '\<\k\+\>'
473                                      \ contained
474                                      \ nextgroup=kconfigConfigOptionIf,
475                                      \           kconfigConfOptExprAnd,
476                                      \           kconfigConfOptExprOr,
477                                      \           @kconfigConfigOptions
478                                      \ skipwhite skipnl
479
480syn match   kconfigConfOptExprNeg     '!'
481                                      \ contained
482                                      \ nextgroup=@kconfigConfigOptionExpr
483                                      \ skipwhite
484
485syn match   kconfigConfOptExprAnd     '&&'
486                                      \ contained
487                                      \ nextgroup=@kconfigConfigOptionExpr
488                                      \ skipwhite
489
490syn match   kconfigConfOptExprOr      '||'
491                                      \ contained
492                                      \ nextgroup=@kconfigConfigOptionExpr
493                                      \ skipwhite
494
495syn match   kconfigConfOptExprGroup   '('
496                                      \ contained
497                                      \ nextgroup=@kconfigConfigOptionGExp
498                                      \ skipwhite
499
500syn cluster kconfigConfigOptionGExp   contains=@kconfigConfOptGExpSym,
501                                      \        kconfigConfOptGExpNeg,
502                                      \        kconfigConfOptGExpGroup
503
504syn cluster kconfigConfOptGExpSym     contains=kconfigConfOptGExpCSym,
505                                      \        kconfigConfOptGExpNCSym
506
507syn match   kconfigConfOptGExpCSym    '"[^"\\]*\%(\\.[^"\\]*\)*"'
508                                      \ contained
509                                      \ nextgroup=kconfigConfOptExprGrpE,
510                                      \           kconfigConfOptGExpAnd,
511                                      \           kconfigConfOptGExpOr,
512                                      \           kconfigConfOptGExpEq,
513                                      \           kconfigConfOptGExpNEq
514                                      \ skipwhite skipnl
515
516syn match   kconfigConfOptGExpCSym    "'[^'\\]*\%(\\.[^'\\]*\)*'"
517                                      \ contained
518                                      \ nextgroup=kconfigConfOptExprGrpE,
519                                      \           kconfigConfOptGExpAnd,
520                                      \           kconfigConfOptGExpOr,
521                                      \           kconfigConfOptGExpEq,
522                                      \           kconfigConfOptGExpNEq
523                                      \ skipwhite skipnl
524
525syn match   kconfigConfOptGExpNCSym   '\<\k\+\>'
526                                      \ contained
527                                      \ nextgroup=kconfigConfOptExprGrpE,
528                                      \           kconfigConfOptGExpAnd,
529                                      \           kconfigConfOptGExpOr,
530                                      \           kconfigConfOptGExpEq,
531                                      \           kconfigConfOptGExpNEq
532                                      \ skipwhite skipnl
533
534syn cluster kconfigConfOptGExpSym2    contains=kconfigConfOptGExpCSym2,
535                                      \        kconfigConfOptGExpNCSym2
536
537syn match   kconfigConfOptGExpEq      '='
538                                      \ contained
539                                      \ nextgroup=@kconfigConfOptGExpSym2
540                                      \ skipwhite
541
542syn match   kconfigConfOptGExpNEq     '!='
543                                      \ contained
544                                      \ nextgroup=@kconfigConfOptGExpSym2
545                                      \ skipwhite
546
547syn match   kconfigConfOptGExpCSym2   '"[^"\\]*\%(\\.[^"\\]*\)*"'
548                                      \ contained
549                                      \ nextgroup=kconfigConfOptExprGrpE,
550                                      \           kconfigConfOptGExpAnd,
551                                      \           kconfigConfOptGExpOr
552                                      \ skipwhite skipnl
553
554syn match   kconfigConfOptGExpCSym2   "'[^'\\]*\%(\\.[^'\\]*\)*'"
555                                      \ contained
556                                      \ nextgroup=kconfigConfOptExprGrpE,
557                                      \           kconfigConfOptGExpAnd,
558                                      \           kconfigConfOptGExpOr
559                                      \ skipwhite skipnl
560
561syn match   kconfigConfOptGExpNCSym2  '\<\k\+\>'
562                                      \ contained
563                                      \ nextgroup=kconfigConfOptExprGrpE,
564                                      \           kconfigConfOptGExpAnd,
565                                      \           kconfigConfOptGExpOr
566                                      \ skipwhite skipnl
567
568syn match   kconfigConfOptGExpNeg     '!'
569                                      \ contained
570                                      \ nextgroup=@kconfigConfigOptionGExp
571                                      \ skipwhite
572
573syn match   kconfigConfOptGExpAnd     '&&'
574                                      \ contained
575                                      \ nextgroup=@kconfigConfigOptionGExp
576                                      \ skipwhite
577
578syn match   kconfigConfOptGExpOr      '||'
579                                      \ contained
580                                      \ nextgroup=@kconfigConfigOptionGExp
581                                      \ skipwhite
582
583syn match   kconfigConfOptExprGrpE    ')'
584                                      \ contained
585                                      \ nextgroup=kconfigConfigOptionIf,
586                                      \           kconfigConfOptExprAnd,
587                                      \           kconfigConfOptExprOr
588                                      \ skipwhite skipnl
589
590syn sync minlines=50
591
592hi def link kconfigTodo                 Todo
593hi def link kconfigComment              Comment
594hi def link kconfigKeyword              Keyword
595hi def link kconfigPreProc              PreProc
596hi def link kconfigConditional          Conditional
597hi def link kconfigPrompt               String
598hi def link kconfigKeywordPrompt        kconfigPrompt
599hi def link kconfigPath                 String
600hi def link kconfigSymbol               String
601hi def link kconfigConstantSymbol       Constant
602hi def link kconfigConfigOption         Type
603hi def link kconfigTypeDefinition       kconfigConfigOption
604hi def link kconfigTypeDefPrompt        kconfigPrompt
605hi def link kconfigInputPrompt          kconfigConfigOption
606hi def link kconfigPromptPrompt         kconfigPrompt
607hi def link kconfigDefaultValue         kconfigConfigOption
608hi def link kconfigDependencies         kconfigConfigOption
609hi def link kconfigReverseDependencies  kconfigConfigOption
610hi def link kconfigRevDepCSymbol        kconfigConstantSymbol
611hi def link kconfigRevDepNCSymbol       kconfigSymbol
612hi def link kconfigNumericalRanges      kconfigConfigOption
613hi def link kconfigRangeCSymbol         kconfigConstantSymbol
614hi def link kconfigRangeNCSymbol        kconfigSymbol
615hi def link kconfigRangeCSymbol2        kconfigConstantSymbol
616hi def link kconfigRangeNCSymbol2       kconfigSymbol
617hi def link kconfigHelpText             Normal
618hi def link kconfigDefBool              kconfigConfigOption
619hi def link kconfigDefBoolCSymbol       kconfigConstantSymbol
620hi def link kconfigDefBoolNCSymbol      kconfigSymbol
621hi def link kconfigOptional             kconfigConfigOption
622hi def link kconfigConfigOptionIf       Conditional
623hi def link kconfigConfOptIfExprCSym    kconfigConstantSymbol
624hi def link kconfigConfOptIfExprNCSym   kconfigSymbol
625hi def link kconfigOperator             Operator
626hi def link kconfigConfOptIfExprEq      kconfigOperator
627hi def link kconfigConfOptIfExprNEq     kconfigOperator
628hi def link kconfigConfOptIfExprCSym2   kconfigConstantSymbol
629hi def link kconfigConfOptIfExprNCSym2  kconfigSymbol
630hi def link kconfigConfOptIfExprNeg     kconfigOperator
631hi def link kconfigConfOptIfExprAnd     kconfigOperator
632hi def link kconfigConfOptIfExprOr      kconfigOperator
633hi def link kconfigDelimiter            Delimiter
634hi def link kconfigConfOptIfExprGroup   kconfigDelimiter
635hi def link kconfigConfOptIfGExpCSym    kconfigConstantSymbol
636hi def link kconfigConfOptIfGExpNCSym   kconfigSymbol
637hi def link kconfigConfOptIfGExpEq      kconfigOperator
638hi def link kconfigConfOptIfGExpNEq     kconfigOperator
639hi def link kconfigConfOptIfGExpCSym2   kconfigConstantSymbol
640hi def link kconfigConfOptIfGExpNCSym2  kconfigSymbol
641hi def link kconfigConfOptIfGExpNeg     kconfigOperator
642hi def link kconfigConfOptIfGExpAnd     kconfigOperator
643hi def link kconfigConfOptIfGExpOr      kconfigOperator
644hi def link kconfigConfOptIfExprGrpE    kconfigDelimiter
645hi def link kconfigConfOptExprCSym      kconfigConstantSymbol
646hi def link kconfigConfOptExprNCSym     kconfigSymbol
647hi def link kconfigConfOptExprEq        kconfigOperator
648hi def link kconfigConfOptExprNEq       kconfigOperator
649hi def link kconfigConfOptExprCSym2     kconfigConstantSymbol
650hi def link kconfigConfOptExprNCSym2    kconfigSymbol
651hi def link kconfigConfOptExprNeg       kconfigOperator
652hi def link kconfigConfOptExprAnd       kconfigOperator
653hi def link kconfigConfOptExprOr        kconfigOperator
654hi def link kconfigConfOptExprGroup     kconfigDelimiter
655hi def link kconfigConfOptGExpCSym      kconfigConstantSymbol
656hi def link kconfigConfOptGExpNCSym     kconfigSymbol
657hi def link kconfigConfOptGExpEq        kconfigOperator
658hi def link kconfigConfOptGExpNEq       kconfigOperator
659hi def link kconfigConfOptGExpCSym2     kconfigConstantSymbol
660hi def link kconfigConfOptGExpNCSym2    kconfigSymbol
661hi def link kconfigConfOptGExpNeg       kconfigOperator
662hi def link kconfigConfOptGExpAnd       kconfigOperator
663hi def link kconfigConfOptGExpOr        kconfigOperator
664hi def link kconfigConfOptExprGrpE      kconfigConfOptIfExprGroup
665
666else
667
668syn keyword kconfigTodo               contained TODO FIXME XXX NOTE
669
670syn match   kconfigComment            display '#.*$' contains=kconfigTodo
671
672syn keyword kconfigKeyword            config menuconfig comment mainmenu
673
674syn keyword kconfigConditional        menu endmenu choice endchoice if endif
675
676syn keyword kconfigPreProc            source
677                                      \ nextgroup=kconfigPath
678                                      \ skipwhite
679
680syn keyword kconfigTriState           y m n
681
682syn match   kconfigSpecialChar        contained '\\.'
683syn match   kconfigSpecialChar        '\\$'
684
685syn region  kconfigPath               matchgroup=kconfigPath
686                                      \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
687                                      \ contains=kconfigSpecialChar
688
689syn region  kconfigPath               matchgroup=kconfigPath
690                                      \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
691                                      \ contains=kconfigSpecialChar
692
693syn match   kconfigPath               '\S\+'
694                                      \ contained
695
696syn region  kconfigString             matchgroup=kconfigString
697                                      \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
698                                      \ contains=kconfigSpecialChar
699
700syn region  kconfigString             matchgroup=kconfigString
701                                      \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
702                                      \ contains=kconfigSpecialChar
703
704syn keyword kconfigType               bool boolean tristate string hex int
705
706syn keyword kconfigOption             prompt default requires select range
707                                      \ optional
708syn match   kconfigOption             'depends\%( on\)\='
709
710syn keyword kconfigMacro              def_bool def_tristate
711
712syn region  kconfigHelpText
713      \ matchgroup=kconfigOption
714      \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
715      \ skip='^$'
716      \ end='^\z1\@!'
717
718syn sync    match kconfigSyncHelp     grouphere kconfigHelpText 'help\|---help---'
719
720hi def link kconfigTodo         Todo
721hi def link kconfigComment      Comment
722hi def link kconfigKeyword      Keyword
723hi def link kconfigConditional  Conditional
724hi def link kconfigPreProc      PreProc
725hi def link kconfigTriState     Boolean
726hi def link kconfigSpecialChar  SpecialChar
727hi def link kconfigPath         String
728hi def link kconfigString       String
729hi def link kconfigType         Type
730hi def link kconfigOption       Identifier
731hi def link kconfigHelpText     Normal
732hi def link kconfigmacro        Macro
733
734endif
735
736let b:current_syntax = "kconfig"
737
738let &cpo = s:cpo_save
739unlet s:cpo_save
740