-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lexer.h
43 lines (42 loc) · 1.52 KB
/
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
#ifndef LEXER_H
#define LEXER_H
#include<iostream>
#include<string>
#include<vector>
//using namespace std;
namespace Sticher{
enum CategoriseOfToken{TERMINAL,NONTERMINAL,EVALUATOR,SEPERATOR,DELIMITER,OR_OPERATOR};
typedef struct{
std::string Token;
CategoriseOfToken TokenType;
} table;
class Lexer
{
public:
Lexer(std::string);
Lexer();
~Lexer();
static bool LexerError;
std::vector<table> OutputSymbolTable();
void Clean();
protected:
private:
//members
std::string Input;
int counter=0;
//methods
bool isLetter(char);//Returns true if a letter is detected
bool isDigit(char);//Returns true if a number is detected
bool isNonterminal(std::string);//Returns true if a nonterminal std::string is detected
bool isTerminal(std::string);//Returns true if a terminal std::string is detected
bool isEvaluator(std::string);//Returns true if a evaluator is detected
bool isDelimiter(std::string);//Returns true if a delimiter is detected
bool isSeperator(std::string);//Returns true if a seperator is detected
bool isWhitespace(std::string);//Returns true if a whitespace is detected
bool isComment(std::string);//Returns true if a comment is detected
bool isOr_Operator(std::string);//Returns true if an or operator is detected
void ShowSymbolTable();//Displays the Uniform Symbol Table
std::vector<table> UniformSymbolTable;
};
}
#endif // LEXER_H