Skip to content

Commit

Permalink
Kconfig: fill names of anonymous choices with the values of their pro…
Browse files Browse the repository at this point in the history
…mpts

Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Aug 23, 2024
1 parent fa0b133 commit b94bd42
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
A input.kconfig /^config A # ...$/;" c typeref:typename:bool
choice987df5010104 input.kconfig /^choice # ...$/;" C end:10
C input.kconfig /^config C # ...$/;" c choice:choice987df5010104 typeref:typename:bool
B input.kconfig /^ prompt "B"$/;" C end:10
C input.kconfig /^config C # ...$/;" c choice:B typeref:typename:bool
D input.kconfig /^menu "D" # ...$/;" m end:17
E input.kconfig /^config E # ...$/;" c menu:D typeref:typename:bool
F input.kconfig /^menuconfig F # ...$/;" c
26 changes: 13 additions & 13 deletions Units/parser-kconfig.r/simple-kconfig.d/expected.tags
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ CONFIG_JFFS2_RTIME_MODULE input-1.kconfig /^config JFFS2_RTIME$/;" c roles:def
JFFS2_RUBIN input-1.kconfig /^config JFFS2_RUBIN$/;" c typeref:typename:bool roles:def
CONFIG_JFFS2_RUBIN input-1.kconfig /^config JFFS2_RUBIN$/;" c roles:def
CONFIG_JFFS2_RUBIN_MODULE input-1.kconfig /^config JFFS2_RUBIN$/;" c roles:def
choicebf6231840104 input-1.kconfig /^choice$/;" C roles:def
JFFS2_CMODE_NONE input-1.kconfig /^config JFFS2_CMODE_NONE$/;" c choice:choicebf6231840104 typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_NONE input-1.kconfig /^config JFFS2_CMODE_NONE$/;" c choice:choicebf6231840104 roles:def
CONFIG_JFFS2_CMODE_NONE_MODULE input-1.kconfig /^config JFFS2_CMODE_NONE$/;" c choice:choicebf6231840104 roles:def
JFFS2_CMODE_PRIORITY input-1.kconfig /^config JFFS2_CMODE_PRIORITY$/;" c choice:choicebf6231840104 typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_PRIORITY input-1.kconfig /^config JFFS2_CMODE_PRIORITY$/;" c choice:choicebf6231840104 roles:def
CONFIG_JFFS2_CMODE_PRIORITY_MODULE input-1.kconfig /^config JFFS2_CMODE_PRIORITY$/;" c choice:choicebf6231840104 roles:def
JFFS2_CMODE_SIZE input-1.kconfig /^config JFFS2_CMODE_SIZE$/;" c choice:choicebf6231840104 typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_SIZE input-1.kconfig /^config JFFS2_CMODE_SIZE$/;" c choice:choicebf6231840104 roles:def
CONFIG_JFFS2_CMODE_SIZE_MODULE input-1.kconfig /^config JFFS2_CMODE_SIZE$/;" c choice:choicebf6231840104 roles:def
JFFS2_CMODE_FAVOURLZO input-1.kconfig /^config JFFS2_CMODE_FAVOURLZO$/;" c choice:choicebf6231840104 typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_FAVOURLZO input-1.kconfig /^config JFFS2_CMODE_FAVOURLZO$/;" c choice:choicebf6231840104 roles:def
CONFIG_JFFS2_CMODE_FAVOURLZO_MODULE input-1.kconfig /^config JFFS2_CMODE_FAVOURLZO$/;" c choice:choicebf6231840104 roles:def
JFFS2 default compression mode input-1.kconfig /^ prompt "JFFS2 default compression mode" if JFFS2_COMPRESSION_OPTIONS$/;" C roles:def
JFFS2_CMODE_NONE input-1.kconfig /^config JFFS2_CMODE_NONE$/;" c choice:JFFS2 default compression mode typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_NONE input-1.kconfig /^config JFFS2_CMODE_NONE$/;" c choice:JFFS2 default compression mode roles:def
CONFIG_JFFS2_CMODE_NONE_MODULE input-1.kconfig /^config JFFS2_CMODE_NONE$/;" c choice:JFFS2 default compression mode roles:def
JFFS2_CMODE_PRIORITY input-1.kconfig /^config JFFS2_CMODE_PRIORITY$/;" c choice:JFFS2 default compression mode typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_PRIORITY input-1.kconfig /^config JFFS2_CMODE_PRIORITY$/;" c choice:JFFS2 default compression mode roles:def
CONFIG_JFFS2_CMODE_PRIORITY_MODULE input-1.kconfig /^config JFFS2_CMODE_PRIORITY$/;" c choice:JFFS2 default compression mode roles:def
JFFS2_CMODE_SIZE input-1.kconfig /^config JFFS2_CMODE_SIZE$/;" c choice:JFFS2 default compression mode typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_SIZE input-1.kconfig /^config JFFS2_CMODE_SIZE$/;" c choice:JFFS2 default compression mode roles:def
CONFIG_JFFS2_CMODE_SIZE_MODULE input-1.kconfig /^config JFFS2_CMODE_SIZE$/;" c choice:JFFS2 default compression mode roles:def
JFFS2_CMODE_FAVOURLZO input-1.kconfig /^config JFFS2_CMODE_FAVOURLZO$/;" c choice:JFFS2 default compression mode typeref:typename:bool roles:def
CONFIG_JFFS2_CMODE_FAVOURLZO input-1.kconfig /^config JFFS2_CMODE_FAVOURLZO$/;" c choice:JFFS2 default compression mode roles:def
CONFIG_JFFS2_CMODE_FAVOURLZO_MODULE input-1.kconfig /^config JFFS2_CMODE_FAVOURLZO$/;" c choice:JFFS2 default compression mode roles:def
HAVE_ARCH_KGDB input-2.kconfig /^config HAVE_ARCH_KGDB$/;" c typeref:typename:bool roles:def
CONFIG_HAVE_ARCH_KGDB input-2.kconfig /^config HAVE_ARCH_KGDB$/;" c roles:def
CONFIG_HAVE_ARCH_KGDB_MODULE input-2.kconfig /^config HAVE_ARCH_KGDB$/;" c roles:def
Expand Down
27 changes: 27 additions & 0 deletions optlib/kconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,33 @@ extern parserDefinition* KconfigParser (void)
"C", "{scope=push}{exclusive}", NULL, false},
{"^[ \t]*choice[ \t]*(#.*)?$", "",
"C", "{_anonymous=choice}{scope=push}{exclusive}", NULL, false},
{"^[ \t]*prompt[ \t]+\"([^\"]+)\"[ \t]*(#.*|if)?", "",
"", "{exclusive}"
"{{\n"
" _scopetop {\n"
" dup :kind /choice eq {\n"
" dup :extras {\n"
" /anonymous _amember {\n"
" % This is an anonymous tag that kind is choice.\n"
" % Throw it away.\n"
" _markplaceholder\n"
" _scopepop\n"
" % Make a new one with the prompt.\n"
" \\1 /choice @1 _tag _commit _scopepush\n"
" } {\n"
" % This is not an anonymous tag.\n"
" pop\n"
" } ifelse\n"
" } {\n"
" % This is not an extra tag.\n"
" pop\n"
" } ifelse\n"
" } {\n"
" % This is not a choice.\n"
" pop\n"
" } ifelse\n"
" } if\n"
"}}", NULL, false},
{"^[ \t]*endchoice[ \t]*(#.*)?$", "",
"", "{scope=pop}{placeholder}{exclusive}", NULL, false},
{"^[ \t]*mainmenu[ \t]+\"([^\"]+)\"[ \t]*(#.*)?$", "\\1",
Expand Down
25 changes: 25 additions & 0 deletions optlib/kconfig.ctags
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@

--regex-Kconfig=/^[ \t]*choice[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$/\1/C/{scope=push}{exclusive}
--regex-Kconfig=/^[ \t]*choice[ \t]*(#.*)?$//C/{_anonymous=choice}{scope=push}{exclusive}
--regex-Kconfig=/^[ \t]*prompt[ \t]+"([^"]+)"[ \t]*(#.*|if)?//{exclusive}{{
_scopetop {
dup :kind /choice eq {
dup :extras {
/anonymous _amember {
% This is an anonymous tag that kind is choice.
% Throw it away.
_markplaceholder
_scopepop
% Make a new one with the prompt.
\1 /choice @1 _tag _commit _scopepush
} {
% This is not an anonymous tag.
pop
} ifelse
} {
% This is not an extra tag.
pop
} ifelse
} {
% This is not a choice.
pop
} ifelse
} if
}}
--regex-Kconfig=/^[ \t]*endchoice[ \t]*(#.*)?$//{scope=pop}{placeholder}{exclusive}

--regex-Kconfig=/^[ \t]*mainmenu[ \t]+"([^"]+)"[ \t]*(#.*)?$/\1/M/{exclusive}
Expand Down

0 comments on commit b94bd42

Please sign in to comment.