From 7dae98803a6fc5d08041d1387e2e0d83fc0eb0ed Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 22 Aug 2018 22:08:06 +0200 Subject: Add a generic node iterator Suggested by Mitja Horvat (pinkfluid) in https://github.com/ulfalizer/Kconfiglib/pull/50. Kconfig.node_iter() iterates through all menu nodes in the menu tree in Kconfig order. This saves scripts the trouble of implementing their own tree walking code. Have node_iter() take a 'unique_syms' flag that can be enabled to only include symbols defined in multiple locations once. This is often what you want when generating output (and is used by write_config()). Order is still preserved. Piggyback a fix to a syntax error test comment. Parsing has been tightened up now. --- examples/print_tree.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'examples') diff --git a/examples/print_tree.py b/examples/print_tree.py index 09883d7..5155cf0 100644 --- a/examples/print_tree.py +++ b/examples/print_tree.py @@ -2,6 +2,9 @@ # sometimes implicitly alter the menu structure (see kconfig-language.txt), and # that's implemented too. # +# Note: See the Kconfig.node_iter() function as well, which provides a simpler +# interface for walking the menu tree. +# # Usage: # # $ make [ARCH=] scriptconfig SCRIPT=Kconfiglib/examples/print_tree.py -- cgit v1.2.3