int inclusive_or_expression(void) { if( exclusive_or_expression() ) { } else if( inclusive_or_expression() ) { match(PIPE); exclusive_or_expression(); } }
struct Symbol* inclusive_or_expression(struct InclusiveOrExpression* node) { if (node->type == 0) return exclusive_or_expression(node->exclusiveOrExpression); struct Symbol* symbol1 = load_symbol(inclusive_or_expression(node->inclusiveOrExpression)); struct Symbol* symbol2 = load_symbol(exclusive_or_expression(node->exclusiveOrExpression)); return inclusive_or_symbol(symbol1, symbol2, node->type); }
// Parse a bitwise inclusive-or expression. // // inclusive-or-expression: // exclusive-or-expression // inclusive-or-expression '|' exclusive-or-expression // // FIXME: This skips the bitwise expressions. Expr& Parser::inclusive_or_expression() { Expr* e1 = &exclusive_or_expression(); while (true) { if (Token tok = match_if(tk::bar_tok)) { Expr& e2 = exclusive_or_expression(); e1 = &on_or_expression(tok, *e1, e2); } else { break; } } return *e1; }
static struct block *inclusive_or_expression(struct block *block) { struct var value; block = exclusive_or_expression(block); while (peek().token == '|') { consume('|'); value = block->expr; block = exclusive_or_expression(block); block->expr = eval_expr(block, IR_OP_OR, value, block->expr); } return block; }
struct Symbol* exclusive_or_expression(struct ExclusiveOrExpression* node) { if (node->type == 0) return and_expression(node->andExpression); struct Symbol* symbol1 = load_symbol(exclusive_or_expression(node->exclusiveOrExpression)); struct Symbol* symbol2 = load_symbol(and_expression(node->andExpression)); return exclusive_or_symbol(symbol1, symbol2, node->type); }
int exclusive_or_expression(void) { if( and_expression() ) { } else if( exclusive_or_expression() ) { match(CARAT); and_expression(); } else { abort(); } }