Updated the indention for emacs
This commit is contained in:
28
common.c
28
common.c
@@ -153,8 +153,8 @@ static void next(void) {
|
||||
|
||||
/* multi/single char operators */
|
||||
src_pos++;
|
||||
#define PEEK src[src_pos]
|
||||
#define EAT src_pos++
|
||||
#define PEEK src[src_pos]
|
||||
#define EAT src_pos++
|
||||
switch(c) {
|
||||
case '+': if(PEEK=='+'){ EAT; tok.kind=TK_INC; }
|
||||
else if(PEEK=='='){ EAT; tok.kind=TK_ADDEQ; }
|
||||
@@ -191,8 +191,8 @@ static void next(void) {
|
||||
case '?': tok.kind=TK_QUESTION;break;
|
||||
default: die("Unknown char '%c'", c);
|
||||
}
|
||||
#undef PEEK
|
||||
#undef EAT
|
||||
#undef PEEK
|
||||
#undef EAT
|
||||
}
|
||||
|
||||
static void expect(TKind k) {
|
||||
@@ -359,7 +359,7 @@ static Node *unary(void) {
|
||||
}
|
||||
|
||||
#define BINOP(name, next_fn, ...) \
|
||||
static Node *name(void) { \
|
||||
static Node *name(void) { \
|
||||
Node *l=next_fn(), *t; TKind ops[]={__VA_ARGS__, TK_EOF}; \
|
||||
for(;;) { \
|
||||
int found=0; \
|
||||
@@ -368,18 +368,18 @@ static Node *name(void) { \
|
||||
TKind op=tok.kind; next(); \
|
||||
t=alloc_node(N_BOPN); t->op=op; t->ch[0]=l; t->ch[1]=next_fn(); l=t; \
|
||||
} return l; \
|
||||
}
|
||||
}
|
||||
|
||||
BINOP(mul_expr, unary, TK_STAR, TK_SLASH, TK_MOD)
|
||||
BINOP(add_expr, mul_expr, TK_PLUS, TK_MINUS)
|
||||
BINOP(shf_expr, add_expr, TK_SHL, TK_SHR)
|
||||
BINOP(cmp_expr, shf_expr, TK_LT, TK_LEQ, TK_GT, TK_GEQ)
|
||||
BINOP(eq_expr, cmp_expr, TK_EQ, TK_NEQ)
|
||||
BINOP(band_expr, eq_expr, TK_AMP)
|
||||
BINOP(bxor_expr, band_expr,TK_CARET)
|
||||
BINOP(bor_expr, bxor_expr,TK_PIPE)
|
||||
BINOP(add_expr, mul_expr, TK_PLUS, TK_MINUS)
|
||||
BINOP(shf_expr, add_expr, TK_SHL, TK_SHR)
|
||||
BINOP(cmp_expr, shf_expr, TK_LT, TK_LEQ, TK_GT, TK_GEQ)
|
||||
BINOP(eq_expr, cmp_expr, TK_EQ, TK_NEQ)
|
||||
BINOP(band_expr, eq_expr, TK_AMP)
|
||||
BINOP(bxor_expr, band_expr,TK_CARET)
|
||||
BINOP(bor_expr, bxor_expr,TK_PIPE)
|
||||
|
||||
static Node *land_expr(void) {
|
||||
static Node *land_expr(void) {
|
||||
Node *l=bor_expr(), *t;
|
||||
while (tok.kind==TK_AND) {
|
||||
next(); t=alloc_node(N_BOPN); t->op=TK_AND;
|
||||
|
||||
Reference in New Issue
Block a user