diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-21 08:38:06 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-21 13:11:58 +0200 |
| commit | 40e3e36f41b211d89edbbedfbfb1e4ab8b102d49 (patch) | |
| tree | 7aacf52ded2ccbd24b8b0fba44d5e03be1fe1a0d /kconfiglib.py | |
| parent | 8d65a5741c750e4ab7f1443f9f1c1785ba151ddd (diff) | |
Sort _parse_properties() cases by frequency
Use the Linux x86 Kconfig frequencies.
Most cases were already sorted, but the blank line case was treated
specially. 'imply' was checked too early too (though it's used more in
some other projects).
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 9fd9e9f..8d0e61c 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2663,8 +2663,6 @@ class Kconfig(object): while self._next_line(): t0 = self._next_token() - if t0 is None: - continue if t0 in _TYPE_TOKENS: self._set_type(node, _TOKEN_TO_TYPE[t0]) @@ -2688,12 +2686,9 @@ class Kconfig(object): node.selects.append((self._expect_nonconst_sym(), self._parse_cond())) - elif t0 is _T_IMPLY: - if not isinstance(node.item, Symbol): - self._parse_error("only symbols can imply") - - node.implies.append((self._expect_nonconst_sym(), - self._parse_cond())) + elif t0 is None: + # Blank line + continue elif t0 is _T_DEFAULT: node.defaults.append((self._parse_expr(False), @@ -2713,6 +2708,21 @@ class Kconfig(object): self._expect_sym(), self._parse_cond())) + elif t0 is _T_IMPLY: + if not isinstance(node.item, Symbol): + self._parse_error("only symbols can imply") + + node.implies.append((self._expect_nonconst_sym(), + self._parse_cond())) + + elif t0 is _T_VISIBLE: + if not self._check_token(_T_IF): + self._parse_error('expected "if" after "visible"') + + node.visibility = self._make_and(node.visibility, + self._expect_expr_and_eol()) + + elif t0 is _T_OPTION: if self._check_token(_T_ENV): if not self._check_token(_T_EQUAL): @@ -2778,13 +2788,6 @@ class Kconfig(object): else: self._parse_error("unrecognized option") - elif t0 is _T_VISIBLE: - if not self._check_token(_T_IF): - self._parse_error('expected "if" after "visible"') - - node.visibility = self._make_and(node.visibility, - self._expect_expr_and_eol()) - elif t0 is _T_OPTIONAL: if not isinstance(node.item, Choice): self._parse_error('"optional" is only valid for choices') |
