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