MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / expr_items

Function expr_items

scripts/kconfig/kconfiglib.py:6216–6240  ·  view source on GitHub ↗

Returns a set() of all items (symbols and choices) that appear in the expression 'expr'. Passing subexpressions of expressions to this function works as expected.

(expr)

Source from the content-addressed store, hash-verified

6214
6215
6216def expr_items(expr):
6217 """
6218 Returns a set() of all items (symbols and choices) that appear in the
6219 expression 'expr'.
6220
6221 Passing subexpressions of expressions to this function works as expected.
6222 """
6223 res = set()
6224
6225 def rec(subexpr):
6226 if subexpr.__class__ is tuple:
6227 # AND, OR, NOT, or relation
6228
6229 rec(subexpr[1])
6230
6231 # NOTs only have a single operand
6232 if subexpr[0] is not NOT:
6233 rec(subexpr[2])
6234
6235 else:
6236 # Symbol or choice
6237 res.add(subexpr)
6238
6239 rec(expr)
6240 return res
6241
6242
6243def split_expr(expr, op):

Callers 1

referencedMethod · 0.85

Calls 1

recFunction · 0.70

Tested by

no test coverage detected