diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2015-06-12 14:25:44 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2015-06-12 14:32:43 +0200 |
| commit | 474102ace67aa5cac750d2a00ac130d0401ed466 (patch) | |
| tree | 55c8135222aa3d29437cac6ba5f3b73ac050f661 /kconfiglib.py | |
| parent | 9585ca43434f9caeed6176fc179bea351ded5579 (diff) | |
Rename cur_sym_or_choice to cur_item.
It also handles Menus and Comments.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 00df354..4899c9a 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -216,7 +216,7 @@ class Config(object): self.end_line_tokens = None # See the comment in _parse_expr(). - self._cur_sym_or_choice = None + self._cur_item = None self._line = None self._filename = None self._linenr = None @@ -795,17 +795,17 @@ class Config(object): # <expr> '&&' <expr> # <expr> '||' <expr> - def _parse_expr(self, feed, cur_sym_or_choice, line, filename=None, - linenr=None, transform_m=True): + def _parse_expr(self, feed, cur_item, line, filename=None, linenr=None, + transform_m=True): """Parse an expression from the tokens in 'feed' using a simple top-down approach. The result has the form (<operator>, <list containing parsed operands>). feed -- _Feed instance containing the tokens for the expression. - cur_sym_or_choice -- The symbol or choice currently being parsed, or - None if we're not parsing a symbol or choice. - Used for recording references to symbols. + cur_item -- The item (Symbol, Choice, Menu, or Comment) currently being + parsed, or None if we're not parsing an item. Used for + recording references to symbols. line -- The line containing the expression being parsed. @@ -820,7 +820,7 @@ class Config(object): # through the top-down parser in _parse_expr_2(), which is tedious and # obfuscates the code. A profiler run shows no noticeable performance # difference. - self._cur_sym_or_choice = cur_sym_or_choice + self._cur_item = cur_item self._transform_m = transform_m self._line = line self._filename = filename @@ -846,9 +846,8 @@ class Config(object): token = feed.get_next() if isinstance(token, (Symbol, str)): - if self._cur_sym_or_choice is not None and \ - isinstance(token, Symbol): - self._cur_sym_or_choice.referenced_syms.add(token) + if self._cur_item is not None and isinstance(token, Symbol): + self._cur_item.referenced_syms.add(token) next_token = feed.peek_next() # For conditional expressions ('depends on <expr>', '... if <expr>', @@ -861,9 +860,8 @@ class Config(object): relation = EQUAL if (feed.get_next() == T_EQUAL) else UNEQUAL token_2 = feed.get_next() - if self._cur_sym_or_choice is not None and \ - isinstance(token_2, Symbol): - self._cur_sym_or_choice.referenced_syms.add(token_2) + if self._cur_item is not None and isinstance(token_2, Symbol): + self._cur_item.referenced_syms.add(token_2) return (relation, token, token_2) if token == T_NOT: |
