// File: CoinXu[P]reviser-compiler/src/parser.cpp
// Function: reviser::compiler::Parser::ConsumeDataTypeDeclare()
Declare* Parser::ConsumeDataTypeDeclare() {
    Token* id = CloneToken(tokenizer->Current());
    string type = PreviousText();

    Expect(TOKEN_ID);

    // TODO
    // value optional support
    Expect(TOKEN_ASSIGN);

    Token* dvt = CloneToken(tokenizer->Current());
    string value = CurrentText();
    DataType data_type = DataTypeValue.at(type);

    switch (data_type) {
      case TYPE_BOOL:
        if (!helper::bool_is_bool(value)) {
          RuntimeError("expect bool value but received", dvt);
        } else {
          generator->descriptor->AddDataTypesOnce(TYPE_BOOL);
          Next();
        }
        break;

      case TYPE_FLOAT:
        if (!helper::numeric_is_float(value)) {
          RuntimeError("exceeds range of float", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_FLOAT);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_DOUBLE:
        if (!helper::numeric_is_double(value)) {
          RuntimeError("exceeds range of double", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_DOUBLE);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_INT32:
        if (!helper::numeric_is_int32(value)) {
          RuntimeError("exceeds range of int32", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_INT32);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_INT64:
        if (!helper::numeric_is_int64(value)) {
          RuntimeError("exceeds range of int64", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_INT64);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_UINT32:
        if (!helper::numeric_is_uint32(value)) {
          RuntimeError("exceeds range of uint32", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_UINT32);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_UINT64:
        if (!helper::numeric_is_uint64(value)) {
          RuntimeError("exceeds range of uint64", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_UINT64);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_STRING:
        generator->descriptor->AddDataTypesOnce(TYPE_STRING);
        Expect(TOKEN_LETTER);
        break;

      default:
        RuntimeError("unknow data type [" + type + "]");
        break;
    }

    RightValue* rv = new RightValue(data_type, dvt);
    Declare* declare = new Declare(data_type, id, rv);
    return declare;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movq (%rax), %rdi
callq 0xae500
movq -0x2c0(%rbp), %rdi
movq %rax, %rsi
callq 0xa81f0
movq -0x2c0(%rbp), %rsi
movq %rax, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xa8610
movq -0x2c0(%rbp), %rdi
movl $0x4, %esi
callq 0xa83a0
jmp 0xa9218
movq -0x2c0(%rbp), %rdi
movl $0x3d, %esi
callq 0xa83a0
jmp 0xa922b
movq -0x2c0(%rbp), %rax
movq (%rax), %rdi
callq 0xae500
movq %rax, -0x2c8(%rbp)
jmp 0xa9243
movq -0x2c8(%rbp), %rsi
movq -0x2c0(%rbp), %rdi
callq 0xa81f0
movq %rax, -0x2d0(%rbp)
jmp 0xa925f
movq -0x2c0(%rbp), %rsi
movq -0x2d0(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xa8580
jmp 0xa927c
leaq 0x8781d(%rip), %rdi     # 0x130aa0
leaq -0x30(%rbp), %rsi
callq 0xab2d0
movq %rax, -0x2d8(%rbp)
jmp 0xa9295
movq -0x2d8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq %rax, -0x2e0(%rbp)
subq $0x7, %rax
ja 0xa9ba3
movq -0x2e0(%rbp), %rax
leaq 0x561e9(%rip), %rcx     # 0xff4ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa9d25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa9d1c
leaq -0x90(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x991c0
jmp 0xa9300
leaq -0x90(%rbp), %rdi
callq 0xa4650
movb %al, -0x2e1(%rbp)
jmp 0xa9314
movb -0x2e1(%rbp), %al
xorb $-0x1, %al
movb %al, -0x2e2(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x992c0
movb -0x2e2(%rbp), %al
testb $0x1, %al
jne 0xa933d
jmp 0xa93f3
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x99850
movq -0x2f0(%rbp), %rdx
leaq 0x56229(%rip), %rsi     # 0xff587
leaq -0xb0(%rbp), %rdi
callq 0x99640
jmp 0xa936c
movq -0x2c0(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0xb0(%rbp), %rsi
callq 0xa82a0
jmp 0xa9385
leaq -0xb0(%rbp), %rdi
callq 0x992c0
leaq -0xb1(%rbp), %rdi
callq 0x994f0
jmp 0xa941b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa93e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x992c0
leaq -0xb1(%rbp), %rdi
callq 0x994f0
jmp 0xa9d1c
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
xorl %esi, %esi
callq 0xbd440
jmp 0xa940b
movq -0x2c0(%rbp), %rdi
callq 0xa81d0
jmp 0xa9419
jmp 0xa941b
jmp 0xa9c42
leaq -0xd8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x991c0
jmp 0xa9432
leaq -0xd8(%rbp), %rdi
callq 0xa42f0
movb %al, -0x2f1(%rbp)
jmp 0xa9446
movb -0x2f1(%rbp), %al
xorb $-0x1, %al
movb %al, -0x2f2(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x992c0
movb -0x2f2(%rbp), %al
testb $0x1, %al
jne 0xa946f
jmp 0xa9525
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x99850
movq -0x300(%rbp), %rdx
leaq 0x56116(%rip), %rsi     # 0xff5a6
leaq -0xf8(%rbp), %rdi
callq 0x99640
jmp 0xa949e
movq -0x2c0(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0xf8(%rbp), %rsi
callq 0xa82a0
jmp 0xa94b7
leaq -0xf8(%rbp), %rdi
callq 0x992c0
leaq -0xf9(%rbp), %rdi
callq 0x994f0
jmp 0xa9525
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa9514
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x992c0
leaq -0xf9(%rbp), %rdi
callq 0x994f0
jmp 0xa9d1c
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movl $0x1, %esi
callq 0xbd440
jmp 0xa9540
movq -0x2c0(%rbp), %rdi
movl $0x6, %esi
callq 0xa83a0
jmp 0xa9553
jmp 0xa9c42
leaq -0x120(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x991c0
jmp 0xa956a
leaq -0x120(%rbp), %rdi
callq 0xa4360
movb %al, -0x301(%rbp)
jmp 0xa957e
movb -0x301(%rbp), %al
xorb $-0x1, %al
movb %al, -0x302(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x992c0
movb -0x302(%rbp), %al
testb $0x1, %al
jne 0xa95a7
jmp 0xa965d
leaq -0x141(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x99850
movq -0x310(%rbp), %rdx
leaq 0x55ff5(%rip), %rsi     # 0xff5bd
leaq -0x140(%rbp), %rdi
callq 0x99640
jmp 0xa95d6
movq -0x2c0(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x140(%rbp), %rsi
callq 0xa82a0
jmp 0xa95ef
leaq -0x140(%rbp), %rdi
callq 0x992c0
leaq -0x141(%rbp), %rdi
callq 0x994f0
jmp 0xa965d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa964c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x992c0
leaq -0x141(%rbp), %rdi
callq 0x994f0
jmp 0xa9d1c
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movl $0x2, %esi
callq 0xbd440
jmp 0xa9678
movq -0x2c0(%rbp), %rdi
movl $0x6, %esi
callq 0xa83a0
jmp 0xa968b
jmp 0xa9c42
leaq -0x168(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x991c0
jmp 0xa96a2
leaq -0x168(%rbp), %rdi
callq 0xa43d0
movb %al, -0x311(%rbp)
jmp 0xa96b6
movb -0x311(%rbp), %al
xorb $-0x1, %al
movb %al, -0x312(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x992c0
movb -0x312(%rbp), %al
testb $0x1, %al
jne 0xa96df
jmp 0xa9795
leaq -0x189(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x99850
movq -0x320(%rbp), %rdx
leaq 0x55ed5(%rip), %rsi     # 0xff5d5
leaq -0x188(%rbp), %rdi
callq 0x99640
jmp 0xa970e
movq -0x2c0(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x188(%rbp), %rsi
callq 0xa82a0
jmp 0xa9727
leaq -0x188(%rbp), %rdi
callq 0x992c0
leaq -0x189(%rbp), %rdi
callq 0x994f0
jmp 0xa9795
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa9784
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x992c0
leaq -0x189(%rbp), %rdi
callq 0x994f0
jmp 0xa9d1c
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movl $0x3, %esi
callq 0xbd440
jmp 0xa97b0
movq -0x2c0(%rbp), %rdi
movl $0x6, %esi
callq 0xa83a0
jmp 0xa97c3
jmp 0xa9c42
leaq -0x1b0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x991c0
jmp 0xa97da
leaq -0x1b0(%rbp), %rdi
callq 0xa4440
movb %al, -0x321(%rbp)
jmp 0xa97ee
movb -0x321(%rbp), %al
xorb $-0x1, %al
movb %al, -0x322(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x992c0
movb -0x322(%rbp), %al
testb $0x1, %al
jne 0xa9817
jmp 0xa98cd
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x99850
movq -0x330(%rbp), %rdx
leaq 0x55db4(%rip), %rsi     # 0xff5ec
leaq -0x1d0(%rbp), %rdi
callq 0x99640
jmp 0xa9846
movq -0x2c0(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x1d0(%rbp), %rsi
callq 0xa82a0
jmp 0xa985f
leaq -0x1d0(%rbp), %rdi
callq 0x992c0
leaq -0x1d1(%rbp), %rdi
callq 0x994f0
jmp 0xa98cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa98bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x992c0
leaq -0x1d1(%rbp), %rdi
callq 0x994f0
jmp 0xa9d1c
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movl $0x4, %esi
callq 0xbd440
jmp 0xa98e8
movq -0x2c0(%rbp), %rdi
movl $0x6, %esi
callq 0xa83a0
jmp 0xa98fb
jmp 0xa9c42
leaq -0x1f8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x991c0
jmp 0xa9912
leaq -0x1f8(%rbp), %rdi
callq 0xa44c0
movb %al, -0x331(%rbp)
jmp 0xa9926
movb -0x331(%rbp), %al
xorb $-0x1, %al
movb %al, -0x332(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x992c0
movb -0x332(%rbp), %al
testb $0x1, %al
jne 0xa994f
jmp 0xa9a05
leaq -0x219(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x99850
movq -0x340(%rbp), %rdx
leaq 0x55c93(%rip), %rsi     # 0xff603
leaq -0x218(%rbp), %rdi
callq 0x99640
jmp 0xa997e
movq -0x2c0(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x218(%rbp), %rsi
callq 0xa82a0
jmp 0xa9997
leaq -0x218(%rbp), %rdi
callq 0x992c0
leaq -0x219(%rbp), %rdi
callq 0x994f0
jmp 0xa9a05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa99f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x992c0
leaq -0x219(%rbp), %rdi
callq 0x994f0
jmp 0xa9d1c
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movl $0x5, %esi
callq 0xbd440
jmp 0xa9a20
movq -0x2c0(%rbp), %rdi
movl $0x6, %esi
callq 0xa83a0
jmp 0xa9a33
jmp 0xa9c42
leaq -0x240(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x991c0
jmp 0xa9a4a
leaq -0x240(%rbp), %rdi
callq 0xa4530
movb %al, -0x341(%rbp)
jmp 0xa9a5e
movb -0x341(%rbp), %al
xorb $-0x1, %al
movb %al, -0x342(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x992c0
movb -0x342(%rbp), %al
testb $0x1, %al
jne 0xa9a87
jmp 0xa9b3d
leaq -0x261(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x99850
movq -0x350(%rbp), %rdx
leaq 0x55b73(%rip), %rsi     # 0xff61b
leaq -0x260(%rbp), %rdi
callq 0x99640
jmp 0xa9ab6
movq -0x2c0(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x260(%rbp), %rsi
callq 0xa82a0
jmp 0xa9acf
leaq -0x260(%rbp), %rdi
callq 0x992c0
leaq -0x261(%rbp), %rdi
callq 0x994f0
jmp 0xa9b3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa9b2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x992c0
leaq -0x261(%rbp), %rdi
callq 0x994f0
jmp 0xa9d1c
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movl $0x6, %esi
callq 0xbd440
jmp 0xa9b58
movq -0x2c0(%rbp), %rdi
movl $0x6, %esi
callq 0xa83a0
jmp 0xa9b6b
jmp 0xa9c42
movq -0x2c0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movl $0x7, %esi
callq 0xbd440
jmp 0xa9b8b
movq -0x2c0(%rbp), %rdi
movl $0x5, %esi
callq 0xa83a0
jmp 0xa9b9e
jmp 0xa9c42
leaq 0x55a89(%rip), %rsi     # 0xff633
leaq -0x2a8(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0xa6e30
jmp 0xa9bbc
leaq 0x56ebf(%rip), %rdx     # 0x100a82
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0xa10c0
jmp 0xa9bd8
movq -0x2c0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0x288(%rbp), %rsi
callq 0xa82a0
jmp 0xa9bf1
leaq -0x288(%rbp), %rdi
callq 0x992c0
leaq -0x2a8(%rbp), %rdi
callq 0x992c0
jmp 0xa9c42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa9c31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x992c0
leaq -0x2a8(%rbp), %rdi
callq 0x992c0
jmp 0xa9d1c
movl $0x58, %edi
callq 0x99480
movq %rax, -0x358(%rbp)
jmp 0xa9c55
movq -0x358(%rbp), %rdi
movl -0x6c(%rbp), %esi
movq -0x48(%rbp), %rdx
xorl %ecx, %ecx
callq 0xb3320
jmp 0xa9c6c
movq -0x358(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movl $0x20, %edi
callq 0x99480
movq %rax, -0x360(%rbp)
jmp 0xa9c8d
movq -0x360(%rbp), %rdi
movl -0x6c(%rbp), %esi
movq -0x10(%rbp), %rdx
movq -0x2b0(%rbp), %rcx
xorl %r8d, %r8d
callq 0xb3530
jmp 0xa9cac
movq -0x360(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rax
movq %rax, -0x368(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x992c0
leaq -0x30(%rbp), %rdi
callq 0x992c0
movq -0x368(%rbp), %rax
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0x358(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x99440
jmp 0xa9d1c
movq -0x360(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x99440
leaq -0x68(%rbp), %rdi
callq 0x992c0
leaq -0x30(%rbp), %rdi
callq 0x992c0
movq -0x38(%rbp), %rdi
callq 0x99840
nopw (%rax,%rax)