MCPcopy Create free account
hub / github.com/GJDuck/e9patch / dumpExpr

Function dumpExpr

src/e9tool/e9action.cpp:1542–1808  ·  view source on GitHub ↗

* Dump a match expression. */

Source from the content-addressed store, hash-verified

1540 * Dump a match expression.
1541 */
1542static void dumpExpr(const MatchExpr &expr, std::string &str, bool hex = false)
1543{
1544 switch (expr.op)
1545 {
1546 case MATCH_OP_DEFINED:
1547 str += "defined(";
1548 dumpExpr(*expr.lhs, str);
1549 str += ')';
1550 return;
1551 case MATCH_OP_NOT:
1552 str += '!';
1553 dumpExpr(*expr.lhs, str);
1554 return;
1555 case MATCH_OP_NEG:
1556 str += '-';
1557 dumpExpr(*expr.lhs, str);
1558 return;
1559 case MATCH_OP_BIT_NOT:
1560 str += '~';
1561 dumpExpr(*expr.lhs, str);
1562 return;
1563 case MATCH_OP_BIT_AND: case MATCH_OP_BIT_OR: case MATCH_OP_BIT_XOR:
1564 hex = true;
1565 // Fallthrough:
1566 case MATCH_OP_AND: case MATCH_OP_OR:
1567 case MATCH_OP_EQ: case MATCH_OP_NEQ:
1568 case MATCH_OP_LT: case MATCH_OP_LEQ:
1569 case MATCH_OP_GT: case MATCH_OP_GEQ:
1570 case MATCH_OP_IN:
1571 case MATCH_OP_ADD: case MATCH_OP_SUB:
1572 case MATCH_OP_MUL: case MATCH_OP_DIV: case MATCH_OP_MOD:
1573 case MATCH_OP_LSHIFT: case MATCH_OP_RSHIFT:
1574 str += '(';
1575 dumpExpr(*expr.lhs, str, hex);
1576 switch (expr.op)
1577 {
1578 case MATCH_OP_AND:
1579 str += " && "; break;
1580 case MATCH_OP_OR:
1581 str += " || "; break;
1582 case MATCH_OP_EQ:
1583 str += " == "; break;
1584 case MATCH_OP_NEQ:
1585 str += " != "; break;
1586 case MATCH_OP_LT:
1587 str += " < "; break;
1588 case MATCH_OP_LEQ:
1589 str += " <= "; break;
1590 case MATCH_OP_GT:
1591 str += " > "; break;
1592 case MATCH_OP_GEQ:
1593 str += " >= "; break;
1594 case MATCH_OP_IN:
1595 str += " in "; break;
1596 case MATCH_OP_ADD:
1597 str += '+'; break;
1598 case MATCH_OP_SUB:
1599 str += '-'; break;

Callers 2

matchDoEvalFunction · 0.85
matchEvalFunction · 0.85

Calls 2

errorFunction · 0.85
dumpValFunction · 0.85

Tested by

no test coverage detected