// File: /workspace/github_cpp_makefile_star2_O3/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 $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
movq %rsi, -0x40(%rbp)
cmpb $0xa, %sil
jne 0x19afa
cmpl $0x1, 0x40(%rbx)
jne 0x19ad5
movl $0x39, 0x20(%rbx)
movq 0x8(%rbx), %rdx
leaq 0x23a3(%rip), %rcx      # 0x1be60
movl $0x5, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3340
movq %rbx, %rdi
callq 0x199e6
movl $0x0, 0x40(%rbx)
cmpl $0x6, 0x38(%rbx)
jne 0x19ae9
movl $0x0, 0x38(%rbx)
incl 0x30(%rbx)
movl $0x0, 0x34(%rbx)
movl $0x1, %eax
jmp 0x19aff
movl 0x34(%rbx), %eax
incl %eax
movl %eax, 0x34(%rbx)
leaq -0x78(%rbp), %r15
movq -0x40(%rbp), %rcx
leal -0x30(%rcx), %eax
movl %eax, -0x44(%rbp)
cmpb $0xa, %al
setb %sil
movl %ecx, %eax
andb $-0x21, %al
addb $-0x41, %al
cmpb $0x1a, %al
setb %al
cmpb $0x5f, %cl
sete %dl
orb %al, %dl
movb %dl, -0x29(%rbp)
orb %dl, %sil
movb %sil, -0x2a(%rbp)
leaq 0x22a6(%rip), %r12      # 0x1bde0
movsbl %cl, %eax
movq %rax, -0x38(%rbp)
movl 0x38(%rbx), %eax
cmpq $0x8, %rax
ja 0x19f5a
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
cmpb $0x0, -0x2a(%rbp)
jne 0x19e96
movq %rbx, %rdi
callq 0x197de
jmp 0x19cb5
cmpb $0x9, -0x44(%rbp)
jbe 0x19e96
cmpb $0x2e, -0x40(%rbp)
jne 0x19cb5
jmp 0x19de5
movq -0x38(%rbp), %r13
movl %r13d, %edi
callq 0x1a43f
testb %al, %al
je 0x19c59
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x4d52
movq -0x60(%rbp), %rsi
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
movl %r13d, %r8d
callq 0x3420
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19382
leaq -0x98(%rbp), %r14
movl %eax, %r13d
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x19bfd
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r13b, %r13b
jne 0x19e03
movq %r14, -0xa8(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %r13
movq %r13, %rdi
callq 0x4d52
movq %rbx, %rdi
movq %r13, %rsi
callq 0x19382
movl %eax, %r13d
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x19c4f
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r13b, %r13b
jne 0x19cab
jmp 0x1a06e
movq %r15, %r14
movq %r15, -0x88(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %r13
movq %r13, %rdi
callq 0x4d52
movq %rbx, %rdi
movq %r13, %rsi
callq 0x19382
movl %eax, %r13d
movq -0x88(%rbp), %rdi
cmpq %r14, %rdi
je 0x19ca2
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r13b, %r13b
je 0x1a00d
cmpl $0x6, 0x38(%rbx)
je 0x19f5a
movq %rbx, %rdi
callq 0x199e6
jmp 0x19b41
movq -0x38(%rbp), %rsi
cmpl $0x22, %esi
je 0x19e12
movq %rbx, %rdi
cmpl $0x5c, %esi
jne 0x19e2e
movl $0x5c, %esi
callq 0x31f0
xorb $0x1, 0x3c(%rbx)
jmp 0x19f5a
cmpb $0x3e, -0x40(%rbp)
jne 0x19e96
jmp 0x19f52
movq -0x38(%rbp), %r14
cmpl $0x3c, %r14d
je 0x19e3c
cmpl $0x23, %r14d
jne 0x19e55
cmpl $0x0, 0x40(%rbx)
jne 0x1a13e
movl $0x1, 0x40(%rbx)
movq 0x8(%rbx), %rdx
movq 0x30(%rbx), %rax
movq %rax, 0x24(%rbx)
movl $0x37, 0x20(%rbx)
leaq 0x2126(%rip), %rcx      # 0x1be66
movl $0x4, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3340
jmp 0x19f52
movq 0x8(%rbx), %rax
cmpq $0x1, %rax
je 0x19e7c
testq %rax, %rax
jne 0x19ea7
cmpb $0x27, -0x40(%rbp)
jne 0x19e96
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %ebx
leaq -0xd8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2116(%rip), %rsi      # 0x1beb3
leaq 0x2128(%rip), %rdx      # 0x1becc
leaq -0xe8(%rbp), %rdi
callq 0x4336
movb $0x1, %r13b
leaq -0xe8(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8f8f(%rip), %rsi      # 0x22d60
leaq -0x147f2(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x1a288
cmpl $0x13, 0x20(%rbx)
jne 0x1a0cf
movl $0x14, 0x20(%rbx)
movq %rbx, %rdi
movl $0x2e, %esi
jmp 0x19e9d
cmpl $0x6, 0x38(%rbx)
jne 0x19e96
jmp 0x19f5a
cmpb $0x0, 0x3c(%rbx)
je 0x19f52
movq %rbx, %rdi
callq 0x32a0
movq %rbx, %rdi
movl $0x22, %esi
jmp 0x19e2e
callq 0x31f0
movb $0x0, 0x3c(%rbx)
jmp 0x19f5a
cmpl $0x1, 0x40(%rbx)
jne 0x19e55
movl $0x8, 0x38(%rbx)
movl $0x38, 0x20(%rbx)
jmp 0x19f3e
cmpb $0x0, -0x29(%rbp)
je 0x19f12
cmpl $0x0, 0x40(%rbx)
jne 0x19e6c
movl $0xffffffff, 0x40(%rbx) # imm = 0xFFFFFFFF
movl $0x1, %eax
movl %eax, 0x38(%rbx)
movl %eax, 0x20(%rbx)
jmp 0x19f33
movq (%rbx), %rax
cmpb $0x5c, (%rax)
jne 0x19f48
cmpb $0x27, -0x40(%rbp)
jne 0x19e96
movq %rbx, %rdi
callq 0x32a0
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0x31f0
jmp 0x19f5a
cmpb $0x27, -0x40(%rbp)
je 0x19f52
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %r12d
leaq 0x2000(%rip), %rsi      # 0x1becd
leaq -0x148(%rbp), %rdi
movq %rbx, %rdx
callq 0x40f1
movb $0x1, %r13b
leaq -0x148(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8e62(%rip), %rsi      # 0x22d60
leaq -0x1491f(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x1a288
cmpb $0x9, -0x44(%rbp)
ja 0x19f6c
cmpl $0x0, 0x40(%rbx)
jne 0x19f25
movl $0xffffffff, 0x40(%rbx) # imm = 0xFFFFFFFF
movl $0x2, 0x38(%rbx)
movl $0x13, 0x20(%rbx)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x31f0
movq 0x30(%rbx), %rax
movq %rax, 0x24(%rbx)
jmp 0x19f5a
cmpb $0x27, -0x40(%rbp)
jne 0x1a1ad
movq %rbx, %rdi
callq 0x199e6
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %edi
callq 0x1a43f
testb %al, %al
je 0x19f9f
cmpl $0x0, 0x40(%rbx)
jne 0x19f85
movl $0xffffffff, 0x40(%rbx) # imm = 0xFFFFFFFF
movl $0x5, 0x38(%rbx)
movq 0x30(%rbx), %rax
movq %rax, 0x24(%rbx)
movq %rbx, %rdi
movl %r14d, %esi
jmp 0x19e9d
cmpl $0x27, %r14d
ja 0x1a20b
movabsq $0x100002600, %rax      # imm = 0x100002600
btq %r14, %rax
jb 0x19f5a
movq -0x38(%rbp), %r14
cmpq $0x22, %r14
je 0x19fed
cmpq $0x27, %r14
jne 0x1a20b
cmpl $0x0, 0x40(%rbx)
jne 0x19fda
movl $0xffffffff, 0x40(%rbx) # imm = 0xFFFFFFFF
movl $0x4, 0x38(%rbx)
movl $0x1b, 0x20(%rbx)
jmp 0x19f3e
cmpl $0x0, 0x40(%rbx)
jne 0x19ffa
movl $0xffffffff, 0x40(%rbx) # imm = 0xFFFFFFFF
movl $0x3, 0x38(%rbx)
movl $0x1c, 0x20(%rbx)
jmp 0x19f3e
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %r12d
leaq 0x1e7a(%rip), %rsi      # 0x1bea3
leaq -0x188(%rbp), %rdi
movq %rbx, %rdx
callq 0x40f1
movb $0x1, %r13b
leaq -0x188(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8d06(%rip), %rsi      # 0x22d60
leaq -0x14a7b(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x1a288
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %r12d
leaq 0x1e19(%rip), %rsi      # 0x1bea3
leaq -0x1a8(%rbp), %rdi
movq %rbx, %rdx
callq 0x40f1
movb $0x1, %r13b
leaq -0x1a8(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8ca5(%rip), %rsi      # 0x22d60
leaq -0x14adc(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x1a288
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %ebx
leaq -0xf8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d95(%rip), %rsi      # 0x1be8b
leaq 0x1da5(%rip), %rdx      # 0x1bea2
leaq -0x108(%rbp), %rdi
callq 0x4336
movb $0x1, %r13b
leaq -0x108(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8c36(%rip), %rsi      # 0x22d60
leaq -0x14b4b(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x1a288
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %ebx
leaq -0x118(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d06(%rip), %rsi      # 0x1be6b
leaq 0x1d0b(%rip), %rdx      # 0x1be77
leaq -0x128(%rbp), %rdi
callq 0x4336
movb $0x1, %r13b
leaq -0x128(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8bc7(%rip), %rsi      # 0x22d60
leaq -0x14bba(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x1a288
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
movl 0x30(%rbx), %r15d
movl 0x34(%rbx), %r12d
leaq 0x1d04(%rip), %rsi      # 0x1becd
leaq -0x168(%rbp), %rdi
movq %rbx, %rdx
callq 0x40f1
movb $0x1, %r13b
leaq -0x168(%rbp), %rcx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8b66(%rip), %rsi      # 0x22d60
leaq -0x14c1b(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x1a288
movl $0x50, %edi
callq 0x3120
movq %r14, %rdx
movq %rax, %r15
movl 0x30(%rbx), %r12d
movl 0x34(%rbx), %ebx
leaq -0xb8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq -0xc8(%rbp), %rdi
movl $0x1, %esi
callq 0x3290
leaq 0x1c33(%rip), %rsi      # 0x1be78
leaq -0x1c8(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x1a5f8
movb $0x1, %r13b
leaq -0x1c8(%rbp), %rcx
movq %r15, %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x5414
xorl %r13d, %r13d
leaq 0x8ae7(%rip), %rsi      # 0x22d60
leaq -0x14c9a(%rip), %rdx    # 0x55e6
movq %r15, %rdi
callq 0x33d0
movq %rax, %rbx
leaq -0x1b8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a2aa
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1a2c5
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r13b, %r13b
jne 0x1a2f2
jmp 0x1a437
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1a2f2
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x1a2f2
movq %rax, %rbx
movq %r15, %rdi
jmp 0x1a3e5
movq %rax, %rbx
leaq -0x158(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a3d8
movq -0x158(%rbp), %rsi
jmp 0x1a3d0
jmp 0x1a3df
movq %rax, %rbx
leaq -0x138(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a3d8
movq -0x138(%rbp), %rsi
jmp 0x1a3d0
jmp 0x1a3df
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r12, %rdi
je 0x1a3d8
movq -0xd8(%rbp), %rsi
jmp 0x1a3d0
jmp 0x1a3df
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r12, %rdi
je 0x1a3d8
movq -0x118(%rbp), %rsi
jmp 0x1a3d0
jmp 0x1a3df
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r12, %rdi
je 0x1a3d8
movq -0xf8(%rbp), %rsi
jmp 0x1a3d0
jmp 0x1a3df
movq %rax, %rbx
leaq -0x198(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a3d8
movq -0x198(%rbp), %rsi
jmp 0x1a3d0
jmp 0x1a3df
movq %rax, %rbx
leaq -0x178(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a3d8
movq -0x178(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r13b, %r13b
jne 0x1a3e2
jmp 0x1a437
movq %rax, %rbx
movq %r14, %rdi
callq 0x31a0
jmp 0x1a437
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1a437
movq -0x98(%rbp), %rsi
jmp 0x1a42f
jmp 0x1a406
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x1a437
movq -0x58(%rbp), %rsi
jmp 0x1a42f
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r14, %rdi
je 0x1a437
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x33f0