// File: /workspace/github_cpp_makefile_star2_O1/CoinXu[P]reviser-compiler/src/tokenizer.cpp
// Function: reviser::compiler::Tokenizer::Next()
bool Tokenizer::Next() {
  previous = current;

  if (pos >= input.size()) {
    current.type = TOKEN_CODE_END;
    current.text = "";
    return false;
  }

  ConsumeCharacters<Whitespace>();
  ConsumeComment();

  current.text = peek;

  int start_line = line;
  int start_column = column;
  int start_pos = pos;

  switch (peek) {
    case EOF:
      current.type = TOKEN_CODE_END;
      current.text = "";
      break;

    case TOKEN_ASSIGN:
    case TOKEN_LEFT_BRACE:
    case TOKEN_RIGHT_BRACE:
    case TOKEN_SEMICOLON:
    case TOKEN_COMMA:
    case TOKEN_CONNECTION:
    case TOKEN_LEFT_BRACKET:
    case TOKEN_RIGHT_BRACKET:
      current.type = (TokenType)peek;
      NextChar();
      break;

    case TOKEN_QUOTE:
      current.type = TOKEN_LETTER;
      NextChar();
      TryConsumeCharacters<CharQuote>();
      NextChar();
      current.text = input.substr(start_pos, pos - start_pos - 2);
      break;

    case TOKEN_PLUS:
    case TOKEN_HYPHEN:
      current.type = TOKEN_DIGIT;
      NextChar();
      ConsumeNumber();
      current.text = input.substr(start_pos - 1, pos - start_pos);
      break;

    default:
      if (InCharacters<CharDigit>()) {
        current.type = TOKEN_DIGIT;
        ConsumeNumber();
        current.text = input.substr(start_pos - 1, pos - start_pos);
      } else if (InCharacters<Identifier>()) {
        ConsumeCharacters<Identifier>();
        current.text = input.substr(start_pos - 1, pos - start_pos);

        if (TypeIdentifier(current.text)) {
          current.type = TOKEN_DATA_TYPE;
        } else if (DecoraterIdentifier(current.text)) {
          current.type = TOKEN_DECORATER;
        } else if (current.text == ReservedWordMap[RESERVED_STRUCT]) {
          current.type = TOKEN_STRUCT;
        } else if (current.text == ReservedWordMap[RESERVED_ENUM]) {
          current.type = TOKEN_ENUM;
        } else {
          current.type = TOKEN_ID;
        }
      } else {
        TryConsumeCharacters<NewLine>();
        const string content = input.substr(start_pos - 1,  pos - start_pos);
        message.Runtime("unkown token error: \n  " + content + "\n  ^");
      }
  }

  current.start_line = start_line;
  current.end_line = line;
  current.column_start = start_column;
  current.column_end = column - 1;
  current.pos_start = start_pos;
  current.pos_end = pos;

  return current.type != TOKEN_CODE_END;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movl 0x78(%rdi), %eax
movl %eax, 0xb8(%rdi)
addq $0xc0, %rdi
leaq 0x80(%rbx), %r14
movq %r14, %rsi
callq 0x25210
movq 0xb0(%rbx), %rax
movq %rax, 0xf0(%rbx)
movups 0xa0(%rbx), %xmm0
movups %xmm0, 0xe0(%rbx)
movslq 0xfc(%rbx), %rax
cmpq %rax, 0x8(%rbx)
jbe 0x3099d
movzbl 0xf8(%rbx), %eax
leal -0x9(%rax), %ecx
cmpl $0x5, %ecx
jae 0x3091c
movq %rbx, %rdi
callq 0x30114
jmp 0x30903
cmpl $0x20, %eax
je 0x30912
movq %rbx, %rdi
callq 0x3026c
movsbl 0xf8(%rbx), %r8d
movq 0x88(%rbx), %rdx
movl $0x1, %ecx
movq %r14, %rdi
xorl %esi, %esi
callq 0x25620
movl 0xfc(%rbx), %r13d
movl 0x100(%rbx), %ecx
movl 0x104(%rbx), %r12d
movslq %r13d, %r15
movzbl 0xf8(%rbx), %eax
cmpl $0x3a, %eax
movl %ecx, -0x2c(%rbp)
jle 0x309c6
cmpl $0x7a, %eax
jg 0x30a0f
movl %eax, %ecx
addl $-0x3b, %ecx
cmpl $0x22, %ecx
ja 0x30b21
movabsq $0x500000005, %rdx      # imm = 0x500000005
btq %rcx, %rdx
jb 0x30a48
jmp 0x30b21
movl $0x9, 0x78(%rbx)
movq 0x88(%rbx), %rdx
leaq 0x211a2(%rip), %rcx     # 0x51b54
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x25530
jmp 0x30b0d
leal -0x2b(%rax), %ecx
cmpl $0x3, %ecx
ja 0x30a58
leaq 0x1fdaf(%rip), %rdx     # 0x50788
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl %r12d, -0x30(%rbp)
movl $0x6, 0x78(%rbx)
movq %rbx, %rdi
callq 0x30114
movq %rbx, %rdi
callq 0x30326
movslq 0xfc(%rbx), %rcx
subq %r15, %rcx
decq %r15
jmp 0x30a94
cmpl $0x7b, %eax
je 0x30a48
cmpl $0x7d, %eax
je 0x30a48
cmpl $0xff, %eax
jne 0x30b21
movl $0x9, 0x78(%rbx)
movq 0x88(%rbx), %rdx
leaq 0x2111b(%rip), %rcx     # 0x51b54
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x25530
jmp 0x30ac7
movsbl %al, %eax
movl %eax, 0x78(%rbx)
movq %rbx, %rdi
callq 0x30114
jmp 0x30ac7
cmpl $0x22, %eax
jne 0x30b21
movl %r12d, -0x30(%rbp)
movl $0x5, 0x78(%rbx)
movq %rbx, %rdi
callq 0x30114
cmpb $0x22, 0xf8(%rbx)
jne 0x30a6c
movq %rbx, %rdi
callq 0x30114
movl 0xfc(%rbx), %eax
subl %r15d, %eax
addl $-0x2, %eax
movslq %eax, %rcx
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x25370
movq %r14, %rdi
movq %r12, %rsi
callq 0x25420
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x30ac3
callq 0x25320
movl -0x30(%rbp), %r12d
movl -0x2c(%rbp), %eax
movl %eax, 0xa0(%rbx)
movl 0x100(%rbx), %eax
movl %eax, 0xa4(%rbx)
movl %r12d, 0xa8(%rbx)
movl 0x104(%rbx), %eax
decl %eax
movl %eax, 0xac(%rbx)
movl %r13d, 0xb0(%rbx)
movl 0x78(%rbx), %eax
movl 0xfc(%rbx), %ecx
movl %ecx, 0xb4(%rbx)
cmpl $0x9, %eax
setne %bl
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x30b39
movl %r12d, -0x30(%rbp)
movl $0x6, 0x78(%rbx)
jmp 0x309f5
cmpb $0x5f, %al
je 0x30bde
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x41, %cl
cmpb $0x19, %cl
jbe 0x30bde
cmpb $0xa, %al
je 0x30b67
movq %rbx, %rdi
callq 0x30114
cmpb $0xa, 0xf8(%rbx)
jne 0x30b56
movslq 0xfc(%rbx), %rcx
subq %r15, %rcx
decq %r15
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x25370
leaq 0x1fce3(%rip), %rsi     # 0x50870
leaq -0xd0(%rbp), %rdi
movq %r14, %rdx
callq 0x2c6b4
leaq 0x1fce5(%rip), %rsi     # 0x50888
leaq -0xd0(%rbp), %rdi
callq 0x25650
leaq 0x50(%rbx), %rdi
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x30cf6
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x30cfd
movl %r12d, -0x30(%rbp)
movq %rbx, %rdi
callq 0x310c2
movslq 0xfc(%rbx), %rcx
subq %r15, %rcx
decq %r15
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x25370
movq %r14, %rdi
movq %r12, %rsi
callq 0x25420
movq (%r12), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x30c26
callq 0x25320
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x80(%rbx), %rsi
movq 0x88(%rbx), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
callq 0x2a264
movq 0x20(%rbx), %rdi
movq 0x28(%rbx), %rsi
movq %r15, %rdx
callq 0x31a71
movq %rax, %r15
movq 0x28(%rbx), %r12
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x30c80
callq 0x25320
cmpq %r12, %r15
je 0x30c91
movl $0x0, 0x78(%rbx)
jmp 0x30ac3
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x80(%rbx), %rsi
movq 0x88(%rbx), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %r15
movq %r15, %rdi
callq 0x2a264
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
movq %r15, %rdx
callq 0x31a71
movq %rax, %r15
movq 0x40(%rbx), %r12
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x30ce5
callq 0x25320
cmpq %r12, %r15
je 0x30d5b
movl $0x1, 0x78(%rbx)
jmp 0x30ac3
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x70(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0x2c4f8
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x30d2b
callq 0x25320
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30d40
callq 0x25320
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30ac7
callq 0x25320
jmp 0x30ac7
leaq -0x50(%rbp), %rsi
movl $0x0, (%rsi)
leaq 0x30b84(%rip), %rdi     # 0x618f0
callq 0x2b236
movq %r14, %rdi
movq %rax, %rsi
callq 0x3110e
testb %al, %al
movl -0x30(%rbp), %r12d
je 0x30d90
movl $0x2, 0x78(%rbx)
jmp 0x30ac7
leaq -0x50(%rbp), %rsi
movl $0x1, (%rsi)
leaq 0x30b4f(%rip), %rdi     # 0x618f0
callq 0x2b236
movq %r14, %rdi
movq %rax, %rsi
callq 0x3110e
testb %al, %al
je 0x30dc1
movl $0x3, 0x78(%rbx)
jmp 0x30ac7
movl $0x4, 0x78(%rbx)
jmp 0x30ac7
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
jmp 0x30e28
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0x30df3
callq 0x25320
jmp 0x30df3
movq %rax, %rbx
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30e20
callq 0x25320
jmp 0x30e20
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
jmp 0x30e28
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30e32
callq 0x25320
movq %rbx, %rdi
callq 0x255f0