-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlexer.h
More file actions
36 lines (34 loc) · 705 Bytes
/
Copy pathlexer.h
File metadata and controls
36 lines (34 loc) · 705 Bytes
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
//lexer.h
#include <stdio.h>
#include <vector>
#include "token.h"
#define MAX_BUFFER 80
class Lexer{
vector<istream *> streamStack;
istream *stream;
int line;
int charNum;
Token firstToken;
void jumpBlanks();
string readIdentifier(char c);
string readNumber(char c);
void readComment();
Token readLongComment();
int reopenTty();
public:
Lexer();
Lexer(char *fname);
Lexer(string s);
void newStream(string s);
void closeStream();
int lineNum() {return line;}
char getChar();
string readString(char term);
void unGet();
Token nextToken();
Token peekToken();
void consumeToken();
Token expect(const char *c);
Token expect(Token::Type t);
~Lexer();
};