// File: /workspace/github_cpp_makefile_star2_O3/kram[P]kram/./src/lexer/lexer.cpp
// Function: lexer::Lexer::next()
Token* Lexer::next() {
	this->current = this->char_at_pos(this->index);

	// End of row
	if (this->current == '\0') {
		return new Token(Type::T_EOL);
	}

	// Ignore Whitespace
	if (iswspace(this->current)) {
		return new Token(Type::IGNORE);
	}

	// Comments
	if (this->current == '/' && this->char_at_pos(this->index+1) == '/') {
		return this->comment();
	}

	// Names
	// Begins with a char a-Z
	if ((this->current >= 'a' && this->current <= 'z') || (this->current >= 'A' && this->current <= 'Z')) {
		return this->name();
	}

	// Numbers
	if (this->current >= '0' && this->current <= '9') {
		return this->number();
	}

	// Strings
	if (this->current == '\"') {
		return this->string();
	}

	// Operators
	std::string str(1, this->current);
	if (Token::Trans(str) != Type::IGNORE) {
		return this->oper();
	}

	std::cout << "Ignoring: " << this->current << "(" << str << ")\n";

	return new Token(Type::IGNORE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rax
cmpq %rax, 0x40(%rdi)
jbe 0x4cd0
movq 0x38(%rbx), %rcx
movsbl (%rcx,%rax), %edi
movb %dil, 0x60(%rbx)
testl %edi, %edi
je 0x4cd4
callq 0x31c0
testl %eax, %eax
je 0x4cfe
movl $0x28, %edi
callq 0x3260
movq %rax, %rbx
movq %rax, %rdi
movl $0x2, %esi
callq 0x5ce6
jmp 0x4cee
movb $0x0, 0x60(%rbx)
movl $0x28, %edi
callq 0x3260
movq %rax, %rbx
movq %rax, %rdi
movl $0x1, %esi
callq 0x5ce6
movq %rbx, %rax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb 0x60(%rbx), %al
cmpb $0x2f, %al
jne 0x4d30
movq 0x58(%rbx), %rcx
incq %rcx
cmpq %rcx, 0x40(%rbx)
jbe 0x4d85
movq 0x38(%rbx), %rdx
cmpb $0x2f, (%rdx,%rcx)
jne 0x4d85
movq %rbx, %rdi
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4eec
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x41, %cl
cmpb $0x19, %cl
ja 0x4d51
movq %rbx, %rdi
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4f5e
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x4d6d
movq %rbx, %rdi
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5172
cmpb $0x22, %al
jne 0x4d85
movq %rbx, %rdi
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x52a4
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
movsbl %al, %edx
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x32b0
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x473c
leaq 0x30(%rsp), %rdi
callq 0x5daa
movl %eax, %ebp
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x4ddc
callq 0x3230
cmpl $0x2, %ebp
jne 0x4e71
movq 0x161e4(%rip), %rdi     # 0x1afd0
leaq 0xd4ff(%rip), %rsi      # 0x122f2
movl $0xa, %edx
callq 0x32a0
movb 0x60(%rbx), %al
leaq 0xf(%rsp), %rsi
movb %al, (%rsi)
movq 0x161c2(%rip), %rdi     # 0x1afd0
movl $0x1, %edx
callq 0x32a0
movq %rax, %rbx
leaq 0xd4db(%rip), %rsi      # 0x122fd
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x32a0
leaq 0xd882(%rip), %rsi      # 0x126ca
movl $0x2, %edx
movq %rax, %rdi
callq 0x32a0
movl $0x28, %edi
callq 0x3260
movq %rax, %rbx
movq %rax, %rdi
movl $0x2, %esi
callq 0x5ce6
jmp 0x4e7c
movq %rbx, %rdi
callq 0x53fe
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x4cee
callq 0x3230
jmp 0x4cee
movq %rax, %r14
movq %rbx, %rdi
jmp 0x4ea9
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x4eba
callq 0x3230
jmp 0x4eba
movq %rax, %r14
jmp 0x4ed1
jmp 0x4ec6
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
jne 0x4ecc
jmp 0x4ed1
movq %rax, %r14
movq %rbx, %rdi
callq 0x3230
movq %r14, %rdi
callq 0x33c0
nop