summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index a23a8c6..865953d 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -1621,7 +1621,13 @@ class Kconfig(object):
if t0 is None:
continue
- if t0 == _T_DEPENDS:
+ if t0 in _TYPE_TOKENS:
+ node.item.orig_type = _TOKEN_TO_TYPE[t0]
+
+ if self._peek_token() is not None:
+ prompt = (self._next_token(), self._parse_cond())
+
+ elif t0 == _T_DEPENDS:
if not self._check_token(_T_ON):
self._parse_error('expected "on" after "depends"')
@@ -1679,18 +1685,11 @@ class Kconfig(object):
implies.append((self._next_token(), self._parse_cond()))
- elif t0 in (_T_BOOL, _T_TRISTATE, _T_INT, _T_HEX, _T_STRING):
- node.item.orig_type = _TOKEN_TO_TYPE[t0]
-
- if self._peek_token() is not None:
- prompt = (self._next_token(), self._parse_cond())
-
elif t0 == _T_DEFAULT:
defaults.append((self._parse_expr(False), self._parse_cond()))
elif t0 in (_T_DEF_BOOL, _T_DEF_TRISTATE):
node.item.orig_type = _TOKEN_TO_TYPE[t0]
-
defaults.append((self._parse_expr(False), self._parse_cond()))
elif t0 == _T_PROMPT:
@@ -4119,6 +4118,16 @@ _STRING_LEX = frozenset((
_T_TRISTATE,
))
+# Tokens for types, excluding def_bool, def_tristate, etc., for quick
+# checks during parsing
+_TYPE_TOKENS = frozenset((
+ _T_BOOL,
+ _T_TRISTATE,
+ _T_INT,
+ _T_HEX,
+ _T_STRING,
+))
+
# Note: This hack is no longer needed as of upstream commit c226456
# (kconfig: warn of unhandled characters in Kconfig commands). It
# is kept around for backwards compatibility.