scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 5ddab6fee4068c8e760aba6a7cf842ba13e9194c
parent 1f4874cced9c4f1308556b07e835bb47547becc0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 12 Jun 2012 22:00:50 +0200

Modified name of shift tokens

The functions which handle the shift are called with the acronyms shl and
shr, so it is logic that tokens use the same rule.

Diffstat:
Mexpr.c | 8++++----
Mlex.c | 4++--
Mtokens.h | 31+++++++++++++------------------
3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/expr.c b/expr.c @@ -182,8 +182,8 @@ static void shift(void) for (;;) { register void (*fp)(void); switch (yytoken) { - case LSHIFT: fp = gen_shl; break; - case RSHIFT: fp = gen_shr; break; + case SHL: fp = gen_shl; break; + case SHR: fp = gen_shr; break; default: fputs("leaving static void shift (void)", stderr); return; @@ -320,8 +320,8 @@ static void assign(void) case MOD_EQ: fp = gen_a_mod; break; case ADD_EQ: fp = gen_a_add; break; case SUB_EQ: fp = gen_a_sub; break; - case LSHIFT_EQ: fp = gen_a_shl; break; - case RSHIFT_EQ: fp = gen_a_shr; break; + case SHL_EQ: fp = gen_a_shl; break; + case SHR_EQ: fp = gen_a_shr; break; case AND_EQ: fp = gen_a_and; break; case XOR_EQ: fp = gen_a_xor; break; case OR_EQ: fp = gen_a_or; break; diff --git a/lex.c b/lex.c @@ -99,8 +99,8 @@ follow(unsigned char op, unsigned char eq, unsigned char rep) static unsigned char rel_shift(unsigned char op) { static char tokens[2][3] = { - {GE, LSHIFT, LSHIFT_EQ}, - {LE, RSHIFT, RSHIFT_EQ}}; + {GE, SHL, SHL_EQ}, + {LE, SHR, SHR_EQ}}; register char c; register char *tp = tokens[op == '>']; diff --git a/tokens.h b/tokens.h @@ -6,27 +6,22 @@ #define TOKSIZ_MAX 21 /* Don't change this codification because program used it!!! */ -enum { - /* types */ - INT = 1, CHAR, FLOAT, LONG, LLONG, SHORT, VOID, DOUBLE, - LDOUBLE, STRUCT, UNION, ENUM, UTYPE, BOOL, - /* storage specifier */ - TYPEDEF, EXTERN, STATIC, AUTO, REGISTER, - /* type qualifier */ - VOLATILE, CONST, RESTRICTED, - /* sign specifier */ - UNSIGNED, SIGNED -}; - - - - -enum { +enum tokens { + /* types */ + INT = 1, CHAR, FLOAT, LONG, LLONG, SHORT, VOID, DOUBLE, + LDOUBLE, STRUCT, UNION, ENUM, UTYPE, BOOL, + /* storage specifier */ + TYPEDEF, EXTERN, STATIC, AUTO, REGISTER, + /* type qualifier */ + VOLATILE, CONST, RESTRICTED, + /* sign specifier */ + UNSIGNED, SIGNED, + /* other tokens */ IDEN = 128, CONSTANT, SIZEOF, - PTR, INC, DEC, LSHIFT, RSHIFT, + PTR, INC, DEC, SHL, SHR, LE, GE, EQ, NE, AND, OR, MUL_EQ, DIV_EQ, MOD_EQ, ADD_EQ, SUB_EQ, AND_EQ, - XOR_EQ, OR_EQ, LSHIFT_EQ, RSHIFT_EQ, + XOR_EQ, OR_EQ, SHL_EQ, SHR_EQ, TYPE_NAME, ELLIPSIS, CASE, DEFAULT, IF, ELSE, SWITCH, WHILE, DO, FOR, GOTO, CONTINUE, BREAK, RETURN, EOFTOK, NOTOK