// File: /workspace/github_cpp_makefile_star2_O2/RuiDGPires[P]CrimLang/src/tokenizer.cpp
// Function: Tracker::take(char)
void Tracker::take(char c){
	if (c == '\n'){
		if (this->preproc_line == 1){
			this->current_token.type = crl::Token::Type::PREPROC_END;
			this->current_token.str = "</PP>";
			this->dump();
		}
		this->preproc_line = 0;
		if (state == PState::COMMENT) state = PState::NONE;
		this->line++;
		this->column = 0;
	}

	this->column++;

	eval:
	switch(this->state){
		case PState::NONE:
			if (c == '#'){
				if (this->preproc_line == 0){
					this->preproc_line = 1;			
					this->set_pos();
					this->current_token.type = crl::Token::Type::PREPROC_START;
					this->current_token.str = "<PP>";
					this->dump();
				}else
					throw crl::SyntaxError(line, column, "Unexpected #");
			
			}else if (c == '<' && this->preproc_line == 1){
				state = PState::GLOBAL_FOLDER;
				set_type(crl::Token::Type::GLOBAL_FOLDER);
				this->set_pos();
			}else if (is_letter(c)){
				if (!this->preproc_line) this->preproc_line = -1;
				state = PState::IDENT;
				set_type(crl::Token::Type::IDENT);
				this->push_char(c);
				this->set_pos();
			}else if (is_number(c)){
				if (!this->preproc_line) this->preproc_line = -1;
				state = PState::NUM;
				set_type(crl::Token::Type::INT);
				this->push_char(c);
				this->set_pos();
			}else if (is_symbol(c)){
				if (!this->preproc_line) this->preproc_line = -1;
				state = PState::SYMBOL;
				this->set_pos();
				this->push_char(c);
			}else if (c == '"'){
				if (!this->preproc_line) this->preproc_line = -1;
				state = PState::STRING;
				set_type(crl::Token::Type::STRING);
				this->set_pos();
			}else if (c == '\''){
				if (!this->preproc_line) this->preproc_line = -1;
				state = PState::CHAR;
				set_type(crl::Token::Type::CHAR);
				this->set_pos();
			}else if (is_whitespace(c))
				break;
			else throw crl::SyntaxError(line, column, "Unkown character: " + std::string(1, c));
			break;
		case PState::GLOBAL_FOLDER:
			if (c == '>')
				this->dump();
			else
				this->push_char(c);	
		break;	
		case PState::IDENT:
			if (is_letter(c) || is_number(c) || c == '_')
				this->push_char(c);
			else {
				this->check_keyword();
				this->dump();
				goto eval;
			}
			break;

		case PState::NUM:
			if (is_number(c))
				this->push_char(c);
			else if (c == '.'){
				if (this->current_token.type == crl::Token::Type::INT){
					this->current_token.type = crl::Token::Type::DEC; 
					this->push_char(c);	
				}else throw crl::SyntaxError(line, column, "Invalid numberic format"); 
			} else {
				this->dump();	
				goto eval;
			}
			break;

		case PState::SYMBOL:
			if (is_symbol(c)){
				if (this->parse_symbol(this->current_token.str + c)){
					if (this->state == PState::COMMENT) break;
					this->push_char(c);
				}else{
					if (this->parse_symbol(this->current_token.str)){
						if (this->state == PState::COMMENT) break;
						this->dump();
						goto eval;
					}else throw crl::SyntaxError(line, column, "Unkown symbol: " + this->current_token.str); 
				}
			}else if (this->parse_symbol(this->current_token.str)){
				if (this->state == PState::COMMENT) break;
				this->dump();
				goto eval;
			}else throw crl::SyntaxError(line, column, "Unkown symbol: " + this->current_token.str); 
			
			break;

		case PState::STRING:
			if (c == '\\'){
				this->push_char(c);
				this->str_spec = !this->str_spec;	 // SWITCH STR SPECIAL
			}else if (c == '"'){
				if (!this->str_spec){
					this->dump();
					break;	
				}else{
					this->current_token.str.pop_back();
					this->push_char(c);
					this->str_spec = false;
				}
			}else {
				this->push_char(c);
				this->str_spec = false;
			}
			break;
		case PState::CHAR:
			{
			size_t size = this->current_token.str.size();
			if (size == 0){
				if (c == '\'') throw crl::SyntaxError(line, column, "Empty char is not allowed"); 
				this->push_char(c);
			}else if (size == 1) {
				if (this->current_token.str[0] == '\\'){
					if (c == '\'') this->current_token.str.pop_back();
					this->push_char(c);
				}else{
					if (c != '\'') throw crl::SyntaxError(line, column, "Invalid char: " + this->current_token.str); 
					this->dump();
				}
			}else if (c != '\'') throw crl::SyntaxError(line, column, "Invalid char: " + this->current_token.str);
			else this->dump();
			}
			break;
		default:
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %esi, %r15d
movq %rdi, %rbx
pushq $0x1
popq %r14
cmpb $0xa, %r15b
jne 0x13d86
cmpl $0x1, 0x40(%rbx)
jne 0x13d6c
movl $0x39, 0x20(%rbx)
leaq 0x20c4(%rip), %rsi      # 0x15e20
movq %rbx, %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x13ca2
andl $0x0, 0x40(%rbx)
cmpl $0x6, 0x38(%rbx)
jne 0x13d7a
andl $0x0, 0x38(%rbx)
incl 0x30(%rbx)
andl $0x0, 0x34(%rbx)
movl %r14d, %eax
jmp 0x13d8b
movl 0x34(%rbx), %eax
incl %eax
movl %eax, 0x34(%rbx)
leal -0x30(%r15), %eax
movl %eax, -0x30(%rbp)
cmpb $0xa, %al
setb %r14b
movl %r15d, %eax
andb $-0x21, %al
addb $-0x41, %al
cmpb $0x1a, %al
setb %al
cmpb $0x5f, %r15b
sete %cl
orb %al, %cl
movb %cl, -0x29(%rbp)
orb %cl, %r14b
leaq 0x1fe3(%rip), %r13      # 0x15da0
movsbl %r15b, %r12d
movq %r12, -0x38(%rbp)
movq %r15, -0x40(%rbp)
movb %r14b, -0x2a(%rbp)
movl 0x38(%rbx), %eax
cmpq $0x8, %rax
ja 0x141a6
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
testb %r14b, %r14b
jne 0x1419b
movq %rbx, %rdi
callq 0x13ad8
jmp 0x13f02
cmpb $0x9, -0x30(%rbp)
jbe 0x1419b
cmpb $0x2e, %r15b
jne 0x13f02
jmp 0x1400d
movl %r12d, %edi
callq 0x14554
testb %al, %al
je 0x13eaf
movl %r14d, %r15d
leaq -0x1c0(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x146b3
movq %rbx, %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1371a
movl %eax, %r12d
movq %r14, %rdi
callq 0x3110
testb %r12b, %r12b
jne 0x14029
leaq -0x1a0(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x32f0
movq %r13, %rdi
movq %r14, %rsi
callq 0x1371a
movl %eax, %r12d
movq %r14, %rdi
callq 0x3110
testb %r12b, %r12b
je 0x1427b
movl %r15d, %r14d
movq %r13, %rbx
cmpl $0x6, 0x38(%r13)
movq -0x38(%rbp), %r12
movq -0x40(%rbp), %r15
leaq 0x1ef8(%rip), %r13      # 0x15da0
jne 0x13f02
jmp 0x141a6
movq %rbx, %r12
movq %r15, %rbx
leaq -0x180(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x32f0
movq %r12, %r14
movq %r12, %rdi
movq %r15, %rsi
callq 0x1371a
movl %eax, %r12d
movq %r15, %rdi
callq 0x3110
testb %r12b, %r12b
je 0x1421c
cmpl $0x6, 0x38(%r14)
movq -0x38(%rbp), %r12
movq %rbx, %r15
movq %r14, %rbx
movb -0x2a(%rbp), %r14b
je 0x141a6
movq %rbx, %rdi
callq 0x13ca2
jmp 0x13dcd
cmpl $0x22, %r12d
je 0x14040
cmpl $0x5c, %r12d
jne 0x1405a
pushq $0x5c
popq %rsi
movq %rbx, %rdi
callq 0x31f0
xorb $0x1, 0x3c(%rbx)
jmp 0x141a6
cmpl $0x3c, %r12d
je 0x1406e
cmpl $0x23, %r12d
jne 0x14087
cmpl $0x0, 0x40(%rbx)
jne 0x14338
movl $0x1, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq %rax, 0x24(%rbx)
movl $0x37, 0x20(%rbx)
leaq 0x1eb4(%rip), %rsi      # 0x15e26
movq %rbx, %rdi
callq 0x3450
jmp 0x1416c
cmpb $0x3e, %r15b
je 0x1416c
jmp 0x1419b
movq 0x8(%rbx), %rax
cmpq $0x1, %rax
je 0x140a9
testq %rax, %rax
jne 0x140cc
cmpb $0x27, %r15b
jne 0x1419b
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %ebx
leaq 0x1eab(%rip), %rsi      # 0x15e73
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x3be4
movb $0x1, %r12b
leaq -0xc0(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x4e38
xorl %r12d, %r12d
leaq 0x9d7f(%rip), %rsi      # 0x1dd78
leaq -0xf0c8(%rip), %rdx     # 0x4f38
movq %r14, %rdi
callq 0x33f0
jmp 0x14462
cmpl $0x13, 0x20(%rbx)
jne 0x142da
movl $0x14, 0x20(%rbx)
pushq $0x2e
popq %rsi
movq %rbx, %rdi
jmp 0x141a1
cmpl $0x6, 0x38(%r13)
movq -0x38(%rbp), %rsi
je 0x141a6
movq %r13, %rdi
jmp 0x141a1
cmpb $0x0, 0x3c(%rbx)
je 0x1416c
movq %rbx, %rdi
callq 0x32a0
pushq $0x22
popq %rsi
movq %rbx, %rdi
jmp 0x14060
movq %rbx, %rdi
movl %r12d, %esi
callq 0x31f0
movb $0x0, 0x3c(%rbx)
jmp 0x141a6
cmpl $0x1, 0x40(%rbx)
jne 0x14087
movl $0x8, 0x38(%rbx)
movl $0x38, 0x20(%rbx)
jmp 0x14158
cmpb $0x0, -0x29(%rbp)
je 0x1412f
cmpl $0x0, 0x40(%rbx)
jne 0x1409b
orl $-0x1, 0x40(%rbx)
pushq $0x1
popq %rax
movl %eax, 0x38(%rbx)
movl %eax, 0x20(%rbx)
jmp 0x1414d
movq (%rbx), %rax
cmpb $0x5c, (%rax)
jne 0x14162
cmpb $0x27, %r15b
jne 0x1419b
movq %rbx, %rdi
callq 0x32a0
jmp 0x1419b
cmpb $0x27, %r15b
je 0x1416c
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %r12d
leaq 0x1d9d(%rip), %rsi      # 0x15e8d
leaq -0x80(%rbp), %rdi
movq %rbx, %rdx
callq 0x3c55
movb $0x1, %r13b
leaq -0x80(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x4e38
xorl %r13d, %r13d
leaq 0x9c5d(%rip), %rsi      # 0x1dd78
leaq -0xf1ea(%rip), %rdx     # 0x4f38
movq %r14, %rdi
callq 0x33f0
jmp 0x14462
cmpb $0x9, -0x30(%rbp)
ja 0x14176
cmpl $0x0, 0x40(%rbx)
jne 0x1413f
orl $-0x1, 0x40(%rbx)
movl $0x2, 0x38(%rbx)
movl $0x13, 0x20(%rbx)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x31f0
movq 0x30(%rbx), %rax
movq %rax, 0x24(%rbx)
jmp 0x141a6
cmpb $0x27, %r15b
jne 0x14396
movq %rbx, %rdi
callq 0x13ca2
jmp 0x141a6
movl %r12d, %edi
callq 0x14554
testb %al, %al
je 0x141b8
cmpl $0x0, 0x40(%rbx)
jne 0x1418c
orl $-0x1, 0x40(%rbx)
movl $0x5, 0x38(%rbx)
movq 0x30(%rbx), %rax
movq %rax, 0x24(%rbx)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x31f0
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x27, %r12d
ja 0x143f2
movabsq $0x100002600, %rax      # imm = 0x100002600
btq %r12, %rax
jb 0x141a6
cmpq $0x22, %r12
je 0x141ff
cmpq $0x27, %r12
jne 0x143f2
cmpl $0x0, 0x40(%rbx)
jne 0x141ec
orl $-0x1, 0x40(%rbx)
movl $0x4, 0x38(%rbx)
movl $0x1b, 0x20(%rbx)
jmp 0x14158
cmpl $0x0, 0x40(%rbx)
jne 0x14209
orl $-0x1, 0x40(%rbx)
movl $0x3, 0x38(%rbx)
movl $0x1c, 0x20(%rbx)
jmp 0x14158
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r13
movl 0x30(%r14), %r15d
movl 0x34(%r14), %r12d
leaq 0x1c2d(%rip), %rsi      # 0x15e63
leaq -0xe0(%rbp), %rdi
movq %r14, %rdx
callq 0x3c55
movb $0x1, %r14b
leaq -0xe0(%rbp), %rcx
movq %r13, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x4e38
xorl %r14d, %r14d
leaq 0x9b11(%rip), %rsi      # 0x1dd78
leaq -0xf336(%rip), %rdx     # 0x4f38
movq %r13, %rdi
callq 0x33f0
jmp 0x14462
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r14
movl 0x30(%r13), %r15d
movl 0x34(%r13), %r12d
leaq 0x1bce(%rip), %rsi      # 0x15e63
leaq -0x100(%rbp), %rdi
movq %r13, %rdx
callq 0x3c55
movb $0x1, %r13b
leaq -0x100(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x4e38
xorl %r13d, %r13d
leaq 0x9ab2(%rip), %rsi      # 0x1dd78
leaq -0xf395(%rip), %rdx     # 0x4f38
movq %r14, %rdi
callq 0x33f0
jmp 0x14462
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %ebx
leaq 0x1b58(%rip), %rsi      # 0x15e4b
leaq -0x120(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x3be4
movb $0x1, %r12b
leaq -0x120(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x4e38
xorl %r12d, %r12d
leaq 0x9a54(%rip), %rsi      # 0x1dd78
leaq -0xf3f3(%rip), %rdx     # 0x4f38
movq %r14, %rdi
callq 0x33f0
jmp 0x14462
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %ebx
leaq 0x1ada(%rip), %rsi      # 0x15e2b
leaq -0x160(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x3be4
movb $0x1, %r12b
leaq -0x160(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x4e38
xorl %r12d, %r12d
leaq 0x99f6(%rip), %rsi      # 0x1dd78
leaq -0xf451(%rip), %rdx     # 0x4f38
movq %r14, %rdi
callq 0x33f0
jmp 0x14462
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %r12d
leaq 0x1add(%rip), %rsi      # 0x15e8d
leaq -0xa0(%rbp), %rdi
movq %rbx, %rdx
callq 0x3c55
movb $0x1, %r13b
leaq -0xa0(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x4e38
xorl %r13d, %r13d
leaq 0x9997(%rip), %rsi      # 0x1dd78
leaq -0xf4b0(%rip), %rdx     # 0x4f38
movq %r14, %rdi
callq 0x33f0
jmp 0x14462
pushq $0x50
popq %rdi
callq 0x3140
movq %rax, %r15
movq %r12, %rdx
movl 0x30(%rbx), %r12d
movl 0x34(%rbx), %ebx
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x60(%rbp), %rdi
pushq $0x1
popq %rsi
callq 0x3290
leaq 0x1a16(%rip), %rsi      # 0x15e38
leaq -0x140(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x3dc5
movb $0x1, %r14b
leaq -0x140(%rbp), %rcx
movq %r15, %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x4e38
xorl %r14d, %r14d
leaq 0x9925(%rip), %rsi      # 0x1dd78
leaq -0xf522(%rip), %rdx     # 0x4f38
movq %r15, %rdi
callq 0x33f0
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x3110
jmp 0x14479
movq %rax, %rbx
movb $0x1, %r14b
leaq -0x60(%rbp), %rdi
callq 0x3110
testb %r14b, %r14b
jne 0x1448f
jmp 0x1454c
movq %rax, %rbx
movq %r15, %rdi
jmp 0x1451e
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0x144ee
jmp 0x144fa
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
jmp 0x144ee
jmp 0x144fa
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
jmp 0x144d6
jmp 0x144fa
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
jmp 0x144d6
jmp 0x144fa
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x3110
testb %r12b, %r12b
jne 0x144fd
jmp 0x1454c
jmp 0x144fa
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
callq 0x3110
testb %r13b, %r13b
jne 0x144fd
jmp 0x1454c
movq %rax, %rbx
movq %r14, %rdi
jmp 0x1451e
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x3110
testb %r14b, %r14b
jne 0x1451b
jmp 0x1454c
movq %rax, %rbx
movq %r13, %rdi
callq 0x31b0
jmp 0x1454c
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
jmp 0x14547
movq %rax, %rbx
leaq -0x1c0(%rbp), %rdi
jmp 0x14547
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3410