VapourSynth-llvmexpr
Loading...
Searching...
No Matches
Tokenizer.hpp
Go to the documentation of this file.
1
19
20
#ifndef LLVMEXPR_FRONTEND_INFIX2POSTFIX_TOKENIZER_HPP
21
#define LLVMEXPR_FRONTEND_INFIX2POSTFIX_TOKENIZER_HPP
22
23
#include "
types.hpp
"
24
25
#include <map>
26
#include <string>
27
#include <vector>
28
29
namespace
infix2postfix
{
30
31
class
Tokenizer
{
32
public
:
33
explicit
Tokenizer
(std::string source);
34
std::vector<Token>
tokenize
();
35
36
private
:
37
Token
nextToken();
38
[[nodiscard]]
char
peek(
int
offset = 0)
const
;
39
char
advance();
40
void
skipWhitespaceAndComments();
41
[[nodiscard]]
Token
makeToken(
TokenType
type,
42
const
std::string& value =
""
)
const
;
43
Token
identifier();
44
Token
number();
45
Token
globalDeclaration();
46
47
std::string source;
48
size_t
current = 0;
49
size_t
start = 0;
50
int
line = 1;
51
int
column = 1;
52
int
start_line = 1;
53
int
start_column = 1;
54
55
static
const
std::map<std::string, TokenType> keywords;
56
};
57
58
}
// namespace infix2postfix
59
60
#endif
// LLVMEXPR_FRONTEND_INFIX2POSTFIX_TOKENIZER_HPP
infix2postfix::Tokenizer::tokenize
std::vector< Token > tokenize()
Definition
Tokenizer.cpp:66
infix2postfix::Tokenizer::Tokenizer
Tokenizer(std::string source)
Definition
Tokenizer.cpp:64
infix2postfix
Definition
AnalysisEngine.cpp:29
infix2postfix::TokenType
TokenType
Definition
types.hpp:66
infix2postfix::Token
Definition
types.hpp:199
types.hpp
llvmexpr
frontend
infix2postfix
Tokenizer.hpp
Generated by
1.16.0