diff options
Diffstat (limited to 'demos/sample-files/calc-skeleton.c')
-rw-r--r-- | demos/sample-files/calc-skeleton.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/demos/sample-files/calc-skeleton.c b/demos/sample-files/calc-skeleton.c index 2108999..b0cbf00 100644 --- a/demos/sample-files/calc-skeleton.c +++ b/demos/sample-files/calc-skeleton.c @@ -9,12 +9,9 @@ // header file by the parser generator #include "parts/symbol.h" enum symbol { - PLUS = 0, - MINUS, - LPAREN, - RPAREN, - NUM, - END_INPUT, + PLUS, MINUS, TIMES, + LPAREN, RPAREN, + NUM, END_INPUT, EP, E, T, SYMBOLS_END, @@ -27,7 +24,7 @@ static struct token { static inline int issep(char c) { - return isspace(c) || c == '\0' || c == '(' || c == ')' || c == '+' || c == '-'; + return isspace(c) || c == '\0' || c == '(' || c == ')' || c == '+' || c == '-' || c == '*';; } static inline int tillsep(char *str) @@ -61,6 +58,7 @@ static char *next_token(char *str) case ')': tok.s = RPAREN; break; case '-': tok.s = MINUS; break; case '+': tok.s = PLUS; break; + case '*': tok.s = TIMES; break; } } else if(c0 >= '0' && c0 <= '9') { // num tok.s = NUM; |