xref: /Universal-ctags/optlib/kconfig.ctags (revision a1685dbeb8ad98ceaa9d141011ab708b7f709580)
1#
2#  Copyright (c) 2020, Maxime Chretien <maxime.chretien@bootlin.com>
3#
4#  This source code is released for free distribution under the terms of the
5#  GNU General Public License version 2 or (at your option) any later version.
6#
7#  This module contains functions for generating tags for the Kconfig language
8#
9#  Reference
10#     https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html
11#
12#
13#  This parser was originally written in C as proplosed in #2553 by Maxime.
14#  Masatake converted it to an optlib file.
15#
16--langdef=Kconfig
17--map-Kconfig=+(Kconfig*)
18
19--kinddef-Kconfig=c,config,configs
20--kinddef-Kconfig=m,menu,menus
21--kinddef-Kconfig=M,mainMenu,the main menu
22--kinddef-Kconfig=k,kconfig,kconfig file
23--kinddef-Kconfig=C,choice,choices
24
25--_roledef-Kconfig.{kconfig}=source,kconfig file loaded with source directive
26
27# Menus can be nested. Combine the parent menu and its child with "".
28--_scopesep-Kconfig=*/*:""
29
30#
31# The next extra is useful for jumpping from
32#
33#    #ifdef CONFIG_FOO
34#    ...
35#
36# in C code.
37#
38# Masatake proposed this extra to linux-kbuild ML and it was
39# merged as
40# ----------------------------------------------------------------------
41# commit e838db685fcfd2e9a0548ffc5cb9447e6c3c11be
42# Author: Masatake YAMATO <jet@gyve.org>
43# Date:   Thu Jun 22 12:21:20 2006 +0900
44#
45#    kbuild: adding symbols in Kconfig and defconfig to TAGS
46#
47--_extradef-Kconfig=configPrefixed,prepend CONFIG_ to config names
48--extras-Kconfig=+{configPrefixed}
49
50# skip the comment lines.
51--regex-Kconfig=/^[ \t]*#.*$//{placeholder}
52
53--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$/\2/c/{scope=ref}
54--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$/CONFIG_\2/c/{scope=ref}{_extra=configPrefixed}
55--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$/CONFIG_\2_MODULE/c/{scope=ref}{_extra=configPrefixed}{exclusive}
56
57--regex-Kconfig=/^[ \t]*menu[ \t]+"([^"]+)"[ \t]*/\1/m/{scope=push}{exclusive}
58--regex-Kconfig=/^[ \t]*endmenu[ \t]*//{scope=pop}{placeholder}{exclusive}
59
60# Qemu's Kconfig does't use double quotes
61--regex-Kconfig=/^[ \t]*source[ \t]+"?([^"]+)"?[ \t]*/\1/k/{_role=source}{exclusive}{scope=ref}
62
63--regex-Kconfig=/^[ \t]*choice[ \t]+([A-Za-z0-9_]+)[ \t]*/\1/C/{scope=push}{exclusive}
64--regex-Kconfig=/^[ \t]*choice[ \t]*$//C/{_anonymous=choice}{scope=push}{exclusive}
65--regex-Kconfig=/^[ \t]*endchoice[ \t]*//{scope=pop}{placeholder}{exclusive}
66
67--regex-Kconfig=/^[ \t]*mainmenu[ \t]+"([^"]+)"[ \t]*/\1/M/{exclusive}
68