-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathx86_lexer.h
47 lines (36 loc) · 900 Bytes
/
x86_lexer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef X86LEXER_H
#define X86LEXER_H
#include <inttypes.h>
#include <cstring>
#include <iostream>
#include <string>
#include <list>
#include "x86_parser.h"
#include "parser_common.h"
#include "mempool.h"
#include "util.h"
#define XTK_ERROR 9999
using namespace std;
class XInstruction;
typedef ParserContext<XInstruction> XParserContext;
class X86Lexer
{
public:
X86Lexer(istream *in);
int getNextToken();
int getCurrentLine() { return currentLine; }
void getTokenInfo(TokenInfo *ti) {
ti->intValue = tokenInfo.intValue;
ti->tokenLexeme = tokenInfo.tokenLexeme;
ti->line = tokenInfo.line;
}
static string getTokenString(int token, TokenInfo *info);
private:
int nextChar() { return in->get(); }
void ungetChar(int c) { in->putback(c); }
private:
istream *in;
int currentLine;
TokenInfo tokenInfo;
};
#endif // X86LEXER_H