11 std::vector<Token> tokens;
14 const char c =
peek();
15 if (c ==
' ' || c ==
'\n') {
26 else if (isalpha(c) || c ==
'_') {
29 else if (isdigit(c)) {
48 uint32_t tmp_l =
line;
58 else if (value ==
"true" || value ==
"false") {
66 uint32_t tmp_l =
line;
75 else if (
peek() ==
'.') {
91 switch (tolower(suffix)) {
119 uint32_t tmp_l =
line;
140 uint32_t tmp_l =
line;
154 else if (value.length() != 1) {
163 uint32_t tmp_l =
line;
173 else if (
peek() ==
'+') {
183 else if (
peek() ==
'-') {
187 else if (
peek() ==
'>') {
269 std::stringstream ss;
270 ss <<
"Unsupported operator: \033[0m'" << c <<
"'";
309 std::stringstream ss;
310 ss <<
"Unsupported escape sequence: \033[0m'\\" << c;
317 std::stringstream ss;
318 ss <<
"Index out of range: " <<
pos + rpos <<
'/' <<
source_len;
325 const char c =
peek();
Token tokenize_character_lit()
Method for tokenizing character literal.
const char get_escape_sequence()
Method for getting escape-sequence in string or character literal.
Token tokenize_string_lit()
Method for tokenizing string literal.
Token tokenize_number_lit()
Method for tokenizing number literal.
const char advance()
Method for skipping current character from source code and returns it.
void skip_comments()
Method for skipping comments.
const char peek(int32_t rpos=0) const
Method for getting character from source code by lexer pos and passed offset.
Token tokenize_op()
Method for tokenizing operator.
Token tokenize_id()
Method for tokenizing identifier token.
std::map< std::string, TokenType > keywords
std::vector< Token > tokenize()
Method for tokenizing source code.
void throw_exception(SubsystemType type, std::string msg, uint32_t line, std::string file_name, bool is_debug)
Function for throwing exception.
Header file for defining thrown exceptions by the compiler.
Header file for defining the lexer.