diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-10-02 12:47:43 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2017-10-02 13:00:45 +0200 |
| commit | f64aaf971176305233f16a11911a660fa6f99561 (patch) | |
| tree | 54582f6f9f89b7e6db8e437e6b31a2190be555d9 /kconfiglib.py | |
| parent | badc868bafbae418eac2b6a41387ed1723c1d86d (diff) | |
Clean up _expand_sym_refs() a bit
Get the symbol name without the '$' straight from the regex.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 6b5b80f..186c931 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1723,12 +1723,10 @@ class Config(object): if sym_ref_match is None: return s - sym_name = sym_ref_match.group(0)[1:] - sym = self._syms.get(sym_name) - expansion = "" if sym is None else sym.get_value() + sym = self._syms.get(sym_ref_match.group(1)) s = s[:sym_ref_match.start()] + \ - expansion + \ + (sym.get_value() if sym is not None else "") + \ s[sym_ref_match.end():] def _expr_val_str(self, expr, no_value_str="(none)", @@ -3730,7 +3728,7 @@ _initial_token_re_match = re.compile(r"[^\w#]*(\w+)\s*").match _id_keyword_re_match = re.compile(r"([\w./-]+)\s*").match # Regular expression for finding $-references to symbols in strings -_sym_ref_re_search = re.compile(r"\$[A-Za-z0-9_]+").search +_sym_ref_re_search = re.compile(r"\$([A-Za-z0-9_]+)").search # Strings to use for types _TYPENAME = { |
