// File: /workspace/github_cpp_makefile_star2_O2/iamlouk[P]asbi/src/tokenizer.cc
// Function: tok::Tokenizer::next()
Token Tokenizer::next() {
	if (tokbuffed) {
		tokbuffed = false;
		return tokbuf;
	}

	if (pos >= source.length())
		return Token(EOFTok, line);

	char c = source[pos];
	switch (c) {
	case '\n':
		line += 1;
	case ' ': case '\t': case '\v':
		pos++;
		return next();
	case '#':
		while (pos < source.length() && source[pos] != '\n') pos++;
		line++;
		pos++;
		return next();
	case '"':
	case '\'':
		return next_string(c);
	case '(':
		pos++;
		return Token(LeftBracket, line);
	case ')':
		pos++;
		return Token(RightBracket, line);
	case '{':
		pos++;
		return Token(LeftCurlyBracket, line);
	case '}':
		pos++;
		return Token(RightCurlyBracket, line);
	case '[':
		pos++;
		return Token(LeftSquareBracket, line);
	case ']':
		pos++;
		return Token(RightSquareBracket, line);
	case '-':
		pos++;
		if (pos < source.length() && source[pos] == '>') {
			pos++;
			return Token(Arrow, line);
		}
		return Token(Minus, line);
	case '+':
		pos++;
		return Token(Plus, line);
	case '*':
		pos++;
		return Token(Mul, line);
	case '/':
		pos++;
		if (pos < source.length() && source[pos] == '/') {
			while (pos < source.length() && source[pos] != '\n') pos++;
			line++;
			pos++;
			return next();
		}
		if (pos < source.length() && source[pos] == '*') {
			pos++;
			while (pos + 1 < source.length() && !(source[pos] == '*' && source[pos + 1] == '/')) {
				if (source[pos++] == '\n') {
					line++;
				}
			}
			pos += 2;
			return next();
		}
		return Token(Div, line);
	case '!':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(EqualsNot, line);
		}
		return Token(Not, line);
	case '=':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(Equals, line);
		}
		return Token(Assign, line);
	case '|':
		pos++;
		return Token(Or, line);
	case '&':
		pos++;
		return Token(And, line);
	case ',':
		pos++;
		return Token(Comma, line);
	case ':':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(Declare, line);
		}
		if (pos < source.length() && source[pos] == ':') {
			pos++;
			return Token(DoubleColon, line);
		}
		return Token(Colon, line);
	case '<':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(SmallerOrEqual, line);
		}
		return Token(Smaller, line);
	case '>':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(BiggerOrEqual, line);
		}
		return Token(Bigger, line);
	case ';':
		pos++;
		return Token(Semicolon, line);
	case '.':
		pos++;
		return Token(Dot, line);
	case '~':
		pos++;
		return Token(KeyValue, line);
	default:
		if ('0' <= c && c <= '9')
			return next_number();

		if (!is_identifier(c))
			throw utils::tokenizer_error("unkown char", line, source[pos]);

		std::string* str = new std::string("");
		while (pos < source.length()) {
			char c = source[pos];
			if (!is_identifier(c))
				break;

			*str += c;
			pos++;
		}

		auto mappos = keywords.find(*str);
		if (mappos == keywords.end()) {
			return Token(Identifier, str, line);
		} else {
			delete str;
			mappos->second.line = line;
			return mappos->second;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x28(%rdi)
jne 0x66d9
movb $0x0, 0x28(%rbx)
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %r14
movq %rax, %rcx
shrq $0x20, %rcx
jmp 0x6726
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movq 0x8(%rcx), %rdx
cmpq %rdx, %rax
jae 0x671d
movq (%rcx), %rcx
movb (%rcx,%rax), %sil
movzbl %sil, %edi
leal -0x9(%rdi), %r8d
cmpl $0x35, %r8d
ja 0x6767
leaq 0xdbbb(%rip), %rdi      # 0x142c0
movslq (%rdi,%r8,4), %r8
addq %rdi, %r8
jmpq *%r8
movsbl %sil, %esi
movq %rbx, %rdi
callq 0x649c
jmp 0x675f
movl 0x8(%rbx), %ecx
pushq $0x25
popq %rax
xorl %r14d, %r14d
shlq $0x20, %rcx
movl %eax, %eax
orq %rcx, %rax
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0xa, (%rcx,%rax)
je 0x674e
incq %rax
movq %rax, (%rbx)
cmpq %rdx, %rax
jb 0x673d
incl 0x8(%rbx)
incq %rax
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x66b4
movq %rdx, %r14
jmp 0x66d0
leal -0x7b(%rdi), %ecx
cmpl $0x3, %ecx
ja 0x678c
leaq 0xdc22(%rip), %rdx      # 0x14398
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x19
jmp 0x6722
cmpl $0x5b, %edi
je 0x6986
cmpl $0x5d, %edi
jne 0x67aa
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x1c
jmp 0x6722
leal -0x30(%rsi), %eax
cmpb $0x9, %al
ja 0x6a0c
movq %rbx, %rdi
callq 0x65a8
jmp 0x675f
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x1d
jmp 0x6722
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x69f8
movzbl (%rcx,%rsi), %edi
cmpl $0x2a, %edi
je 0x6ad4
cmpl $0x2f, %edi
jne 0x69f8
cmpq %rdx, %rsi
jae 0x6ac6
cmpb $0xa, (%rcx,%rsi)
je 0x6ac6
incq %rsi
movq %rsi, (%rbx)
jmp 0x67f5
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x20
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x17
jmp 0x6722
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x69c6
cmpb $0x3e, (%rcx,%rsi)
jne 0x69c6
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0xc
jmp 0x6722
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x69d0
cmpb $0x3d, (%rcx,%rsi)
jne 0x69d0
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x12
jmp 0x6722
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6a02
movzbl (%rcx,%rsi), %ecx
cmpl $0x3a, %ecx
je 0x6b16
cmpl $0x3d, %ecx
jne 0x6a02
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x7
jmp 0x6722
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x69da
cmpb $0x3d, (%rcx,%rsi)
jne 0x69da
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0xf
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x18
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x16
jmp 0x6722
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x69e4
cmpb $0x3d, (%rcx,%rsi)
jne 0x69e4
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x13
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0xa
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x8
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x1e
jmp 0x6722
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x69ee
cmpb $0x3d, (%rcx,%rsi)
jne 0x69ee
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0xe
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x1b
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x1a
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0xd
jmp 0x6722
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x15
jmp 0x6722
movl 0x8(%rbx), %ecx
pushq $0x9
jmp 0x6722
movl 0x8(%rbx), %ecx
pushq $0x10
jmp 0x6722
movl 0x8(%rbx), %ecx
pushq $0x14
jmp 0x6722
movl 0x8(%rbx), %ecx
pushq $0x11
jmp 0x6722
movl 0x8(%rbx), %ecx
pushq $0x6
jmp 0x6722
movl 0x8(%rbx), %ecx
pushq $0xb
jmp 0x6722
movl 0x8(%rbx), %ecx
pushq $0x1f
jmp 0x6722
movsbl %sil, %edi
callq 0x6b8b
testb %al, %al
je 0x6b27
pushq $0x20
popq %rdi
callq 0x5390
movq %rax, %r14
leaq 0xd6d5(%rip), %rsi      # 0x14104
leaq 0x7(%rsp), %rdx
movq %rax, %rdi
callq 0x60ee
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
cmpq 0x8(%rcx), %rax
jae 0x6a70
movq (%rcx), %rcx
movsbl (%rcx,%rax), %ebp
movl %ebp, %edi
callq 0x6b8b
testb %al, %al
je 0x6a70
movq %r14, %rdi
movl %ebp, %esi
callq 0x5300
movq (%rbx), %rax
incq %rax
movq %rax, (%rbx)
jmp 0x6a3f
leaq 0x198f9(%rip), %rdi     # 0x20370
movq %r14, %rsi
callq 0x78d4
movq %rax, %r15
leaq 0x198ef(%rip), %rax     # 0x20378
cmpq %rax, %r15
je 0x6abc
movq %r14, %rdi
callq 0x5170
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x53a0
movl 0x8(%rbx), %eax
movl %eax, 0x44(%r15)
movq 0x40(%r15), %rax
movq %rax, %rcx
shrq $0x20, %rcx
movq 0x48(%r15), %r14
jmp 0x6726
movl 0x8(%rbx), %ecx
xorl %eax, %eax
jmp 0x6726
incl 0x8(%rbx)
incq %rsi
movq %rsi, (%rbx)
jmp 0x6757
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %esi
movq %rax, %rdi
leaq 0x1(%rdi), %rax
cmpq %rdx, %rax
jae 0x6b0a
cmpb $0x2a, (%rcx,%rdi)
jne 0x6af7
cmpb $0x2f, 0x1(%rcx,%rdi)
je 0x6b0a
movq %rax, (%rbx)
cmpb $0xa, (%rcx,%rdi)
movq %rax, %rdi
jne 0x6ae1
incl %esi
movl %esi, 0x8(%rbx)
jmp 0x6ade
addq $0x2, %rdi
movq %rdi, (%rbx)
jmp 0x6757
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
pushq $0x21
jmp 0x6722
pushq $0x38
popq %rdi
callq 0x51b0
movq %rax, %r14
movl 0x8(%rbx), %edx
movq 0x10(%rbx), %rax
movq (%rbx), %rcx
movq (%rax), %rax
movsbl (%rax,%rcx), %ecx
leaq 0xd91c(%rip), %rsi      # 0x14466
movq %r14, %rdi
callq 0x9d44
leaq 0x189d7(%rip), %rsi     # 0x1f530
leaq 0x4c2(%rip), %rdx       # 0x7022
movq %r14, %rdi
callq 0x55f0
movq %rax, %rbx
movq %r14, %rdi
callq 0x5290
jmp 0x6b83
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x53a0
movq %rbx, %rdi
callq 0x5600