summaryrefslogtreecommitdiff
path: root/runtime/syntax/kconfig.vim
blob: a6ceb1712adffab6fffc5519ac173630cbd95fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
" Vim syntax file
" Maintainer:       Nikolai Weibull <now@bitwi.se>
" Latest Revision:  2009-05-25

if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

if exists("g:kconfig_syntax_heavy")

syn match   kconfigBegin              '^' nextgroup=kconfigKeyword
                                      \ skipwhite

syn keyword kconfigTodo               contained TODO FIXME XXX NOTE

syn match   kconfigComment            display '#.*$' contains=kconfigTodo

syn keyword kconfigKeyword            config nextgroup=kconfigSymbol
                                      \ skipwhite

syn keyword kconfigKeyword            menuconfig nextgroup=kconfigSymbol
                                      \ skipwhite

syn keyword kconfigKeyword            comment menu mainmenu
                                      \ nextgroup=kconfigKeywordPrompt
                                      \ skipwhite

syn keyword kconfigKeyword            choice
                                      \ nextgroup=@kconfigConfigOptions
                                      \ skipwhite skipnl

syn keyword kconfigKeyword            endmenu endchoice

syn keyword kconfigPreProc            source
                                      \ nextgroup=kconfigPath
                                      \ skipwhite

" TODO: This is a hack.  The who .*Expr stuff should really be generated so
" that we can reuse it for various nextgroups.
syn keyword kconfigConditional        if endif
                                      \ nextgroup=@kconfigConfigOptionIfExpr
                                      \ skipwhite

syn match   kconfigKeywordPrompt      '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigPath               '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
                                      \ contained

syn match   kconfigSymbol             '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions
                                      \ skipwhite skipnl

" FIXME: There is – probably – no reason to cluster these instead of just
" defining them in the same group.
syn cluster kconfigConfigOptions      contains=kconfigTypeDefinition,
                                      \        kconfigInputPrompt,
                                      \        kconfigDefaultValue,
                                      \        kconfigDependencies,
                                      \        kconfigReverseDependencies,
                                      \        kconfigNumericalRanges,
                                      \        kconfigHelpText,
                                      \        kconfigDefBool,
                                      \        kconfigOptional

syn keyword kconfigTypeDefinition     bool boolean tristate string hex int
                                      \ contained
                                      \ nextgroup=kconfigTypeDefPrompt,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigTypeDefPrompt      '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigTypeDefPrompt      "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn keyword kconfigInputPrompt        prompt
                                      \ contained
                                      \ nextgroup=kconfigPromptPrompt
                                      \ skipwhite

syn match   kconfigPromptPrompt       '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigPromptPrompt       "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn keyword   kconfigDefaultValue     default
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionExpr
                                      \ skipwhite

syn match   kconfigDependencies       'depends on\|requires'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfExpr
                                      \ skipwhite

syn keyword kconfigReverseDependencies select
                                      \ contained
                                      \ nextgroup=@kconfigRevDepSymbol
                                      \ skipwhite

syn cluster kconfigRevDepSymbol       contains=kconfigRevDepCSymbol,
                                      \        kconfigRevDepNCSymbol

syn match   kconfigRevDepCSymbol      '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigRevDepCSymbol      "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigRevDepNCSymbol     '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn keyword kconfigNumericalRanges    range
                                      \ contained
                                      \ nextgroup=@kconfigRangeSymbol
                                      \ skipwhite

syn cluster kconfigRangeSymbol        contains=kconfigRangeCSymbol,
                                      \        kconfigRangeNCSymbol

syn match   kconfigRangeCSymbol       '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=@kconfigRangeSymbol2
                                      \ skipwhite skipnl

syn match   kconfigRangeCSymbol       "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=@kconfigRangeSymbol2
                                      \ skipwhite skipnl

syn match   kconfigRangeNCSymbol      '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=@kconfigRangeSymbol2
                                      \ skipwhite skipnl

syn cluster kconfigRangeSymbol2       contains=kconfigRangeCSymbol2,
                                      \        kconfigRangeNCSymbol2

syn match   kconfigRangeCSymbol2      "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigRangeNCSymbol2     '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn region  kconfigHelpText           contained
      \ matchgroup=kconfigConfigOption
      \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
      \ skip='^$'
      \ end='^\z1\@!'
      \ nextgroup=@kconfigConfigOptions
      \ skipwhite skipnl

" XXX: Undocumented
syn keyword kconfigDefBool            def_bool
                                      \ contained
                                      \ nextgroup=@kconfigDefBoolSymbol
                                      \ skipwhite

syn cluster kconfigDefBoolSymbol      contains=kconfigDefBoolCSymbol,
                                      \        kconfigDefBoolNCSymbol

syn match   kconfigDefBoolCSymbol     '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigDefBoolCSymbol     "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigDefBoolNCSymbol    '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

" XXX: This is actually only a valid option for “choice”, but treating it
" specially would require a lot of extra groups.
syn keyword kconfigOptional           optional
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions
                                      \ skipwhite skipnl

syn keyword kconfigConfigOptionIf     if
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfExpr
                                      \ skipwhite

syn cluster kconfigConfigOptionIfExpr contains=@kconfigConfOptIfExprSym,
                                      \        kconfigConfOptIfExprNeg,
                                      \        kconfigConfOptIfExprGroup

syn cluster kconfigConfOptIfExprSym   contains=kconfigConfOptIfExprCSym,
                                      \        kconfigConfOptIfExprNCSym

syn match   kconfigConfOptIfExprCSym  '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions,
                                      \           kconfigConfOptIfExprAnd,
                                      \           kconfigConfOptIfExprOr,
                                      \           kconfigConfOptIfExprEq,
                                      \           kconfigConfOptIfExprNEq
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfExprCSym  "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions,
                                      \           kconfigConfOptIfExprAnd,
                                      \           kconfigConfOptIfExprOr,
                                      \           kconfigConfOptIfExprEq,
                                      \           kconfigConfOptIfExprNEq
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfExprNCSym '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions,
                                      \           kconfigConfOptIfExprAnd,
                                      \           kconfigConfOptIfExprOr,
                                      \           kconfigConfOptIfExprEq,
                                      \           kconfigConfOptIfExprNEq
                                      \ skipwhite skipnl

syn cluster kconfigConfOptIfExprSym2  contains=kconfigConfOptIfExprCSym2,
                                      \        kconfigConfOptIfExprNCSym2

syn match   kconfigConfOptIfExprEq    '='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptIfExprSym2
                                      \ skipwhite

syn match   kconfigConfOptIfExprNEq   '!='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptIfExprSym2
                                      \ skipwhite

syn match   kconfigConfOptIfExprCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions,
                                      \           kconfigConfOptIfExprAnd,
                                      \           kconfigConfOptIfExprOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfExprNCSym2 '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions,
                                      \           kconfigConfOptIfExprAnd,
                                      \           kconfigConfOptIfExprOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfExprNeg   '!'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfExpr
                                      \ skipwhite

syn match   kconfigConfOptIfExprAnd   '&&'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfExpr
                                      \ skipwhite

syn match   kconfigConfOptIfExprOr    '||'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfExpr
                                      \ skipwhite

syn match   kconfigConfOptIfExprGroup '('
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfGExp
                                      \ skipwhite

" TODO: hm, this kind of recursion doesn't work right.  We need another set of
" expressions that have kconfigConfigOPtionIfGExp as nextgroup and a matcher
" for '(' that sets it all off.
syn cluster kconfigConfigOptionIfGExp contains=@kconfigConfOptIfGExpSym,
                                      \        kconfigConfOptIfGExpNeg,
                                      \        kconfigConfOptIfExprGroup

syn cluster kconfigConfOptIfGExpSym   contains=kconfigConfOptIfGExpCSym,
                                      \        kconfigConfOptIfGExpNCSym

syn match   kconfigConfOptIfGExpCSym  '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=@kconfigConfigIf,
                                      \           kconfigConfOptIfGExpAnd,
                                      \           kconfigConfOptIfGExpOr,
                                      \           kconfigConfOptIfGExpEq,
                                      \           kconfigConfOptIfGExpNEq
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfGExpCSym  "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=@kconfigConfigIf,
                                      \           kconfigConfOptIfGExpAnd,
                                      \           kconfigConfOptIfGExpOr,
                                      \           kconfigConfOptIfGExpEq,
                                      \           kconfigConfOptIfGExpNEq
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfGExpNCSym '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfOptIfExprGrpE,
                                      \           kconfigConfOptIfGExpAnd,
                                      \           kconfigConfOptIfGExpOr,
                                      \           kconfigConfOptIfGExpEq,
                                      \           kconfigConfOptIfGExpNEq
                                      \ skipwhite skipnl

syn cluster kconfigConfOptIfGExpSym2  contains=kconfigConfOptIfGExpCSym2,
                                      \        kconfigConfOptIfGExpNCSym2

syn match   kconfigConfOptIfGExpEq    '='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptIfGExpSym2
                                      \ skipwhite

syn match   kconfigConfOptIfGExpNEq   '!='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptIfGExpSym2
                                      \ skipwhite

syn match   kconfigConfOptIfGExpCSym2 '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfOptIfExprGrpE,
                                      \           kconfigConfOptIfGExpAnd,
                                      \           kconfigConfOptIfGExpOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfGExpCSym2 "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfOptIfExprGrpE,
                                      \           kconfigConfOptIfGExpAnd,
                                      \           kconfigConfOptIfGExpOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfGExpNCSym2 '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfOptIfExprGrpE,
                                      \           kconfigConfOptIfGExpAnd,
                                      \           kconfigConfOptIfGExpOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptIfGExpNeg   '!'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfGExp
                                      \ skipwhite

syn match   kconfigConfOptIfGExpAnd   '&&'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfGExp
                                      \ skipwhite

syn match   kconfigConfOptIfGExpOr    '||'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionIfGExp
                                      \ skipwhite

syn match   kconfigConfOptIfExprGrpE  ')'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptions,
                                      \           kconfigConfOptIfExprAnd,
                                      \           kconfigConfOptIfExprOr
                                      \ skipwhite skipnl


syn cluster kconfigConfigOptionExpr   contains=@kconfigConfOptExprSym,
                                      \        kconfigConfOptExprNeg,
                                      \        kconfigConfOptExprGroup

syn cluster kconfigConfOptExprSym     contains=kconfigConfOptExprCSym,
                                      \        kconfigConfOptExprNCSym

syn match   kconfigConfOptExprCSym    '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           kconfigConfOptExprAnd,
                                      \           kconfigConfOptExprOr,
                                      \           kconfigConfOptExprEq,
                                      \           kconfigConfOptExprNEq,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigConfOptExprCSym    "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           kconfigConfOptExprAnd,
                                      \           kconfigConfOptExprOr,
                                      \           kconfigConfOptExprEq,
                                      \           kconfigConfOptExprNEq,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigConfOptExprNCSym   '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           kconfigConfOptExprAnd,
                                      \           kconfigConfOptExprOr,
                                      \           kconfigConfOptExprEq,
                                      \           kconfigConfOptExprNEq,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn cluster kconfigConfOptExprSym2    contains=kconfigConfOptExprCSym2,
                                      \        kconfigConfOptExprNCSym2

syn match   kconfigConfOptExprEq      '='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptExprSym2
                                      \ skipwhite

syn match   kconfigConfOptExprNEq     '!='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptExprSym2
                                      \ skipwhite

syn match   kconfigConfOptExprCSym2   '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           kconfigConfOptExprAnd,
                                      \           kconfigConfOptExprOr,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigConfOptExprCSym2   "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           kconfigConfOptExprAnd,
                                      \           kconfigConfOptExprOr,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigConfOptExprNCSym2  '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           kconfigConfOptExprAnd,
                                      \           kconfigConfOptExprOr,
                                      \           @kconfigConfigOptions
                                      \ skipwhite skipnl

syn match   kconfigConfOptExprNeg     '!'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionExpr
                                      \ skipwhite

syn match   kconfigConfOptExprAnd     '&&'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionExpr
                                      \ skipwhite

syn match   kconfigConfOptExprOr      '||'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionExpr
                                      \ skipwhite

syn match   kconfigConfOptExprGroup   '('
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionGExp
                                      \ skipwhite

syn cluster kconfigConfigOptionGExp   contains=@kconfigConfOptGExpSym,
                                      \        kconfigConfOptGExpNeg,
                                      \        kconfigConfOptGExpGroup

syn cluster kconfigConfOptGExpSym     contains=kconfigConfOptGExpCSym,
                                      \        kconfigConfOptGExpNCSym

syn match   kconfigConfOptGExpCSym    '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfOptExprGrpE,
                                      \           kconfigConfOptGExpAnd,
                                      \           kconfigConfOptGExpOr,
                                      \           kconfigConfOptGExpEq,
                                      \           kconfigConfOptGExpNEq
                                      \ skipwhite skipnl

syn match   kconfigConfOptGExpCSym    "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfOptExprGrpE,
                                      \           kconfigConfOptGExpAnd,
                                      \           kconfigConfOptGExpOr,
                                      \           kconfigConfOptGExpEq,
                                      \           kconfigConfOptGExpNEq
                                      \ skipwhite skipnl

syn match   kconfigConfOptGExpNCSym   '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfOptExprGrpE,
                                      \           kconfigConfOptGExpAnd,
                                      \           kconfigConfOptGExpOr,
                                      \           kconfigConfOptGExpEq,
                                      \           kconfigConfOptGExpNEq
                                      \ skipwhite skipnl

syn cluster kconfigConfOptGExpSym2    contains=kconfigConfOptGExpCSym2,
                                      \        kconfigConfOptGExpNCSym2

syn match   kconfigConfOptGExpEq      '='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptGExpSym2
                                      \ skipwhite

syn match   kconfigConfOptGExpNEq     '!='
                                      \ contained
                                      \ nextgroup=@kconfigConfOptGExpSym2
                                      \ skipwhite

syn match   kconfigConfOptGExpCSym2   '"[^"\\]*\%(\\.[^"\\]*\)*"'
                                      \ contained
                                      \ nextgroup=kconfigConfOptExprGrpE,
                                      \           kconfigConfOptGExpAnd,
                                      \           kconfigConfOptGExpOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptGExpCSym2   "'[^'\\]*\%(\\.[^'\\]*\)*'"
                                      \ contained
                                      \ nextgroup=kconfigConfOptExprGrpE,
                                      \           kconfigConfOptGExpAnd,
                                      \           kconfigConfOptGExpOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptGExpNCSym2  '\<\k\+\>'
                                      \ contained
                                      \ nextgroup=kconfigConfOptExprGrpE,
                                      \           kconfigConfOptGExpAnd,
                                      \           kconfigConfOptGExpOr
                                      \ skipwhite skipnl

syn match   kconfigConfOptGExpNeg     '!'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionGExp
                                      \ skipwhite

syn match   kconfigConfOptGExpAnd     '&&'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionGExp
                                      \ skipwhite

syn match   kconfigConfOptGExpOr      '||'
                                      \ contained
                                      \ nextgroup=@kconfigConfigOptionGExp
                                      \ skipwhite

syn match   kconfigConfOptExprGrpE    ')'
                                      \ contained
                                      \ nextgroup=kconfigConfigOptionIf,
                                      \           kconfigConfOptExprAnd,
                                      \           kconfigConfOptExprOr
                                      \ skipwhite skipnl

syn sync minlines=50

hi def link kconfigTodo                 Todo
hi def link kconfigComment              Comment
hi def link kconfigKeyword              Keyword
hi def link kconfigPreProc              PreProc
hi def link kconfigConditional          Conditional
hi def link kconfigPrompt               String
hi def link kconfigKeywordPrompt        kconfigPrompt
hi def link kconfigPath                 String
hi def link kconfigSymbol               String
hi def link kconfigConstantSymbol       Constant
hi def link kconfigConfigOption         Type
hi def link kconfigTypeDefinition       kconfigConfigOption
hi def link kconfigTypeDefPrompt        kconfigPrompt
hi def link kconfigInputPrompt          kconfigConfigOption
hi def link kconfigPromptPrompt         kconfigPrompt
hi def link kconfigDefaultValue         kconfigConfigOption
hi def link kconfigDependencies         kconfigConfigOption
hi def link kconfigReverseDependencies  kconfigConfigOption
hi def link kconfigRevDepCSymbol        kconfigConstantSymbol
hi def link kconfigRevDepNCSymbol       kconfigSymbol
hi def link kconfigNumericalRanges      kconfigConfigOption
hi def link kconfigRangeCSymbol         kconfigConstantSymbol
hi def link kconfigRangeNCSymbol        kconfigSymbol
hi def link kconfigRangeCSymbol2        kconfigConstantSymbol
hi def link kconfigRangeNCSymbol2       kconfigSymbol
hi def link kconfigHelpText             Normal
hi def link kconfigDefBool              kconfigConfigOption
hi def link kconfigDefBoolCSymbol       kconfigConstantSymbol
hi def link kconfigDefBoolNCSymbol      kconfigSymbol
hi def link kconfigOptional             kconfigConfigOption
hi def link kconfigConfigOptionIf       Conditional
hi def link kconfigConfOptIfExprCSym    kconfigConstantSymbol
hi def link kconfigConfOptIfExprNCSym   kconfigSymbol
hi def link kconfigOperator             Operator
hi def link kconfigConfOptIfExprEq      kconfigOperator
hi def link kconfigConfOptIfExprNEq     kconfigOperator
hi def link kconfigConfOptIfExprCSym2   kconfigConstantSymbol
hi def link kconfigConfOptIfExprNCSym2  kconfigSymbol
hi def link kconfigConfOptIfExprNeg     kconfigOperator
hi def link kconfigConfOptIfExprAnd     kconfigOperator
hi def link kconfigConfOptIfExprOr      kconfigOperator
hi def link kconfigDelimiter            Delimiter
hi def link kconfigConfOptIfExprGroup   kconfigDelimiter
hi def link kconfigConfOptIfGExpCSym    kconfigConstantSymbol
hi def link kconfigConfOptIfGExpNCSym   kconfigSymbol
hi def link kconfigConfOptIfGExpEq      kconfigOperator
hi def link kconfigConfOptIfGExpNEq     kconfigOperator
hi def link kconfigConfOptIfGExpCSym2   kconfigConstantSymbol
hi def link kconfigConfOptIfGExpNCSym2  kconfigSymbol
hi def link kconfigConfOptIfGExpNeg     kconfigOperator
hi def link kconfigConfOptIfGExpAnd     kconfigOperator
hi def link kconfigConfOptIfGExpOr      kconfigOperator
hi def link kconfigConfOptIfExprGrpE    kconfigDelimiter
hi def link kconfigConfOptExprCSym      kconfigConstantSymbol
hi def link kconfigConfOptExprNCSym     kconfigSymbol
hi def link kconfigConfOptExprEq        kconfigOperator
hi def link kconfigConfOptExprNEq       kconfigOperator
hi def link kconfigConfOptExprCSym2     kconfigConstantSymbol
hi def link kconfigConfOptExprNCSym2    kconfigSymbol
hi def link kconfigConfOptExprNeg       kconfigOperator
hi def link kconfigConfOptExprAnd       kconfigOperator
hi def link kconfigConfOptExprOr        kconfigOperator
hi def link kconfigConfOptExprGroup     kconfigDelimiter
hi def link kconfigConfOptGExpCSym      kconfigConstantSymbol
hi def link kconfigConfOptGExpNCSym     kconfigSymbol
hi def link kconfigConfOptGExpEq        kconfigOperator
hi def link kconfigConfOptGExpNEq       kconfigOperator
hi def link kconfigConfOptGExpCSym2     kconfigConstantSymbol
hi def link kconfigConfOptGExpNCSym2    kconfigSymbol
hi def link kconfigConfOptGExpNeg       kconfigOperator
hi def link kconfigConfOptGExpAnd       kconfigOperator
hi def link kconfigConfOptGExpOr        kconfigOperator
hi def link kconfigConfOptExprGrpE      kconfigConfOptIfExprGroup

else

syn keyword kconfigTodo               contained TODO FIXME XXX NOTE

syn match   kconfigComment            display '#.*$' contains=kconfigTodo

syn keyword kconfigKeyword            config menuconfig comment mainmenu

syn keyword kconfigConditional        menu endmenu choice endchoice if endif

syn keyword kconfigPreProc            source
                                      \ nextgroup=kconfigPath
                                      \ skipwhite

syn keyword kconfigTriState           y m n

syn match   kconfigSpecialChar        contained '\\.'
syn match   kconfigSpecialChar        '\\$'

syn region  kconfigPath               matchgroup=kconfigPath
                                      \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
                                      \ contains=kconfigSpecialChar

syn region  kconfigPath               matchgroup=kconfigPath
                                      \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
                                      \ contains=kconfigSpecialChar

syn match   kconfigPath               '\S\+'
                                      \ contained

syn region  kconfigString             matchgroup=kconfigString
                                      \ start=+"+ skip=+\\\\\|\\\"+ end=+"+
                                      \ contains=kconfigSpecialChar

syn region  kconfigString             matchgroup=kconfigString
                                      \ start=+'+ skip=+\\\\\|\\\'+ end=+'+
                                      \ contains=kconfigSpecialChar

syn keyword kconfigType               bool boolean tristate string hex int

syn keyword kconfigOption             prompt default requires select range
                                      \ optional
syn match   kconfigOption             'depends\%( on\)\='

syn keyword kconfigMacro              def_bool def_tristate

syn region  kconfigHelpText
      \ matchgroup=kconfigOption
      \ start='\%(help\|---help---\)\ze\s*\n\z(\s\+\)'
      \ skip='^$'
      \ end='^\z1\@!'

syn sync    match kconfigSyncHelp     grouphere kconfigHelpText 'help\|---help---'

hi def link kconfigTodo         Todo
hi def link kconfigComment      Comment
hi def link kconfigKeyword      Keyword
hi def link kconfigConditional  Conditional
hi def link kconfigPreProc      PreProc
hi def link kconfigTriState     Boolean
hi def link kconfigSpecialChar  SpecialChar
hi def link kconfigPath         String
hi def link kconfigString       String
hi def link kconfigType         Type
hi def link kconfigOption       Identifier
hi def link kconfigHelpText     Normal
hi def link kconfigmacro        Macro

endif

let b:current_syntax = "kconfig"

let &cpo = s:cpo_save
unlet s:cpo_save