summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2017-09-27 18:19:12 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2017-09-27 23:18:50 +0200
commitca8b4c9b77b080bc27564992587ad11f3f663a26 (patch)
tree401302c3630814e6f57b42aafc6e50aa6ef550ee
parent0100bb05fba211ceea21b83697b7bcfd5e2e0bd7 (diff)
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.
-rw-r--r--kconfiglib.py28
1 files changed, 11 insertions, 17 deletions
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:
-
- <expr> -> <symbol>
- <symbol> '=' <symbol>
- <symbol> '!=' <symbol>
- '(' <expr> ')'
- '!' <expr>
- <expr> '&&' <expr>
- <expr> '||' <expr>"""
+ '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