diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-09 13:56:58 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-09 14:04:38 +0200 |
| commit | efbf127e6150f5f2e02d3bb1dff86ef38bac4275 (patch) | |
| tree | f254d5a093dd172024b69705d56c5612419cfd52 | |
| parent | 8453c52291eda9b9d954ac480fd062010f836a3f (diff) | |
Move self._line setting into _tokenize()
Factors out some common code.
| -rw-r--r-- | kconfiglib.py | 9 |
1 files changed, 4 insertions, 5 deletions
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: |
