示例#1
0
struct Symbol* and_expression(struct AndExpression* node)
{
    if (node->type == 0)
        return equality_expression(node->equalityExpression);
    struct Symbol* symbol1 = load_symbol(and_expression(node->andExpression));
    struct Symbol* symbol2 = load_symbol(equality_expression(node->equalityExpression));
    return and_symbol(symbol1, symbol2, node->type);
}
示例#2
0
文件: parser.c 项目: palmerc/lab
int and_expression(void) {
	if( equality_expression() ) {
	} else if( and_expression() ) {
		match(AMP);
		equality_expression();
	} else {
		abort();
	}
}
示例#3
0
int PP_Expression::equality_expression()
{
    int value = relational_expression();
    switch (next()) {
    case PP_EQEQ:
        return value == equality_expression();
    case PP_NE:
        return value != equality_expression();
    default:
        prev();
        return value;
    }
}
Expression *ExpressionBuilder::equality_expression()
{
    Expression *value = relational_expression();
    switch (next()) {
    case Token_eq:
        return createBinaryExpression(Expression::EqOp, value, equality_expression());
    case Token_not_eq:
        return createBinaryExpression(Expression::NotEqOp, value, equality_expression());
    default:
        prev();
        return value;
    }
}
示例#5
0
// Parse a bitwise and expression.
//
//    exclusive-or-expression:
//      equality-expression
//      exclusive-or-expression '&' equality-expression
//
Expr&
Parser::and_expression()
{
  Expr* e1 = &equality_expression();
  while (true) {
    if (Token tok = match_if(tk::amp_tok)) {
      Expr& e2 = equality_expression();
      e1 = &on_and_expression(tok, *e1, e2);
    } else {
      break;
    }
  }
  return *e1;
}
示例#6
0
static struct block *and_expression(struct block *block)
{
    struct var value;

    block = equality_expression(block);
    while (peek().token == '&') {
        consume('&');
        value = block->expr;
        block = equality_expression(block);
        block->expr = eval_expr(block, IR_OP_AND, value, block->expr);
    }

    return block;
}
示例#7
0
int PP_Expression::AND_expression()
{
    int value = equality_expression();
    if (test(PP_AND))
        return value & AND_expression();
    return value;
}
示例#8
0
/**
赋值表达式
<assignment_expression>::=<equality_expression>{<TK_ASSIGN><assignment_expression>}
*/
void assignment_expression(){
    equality_expression();
    if(TK_ASSIGN == token){
        get_token();
        assignment_expression();
    }
}
Expression *ExpressionBuilder::AND_expression()
{
    Expression *value = equality_expression();
    if (test('&'))
        return createBinaryExpression('&', value, AND_expression());
    return value;
}
示例#10
0
struct Symbol* equality_expression(struct EqualityExpression* node)
{
    if (node->type == 0)
        return relational_expression(node->relationalExpression);
    struct Symbol* symbol1 = load_symbol(equality_expression(node->equalityExpression));
    struct Symbol* symbol2 = load_symbol(relational_expression(node->relationalExpression));
    return equality_symbol(symbol1, symbol2, node->type, 0);
}
示例#11
0
文件: parser.c 项目: palmerc/lab
int equality_expression(void) {
	if( relational_expression() ) {
	} else if( equality_expression() ) {
		switch( lookaheadT.type ) {
			case EQ_OP:
				match(EQ_OP);
				break;
			case NE_OP:	
				match(NE_OP);
				break;
		}
		relational_expression();
	} else {
		abort();
	}
}