#include <stdio.h>
class Token{
public:
int type, value;
const static int END_OF_FILE = EOF;
const static int BLCOK_COMMENT_START = 0;
const static int LINE_COMMENT_START = 1;
const static int NORM_CHAR = 2;
const static int BLOCK_COMMENT_END = 3;
const static int DOUBLE_QUOTE_MARK = 4;
const static int ENTER = 5;
const static int CONVERT_CHAR = 6;
const static int NONE = 7;
Token(int type=Token::NONE, int value=-1);
void print();
};
class BufferedReader{
public:
const static int BLOCKN = 1024;
char buffer[BLOCKN+1];
int buffer_off;
char buffer_c;
Token buffer_tok;
bool in_comment;
BufferedReader();
Token readToken();
void pushToken(Token tok){buffer_tok = tok;}
private:
char readChar();
void pushChar(char c){buffer_c = c;}
bool loadBuffer();
};
Token::Token(int type, int value)
{
this->
去除代码中的注释——完整实现代码
最新推荐文章于 2025-05-14 08:56:21 发布