Skip to content

Commit

Permalink
Kconfig: ignore comments that start in the middle of a line
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Aug 23, 2024
1 parent 0d56602 commit fa0b133
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--sort=no
--map-Kconfig=.kconfig
--extras-Kconfig=-{configPrefixed}
--fields=+e
--extras=+r
Original file line number Diff line number Diff line change
@@ -0,0 +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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
config A # ...
bool

choice # ...
prompt "B"

config C # ...
bool

endchoice # ...

menu "D" # ...

config E # ...
bool

endmenu # ...

menuconfig F # ...
20 changes: 10 additions & 10 deletions optlib/kconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ extern parserDefinition* KconfigParser (void)
static tagRegexTable KconfigTagRegexTable [] = {
{"^[ \t]*#.*$", "",
"", "{placeholder}", NULL, false},
{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$", "\\2",
{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$", "\\2",
"c", "{scope=ref}"
"{{\n"
" .\n"
Expand All @@ -84,23 +84,23 @@ extern parserDefinition* KconfigParser (void)
" clear\n"
" } if\n"
"}}", NULL, false},
{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$", "CONFIG_\\2",
{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$", "CONFIG_\\2",
"c", "{scope=ref}{_extra=configPrefixed}", NULL, false},
{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$", "CONFIG_\\2_MODULE",
{"^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$", "CONFIG_\\2_MODULE",
"c", "{scope=ref}{_extra=configPrefixed}{exclusive}", NULL, false},
{"^[ \t]*menu[ \t]+\"([^\"]+)\"[ \t]*$", "\\1",
{"^[ \t]*menu[ \t]+\"([^\"]+)\"[ \t]*(#.*)?$", "\\1",
"m", "{scope=push}{exclusive}", NULL, false},
{"^[ \t]*endmenu[ \t]*$", "",
{"^[ \t]*endmenu[ \t]*(#.*)?$", "",
"", "{scope=pop}{placeholder}{exclusive}", NULL, false},
{"^[ \t]*source[ \t]+\"?([^\"]+)\"?[ \t]*$", "\\1",
{"^[ \t]*source[ \t]+\"?([^\"]+)\"?[ \t]*(#.*)?$", "\\1",
"k", "{_role=source}{exclusive}{scope=ref}", NULL, false},
{"^[ \t]*choice[ \t]+([A-Za-z0-9_]+)[ \t]*$", "\\1",
{"^[ \t]*choice[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$", "\\1",
"C", "{scope=push}{exclusive}", NULL, false},
{"^[ \t]*choice[ \t]*$", "",
{"^[ \t]*choice[ \t]*(#.*)?$", "",
"C", "{_anonymous=choice}{scope=push}{exclusive}", NULL, false},
{"^[ \t]*endchoice[ \t]*$", "",
{"^[ \t]*endchoice[ \t]*(#.*)?$", "",
"", "{scope=pop}{placeholder}{exclusive}", NULL, false},
{"^[ \t]*mainmenu[ \t]+\"([^\"]+)\"[ \t]*$", "\\1",
{"^[ \t]*mainmenu[ \t]+\"([^\"]+)\"[ \t]*(#.*)?$", "\\1",
"M", "{exclusive}", NULL, false},
{"^([-a-zA-Z0-9_$]+)[ \t]*:?=", "\\1",
"v", "{exclusive}", NULL, false},
Expand Down
20 changes: 10 additions & 10 deletions optlib/kconfig.ctags
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# skip the comment lines.
--regex-Kconfig=/^[ \t]*#.*$//{placeholder}

--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$/\2/c/{scope=ref}{{
--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$/\2/c/{scope=ref}{{
.
}}
--regex-Kconfig=/^[ \t]*(def_)?(bool|boolean|hex|int|string|tristate)\>///{exclusive}{{
Expand All @@ -62,19 +62,19 @@
clear
} if
}}
--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$/CONFIG_\2/c/{scope=ref}{_extra=configPrefixed}
--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*$/CONFIG_\2_MODULE/c/{scope=ref}{_extra=configPrefixed}{exclusive}
--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$/CONFIG_\2/c/{scope=ref}{_extra=configPrefixed}
--regex-Kconfig=/^[ \t]*(menu)?config[ \t]+([A-Za-z0-9_]+)[ \t]*(#.*)?$/CONFIG_\2_MODULE/c/{scope=ref}{_extra=configPrefixed}{exclusive}

--regex-Kconfig=/^[ \t]*menu[ \t]+"([^"]+)"[ \t]*$/\1/m/{scope=push}{exclusive}
--regex-Kconfig=/^[ \t]*endmenu[ \t]*$//{scope=pop}{placeholder}{exclusive}
--regex-Kconfig=/^[ \t]*menu[ \t]+"([^"]+)"[ \t]*(#.*)?$/\1/m/{scope=push}{exclusive}
--regex-Kconfig=/^[ \t]*endmenu[ \t]*(#.*)?$//{scope=pop}{placeholder}{exclusive}

# Qemu's Kconfig does't use double quotes
--regex-Kconfig=/^[ \t]*source[ \t]+"?([^"]+)"?[ \t]*$/\1/k/{_role=source}{exclusive}{scope=ref}
--regex-Kconfig=/^[ \t]*source[ \t]+"?([^"]+)"?[ \t]*(#.*)?$/\1/k/{_role=source}{exclusive}{scope=ref}

--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]*endchoice[ \t]*$//{scope=pop}{placeholder}{exclusive}
--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]*endchoice[ \t]*(#.*)?$//{scope=pop}{placeholder}{exclusive}

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

--regex-Kconfig=/^([-a-zA-Z0-9_$]+)[ \t]*:?=/\1/v/{exclusive}

0 comments on commit fa0b133

Please sign in to comment.