-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlexer.h
More file actions
38 lines (31 loc) · 694 Bytes
/
lexer.h
File metadata and controls
38 lines (31 loc) · 694 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
37
38
#ifndef LEXER_H
#define LEXER_H
#include "token.h"
#include <string>
#include <vector>
namespace AR437 {
class Lexer {
private:
std::string source;
size_t current;
int line;
int column;
char peek(int offset = 0) const;
char advance();
void skipWhitespace();
void skipComment();
Token makeNumber();
Token makeString();
Token makeIdentifier();
Token makeOperator();
bool isAtEnd() const;
bool isAlpha(char c) const;
bool isDigit(char c) const;
bool isAlphaNumeric(char c) const;
public:
Lexer(const std::string& source);
std::vector<Token> tokenize();
Token nextToken();
};
} // namespace AR437
#endif // LEXER_H