2018-11-11
2018-11-11 本文已影响0人
Jianbaozi
class Token_stream {
private:
bool full;
Token buffer;
public:
Token_stream();
Token get();
void push_back(Token t);
void ignore(char c); //从Token_stream入手消除错误,在get()之前利用cin跳过分号及其之前的字符;
};
void Token_stream::ignore(char c) {
if (full&&buffer.kind == 'c') {
full = false;
return;
}
full = false;
char ch = '0';
while (cin >> ch) {
if (ch == c) //c也将被跳过;
return;
}
}