#include #include #include "exprParser.h" int tokenVal,currentToken; void getToken() { int c,n; again: c = getc(stdin); switch(c){ case '+': currentToken = PLUS_OP; return; case '-': currentToken = MINUS_OP; return; case '\n': currentToken = EOL; return; } if(isspace(c)) goto again; if(isdigit(c)){ n = 0; do { n = n*10 + c - '0'; c = getc(stdin); } while(isdigit(c)); ungetc(c,stdin); tokenVal = n; currentToken = NUM; return; } fprintf(stderr,"bad char '%c'\n",c); exit(1); }