-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanner.h
More file actions
38 lines (30 loc) · 705 Bytes
/
Scanner.h
File metadata and controls
38 lines (30 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
37
#pragma once
#ifndef SCANNER_H_
#define SCANNER_H_
#include<vector>
#include<cstring>
#include<string>
#include"ascii_codes.h"
class Interpreter;
class Context;
class Keyword;
/*
the scanner converts a string of text into an array of tokens
it enforces the lexical grammar
*/
class Scanner
{
public:
Scanner(Interpreter *interpreter);
virtual ~Scanner(void);
void TransformCharsToTokens(const char *source);
void Interpret(Context context);
void IsValid(const char *source);
const char* GetEndOfString(const char*source);
static std::string* GetKeywordAndUpdateContext(Context context);
Keyword *ExtractKeyword(Context context);
private:
Scanner();
Interpreter *_interpreter;
};
#endif