-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lexer.h
47 lines (32 loc) · 858 Bytes
/
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
//
// Created by Lars on 05.05.2017.
//
#include "vector"
#include "string"
#include "Token.h"
#include "fstream"
#include <iostream>
#ifndef COMPILER_CONSTRUCTION_LEXER_H
#define COMPILER_CONSTRUCTION_LEXER_H
class Lexer {
private:
std::vector<std::string>* SymbolTable;
std::vector<Token>* TokenStream;
std::ifstream* srcFile;
char curChar;
void advCurChar();
void skipUntilEndOfLine();
Token getAlphaTok();
Token getKeywordTok(std::string keyword);
Token getLitBoolTok(std::string keyword);
Token getLitStrTok();
Token getLitNumTok();
Token skipCommentTok();
public:
Lexer(std::string path);
virtual ~Lexer();
Token getNextTok();
std::vector<std::string>* getSymbolTable() const;
const std::vector<Token>* getTokenStream() const;
};
#endif //COMPILER_CONSTRUCTION_LEXER_H