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

Function _split_expr_info

scripts/kconfig/menuconfig.py:2693–2722  ·  view source on GitHub ↗
(expr, indent)

Source from the content-addressed store, hash-verified

2691
2692
2693def _split_expr_info(expr, indent):
2694 # Returns a string with 'expr' split into its top-level && or || operands,
2695 # with one operand per line, together with the operand's value. This is
2696 # usually enough to get something readable for long expressions. A fancier
2697 # recursive thingy would be possible too.
2698 #
2699 # indent:
2700 # Number of leading spaces to add before the split expression.
2701
2702 if len(split_expr(expr, AND)) > 1:
2703 split_op = AND
2704 op_str = "&&"
2705 else:
2706 split_op = OR
2707 op_str = "||"
2708
2709 s = ""
2710 for i, term in enumerate(split_expr(expr, split_op)):
2711 s += "{}{} {}".format(indent*" ",
2712 " " if i == 0 else op_str,
2713 _expr_str(term))
2714
2715 # Don't bother showing the value hint if the expression is just a
2716 # single symbol. _expr_str() already shows its value.
2717 if isinstance(term, tuple):
2718 s += " (={})".format(TRI_TO_STR[expr_value(term)])
2719
2720 s += "\n"
2721
2722 return s
2723
2724
2725def _select_imply_info(sym):

Callers 2

_direct_dep_infoFunction · 0.70
_defaults_infoFunction · 0.70

Calls 3

split_exprFunction · 0.90
expr_valueFunction · 0.90
_expr_strFunction · 0.70

Tested by

no test coverage detected