From ca8b4c9b77b080bc27564992587ad11f3f663a26 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 27 Sep 2017 18:19:12 +0200 Subject: Undefault _parse_expr()'s 'filename' and 'linenr' Single user, not worth the obfuscation. Also fix an outdated reference re. 'transform_m' and remove the grammar as it makes things seem more complex than they really are. --- kconfiglib.py | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index f27e93a..06b15b8 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -550,9 +550,11 @@ class Config(object): Syntax checking is somewhat lax, partly to be compatible with lax parsing in the C implementation.""" - return self._eval_expr(self._parse_expr(self._tokenize(s, True), # Feed - None, # Current symbol/choice - s)) # line + return self._eval_expr(self._parse_expr(self._tokenize(s, True), + None, # Current symbol/choice + s, + None, # filename + None)) # linenr def unset_user_values(self): """Resets the values of all symbols, as if Config.load_config() or @@ -1126,7 +1128,7 @@ class Config(object): _make_or(target._weak_rev_dep, _make_and(stmt, _make_and(cond, deps))) - def _parse_expr(self, feed, cur_item, line, filename=None, linenr=None, + def _parse_expr(self, feed, cur_item, line, filename, linenr, transform_m=True): """Parses an expression from the tokens in 'feed' using a simple top-down approach. The result has the form @@ -1146,22 +1148,14 @@ class Config(object): line: The line containing the expression being parsed. - filename (default: None): The file containing the expression. + filename: The file containing the expression. None when using + Config.eval(). - linenr (default: None): The line number containing the expression. + linenr: The line number containing the expression. None when using + Config.eval(). transform_m (default: False): Determines if 'm' should be rewritten to - 'm && MODULES' -- see _parse_val_and_cond(). - - Expression grammar, in decreasing order of precedence: - - -> - '=' - '!=' - '(' ')' - '!' - '&&' - '||' """ + 'm && MODULES'. See the Config.eval() docstring.""" # Use instance variables to avoid having to pass these as arguments # through the top-down parser in _parse_expr_rec(), which is tedious -- cgit v1.2.3