summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-05-27 23:58:47 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-05-27 23:58:47 +0200
commitfc73c461f1a8acf3e09670e8f9429c7ef9d0b71f (patch)
treefed01e7cc8e5caca2c790d0b14d3665887e91961 /kconfiglib.py
parent94020beb311eb8a9db9e3b841e36c96b1b0f72dd (diff)
Provide lists with all menus and comments
Handy e.g. when implementing advanced search features.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index d8dc271..d69da5b 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -420,6 +420,14 @@ class Kconfig(object):
A list with all choices, in the same order as they appear in the Kconfig
files
+ menus:
+ A list with all menus, in the same order as they appear in the Kconfig
+ files
+
+ comments:
+ A list with all comments, in the same order as they appear in the Kconfig
+ files
+
n/m/y:
The predefined constant symbols n/m/y. Also available in const_syms.
@@ -514,11 +522,13 @@ class Kconfig(object):
"_warn_to_stderr",
"_warnings_enabled",
"choices",
+ "comments",
"config_prefix",
"const_syms",
"defconfig_list",
"defined_syms",
"m",
+ "menus",
"modules",
"n",
"named_choices",
@@ -635,6 +645,9 @@ class Kconfig(object):
self.named_choices = {}
self.choices = []
+ self.menus = []
+ self.comments = []
+
for nmy in "n", "m", "y":
sym = Symbol()
sym.kconfig = self
@@ -1993,6 +2006,8 @@ class Kconfig(object):
node.filename = self._filename
node.linenr = self._linenr
+ self.menus.append(node)
+
self._parse_properties(node)
self._parse_block(_T_ENDMENU, node, node)
node.list = node.next
@@ -2010,6 +2025,8 @@ class Kconfig(object):
node.filename = self._filename
node.linenr = self._linenr
+ self.comments.append(node)
+
self._parse_properties(node)
prev.next = prev = node