// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rax
cmpq %rax, 0x40(%rdi)
jbe 0x473a
movq 0x38(%rbx), %rcx
movsbl (%rcx,%rax), %edi
movb %dil, 0x60(%rbx)
testl %edi, %edi
je 0x473e
callq 0x31c0
testl %eax, %eax
je 0x4760
pushq $0x28
popq %rdi
callq 0x3230
movq %rax, %rbx
pushq $0x2
popq %rsi
movq %rax, %rdi
callq 0x55f8
jmp 0x4754
movb $0x0, 0x60(%rbx)
pushq $0x28
popq %rdi
callq 0x3230
movq %rax, %rbx
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x55f8
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movb 0x60(%rbx), %al
cmpb $0x2f, %al
jne 0x478e
movq 0x58(%rbx), %rcx
incq %rcx
cmpq %rcx, 0x40(%rbx)
jbe 0x47d7
movq 0x38(%rbx), %rdx
cmpb $0x2f, (%rdx,%rcx)
jne 0x47d7
movq %rbx, %rdi
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x48e4
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x41, %cl
cmpb $0x19, %cl
ja 0x47ab
movq %rbx, %rdi
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4952
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x47c3
movq %rbx, %rdi
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4afc
cmpb $0x22, %al
jne 0x47d7
movq %rbx, %rdi
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4c00
leaq 0x10(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movsbl %al, %edx
movq %rsp, %rdi
pushq $0x1
popq %rsi
callq 0x3260
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x32b0
leaq 0x20(%rsp), %rdi
callq 0x568e
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x3130
cmpl $0x2, %ebp
jne 0x4876
movq 0x167b3(%rip), %rdi     # 0x1afd0
leaq 0xca16(%rip), %rsi      # 0x1123a
callq 0x3220
movsbl 0x60(%rbx), %esi
movq %rax, %rdi
callq 0x3270
leaq 0xca09(%rip), %rsi      # 0x11245
movq %rax, %rdi
callq 0x3220
movq %rsp, %rsi
movq %rax, %rdi
callq 0x3200
leaq 0xcdc0(%rip), %rsi      # 0x11616
movq %rax, %rdi
callq 0x3220
pushq $0x28
popq %rdi
callq 0x3230
movq %rax, %rbx
pushq $0x2
popq %rsi
movq %rax, %rdi
callq 0x55f8
jmp 0x4881
movq %rbx, %rdi
callq 0x4d2c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3130
jmp 0x4754
movq %rax, %r14
movq %rbx, %rdi
callq 0x3210
jmp 0x48b4
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x3130
jmp 0x48b4
movq %rax, %r14
jmp 0x48c9
jmp 0x48be
movq %rax, %r14
movq %rsp, %rdi
callq 0x3130
jmp 0x48c9
movq %rax, %r14
movq %rbx, %rdi
callq 0x3210
movq %r14, %rdi
callq 0x3390
nop