ref: b6d551944bd495bb30ba7345f5ab77ccca14c295
parent: 6f28085c2d0113db59693fdf30fe1d1e855635f9
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Mar 31 15:37:40 EDT 2014
Add plus() in lex.c We have minus, so it is logical to have plus().
--- a/lex.c
+++ b/lex.c
@@ -182,6 +182,7 @@
register int c = getc(yyin);
yybuf[1] = c;
+ yybuf[2] = '\0';
switch (c) {case '-': return DEC;
case '>': return INDIR;
@@ -194,6 +195,23 @@
}
static uint8_t
+plus(void)
+{+ register int c = getc(yyin);
+
+ yybuf[1] = c;
+ yybuf[2] = '\0';
+ switch (c) {+ case '+': return INC;
+ case '=': return ADD_EQ;
+ default:
+ yybuf[1] = '\0';
+ ungetc(c, yyin);
+ return '+';
+ }
+}
+
+static uint8_t
relational(uint8_t op, uint8_t equal, uint8_t shift, uint8_t assig)
{register int c = getc(yyin);
@@ -220,7 +238,6 @@
switch (c) { case '<': return relational('<', LE, SHL, SHL_EQ); case '>': return relational('>', GE, SHR, SHR_EQ);- case '+': return follow('+', INC, follow('=', ADD_EQ, '+')); case '=': return follow('=', EQ, '='); case '^': return follow('=', XOR_EQ, '^'); case '*': return follow('=', MUL_EQ, '*');@@ -229,6 +246,7 @@
case '&': return follow('=', AND_EQ, AND); case '|': return follow('=', OR_EQ, OR);case '-': return minus();
+ case '+': return plus();
default: return c;
}
}
--
⑨