int T() { printf("<T>"); if (isNext(DIGITS)) { while (isNext(DIGITS)) { cnext(); } } else if (isNext("(")) { cnext(); E(); cnext(); } else if (ch != '\0') { printf("error!"); } printf("</T>"); }
int next(char *set) { if (isNext(set)) cnext(); else { printf("error!"); exit(1); } }
int E() { printf("<E>"); T(); if (isNext("+-*/")) { cnext(); E(); } printf("</E>"); }
const String &Tokenizer::next(){ char *ptr; ptr = cnext(); if(ptr == 0){ throw NoMoreTokens(); //return 0; } tstr = ptr; return tstr; }