From efbf127e6150f5f2e02d3bb1dff86ef38bac4275 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sun, 9 Jun 2019 13:56:58 +0200 Subject: Move self._line setting into _tokenize() Factors out some common code. --- kconfiglib.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 5757e7c..c8867da 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1866,10 +1866,9 @@ class Kconfig(object): self._filename = None - # Don't include the "if " from below to avoid giving confusing error - # messages - self._line = s self._tokens = self._tokenize("if " + s) + # Strip "if " to avoid giving confusing error messages + self._line = s self._tokens_i = 1 # Skip the 'if' token return expr_value(self._expect_expr_and_eol()) @@ -2120,7 +2119,6 @@ class Kconfig(object): line = line[:-2] + self._readline() self._linenr += 1 - self._line = line # Used for error reporting self._tokens = self._tokenize(line) # Initialize to 1 instead of 0 to factor out code from _parse_block() # and _parse_properties(). They immediately fetch self._tokens[0]. @@ -2142,7 +2140,6 @@ class Kconfig(object): line = line[:-2] + self._readline() self._linenr += 1 - self._line = line self._tokens = self._tokenize(line) self._reuse_tokens = True @@ -2228,6 +2225,8 @@ class Kconfig(object): # working across multiple lines. Lookback and compatibility with old # janky versions of the C tools complicate things though. + self._line = s # Used for error reporting + # Initial token on the line match = _command_match(s) if not match: -- cgit v1.2.3