[hackers] [scc] [cc2] Remove input dependecy from assign() || Roberto E. Vargas Caballero
commit bf42a6e903cc4c2e7968b4a1148d20923b1bc8b6
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
AuthorDate: Mon Apr 18 01:58:53 2016 +0200
Commit: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
CommitDate: Mon Apr 18 03:14:46 2016 +0200
[cc2] Remove input dependecy from assign()
This function had a dependency with the input language in how it
was parsing the subop value.
diff --git a/cc2/parser.c b/cc2/parser.c
index b429dad..6de47cb 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -232,29 +232,30 @@ constant(char *token, union tokenop u)
static void
assign(char *token, union tokenop u)
{
- int c, op = *token++;
+ int subop, op = u.op;
Node *np = newnode();
- switch (*token) {
- case ODIV:
- case OMOD:
- case OADD:
- case OSUB:
- case OSHL:
- case OSHR:
- case OBAND:
- case OBXOR:
- case OBOR:
- case OINC:
- case ODEC:
- c = *token++;
+ switch (subop = *++token) {
+ case '/':
+ case '%':
+ case '+':
+ case '-':
+ case 'l':
+ case 'r':
+ case '&':
+ case '|':
+ case '^':
+ case 'i':
+ case 'd':
+ ++token;
+ subop = optbl[subop].u.op;
break;
default:
- c = 0;
+ subop = 0;
break;
}
- np->u.subop = c;
+ np->u.subop = subop;
np->op = op;
np->type = *gettype(token);
np->right = pop();
Received on Mon Apr 18 2016 - 21:24:05 CEST
This archive was generated by hypermail 2.3.0
: Mon Apr 18 2016 - 21:24:38 CEST