-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanner.h
More file actions
47 lines (38 loc) · 1.46 KB
/
Copy pathScanner.h
File metadata and controls
47 lines (38 loc) · 1.46 KB
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 ScannerH
#define ScannerH
#include "Lexem.h"
#include "HashTable.h"
#include "Tree.h"
#include "ErrorMessage.h"
#include <vector>
#include <iostream.h>
#include <System.hpp>
class Scanner {
private:
unsigned int line; //variable, that stores current line, need to localizate errors
unsigned int pos; //variable, that stores current position in line
static HashTable hashTable;
Tree tree;
vector<ErrorMessage> Errors;
enum states {H, KWorID, UCharOrID, U8CharOrID, UCharEnd, Char, EscapeChar, ErrorCharEnd,
CharEnd, String, NumStartsWithZero, Num, NumSuf, NumSufL1, NumSufL2,
NumSufU1, NumSufU2, FloatSuf, SufEndCheck, NumWithDot, NumWithExp,
NumWithExpSign, NumWithExpMan, OctNum, HexNum, HexNumWithDot, HexNumWithExp,
HexNumWithExpSign, HexNumWithExpMan, BinNum, Dot, Colon, Plus, Minus, Assign,
Amp, Div, Or, LineComment, WideComment, WideCommentEnd, Less, LessEq, LeftShift,
Greater, RightShift, Directive, F, ErrorLexemEnd };
states currState;
void initHashTable();
void initAuto();
bool isCharAllowed(char ch);
public:
Scanner();
vector<Lexem> scan(const AnsiString&);
vector<ErrorMessage> getErrors();
//method, that get a text of program, and returns the lexem table
//text will be written from file, so we must create a stream
//also method must create lexem table and fill it
};
//---------------------------------------------------------------------------
#endif