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