// File: /workspace/github_cpp_makefile_star2_O2/Eronana[P]strawberry/src/lexer.cpp
// Function: Lexer::next()
Token Lexer::next()
{
    if (!fp) return createToken(TOKEN_ERROR, 0, "No source file.");
    Token comment_error, t;
    if (!skipComment(comment_error)) return comment_error;
    skipWhiteSpace();
    int c, i;
    if ((c = lookHead()) == CHAR_EOF) return createToken(TOKEN_EOF, 0);
    switch (c)
    {
    case '+':
        switch (lookHead(1))
        {
        case '+':
            return createToken(TOKEN_INCREMENT, 2);
        case '=':
            return createToken(TOKEN_ADD_ASSIGN, 2);
        default:
            return createToken(TOKEN_ADD);
        }
    case '-':
        switch (lookHead(1))
        {
        case '-':
            return createToken(TOKEN_DECREMENT, 2);
        case '=':
            return createToken(TOKEN_SUB_ASSIGN, 2);
        default:
            return createToken(TOKEN_SUB);
        }
    case '*':
        if (lookHead(1) == '=') return createToken(TOKEN_MUL_ASSIGN, 2);
        return createToken(TOKEN_MUL);
    case '/':
        if (lookHead(1) == '=') return createToken(TOKEN_DIV_ASSIGN, 2);
        return createToken(TOKEN_DIV);
    case '%':
        if (lookHead(1) == '=') return createToken(TOKEN_MOD_ASSIGN, 2);
        return createToken(TOKEN_MOD);
    case '(':
        return createToken(TOKEN_LEFT_PAREN);
    case ')':
        return createToken(TOKEN_RIGHT_PAREN);
    case '[':
        return createToken(TOKEN_LEFT_SQUARE_BARCKET);
    case ']':
        return createToken(TOKEN_RIGHT_SQUARE_BARCKET);
    case '{':
        return createToken(TOKEN_LEFT_BARCKET);
    case '}':
        return createToken(TOKEN_RIGHT_BARCKET);
    case '|':
        switch (lookHead(1))
        {
        case '|':
            return createToken(TOKEN_LOGIC_OR, 2);
        case '=':
            return createToken(TOKEN_BITWISE_OR_ASSIGN, 2);
        default:
            return createToken(TOKEN_BITWISE_OR);
        }
    case '&':
        switch (lookHead(1))
        {
        case '&':
            return createToken(TOKEN_LOGIC_AND, 2);
        case '=':
            return createToken(TOKEN_BITWISE_AND_ASSIGN, 2);
        default:
            return createToken(TOKEN_BITWISE_AND);
        }
    case '~':
        return createToken(TOKEN_BITWISE_NOT);
    case '^':
        if (lookHead(1) == '=') return createToken(TOKEN_BITWISE_XOR_ASSIGN, 2);
        return createToken(TOKEN_BITWISE_XOR);
    case '!':
        if (lookHead(1) == '=') return createToken(TOKEN_INEQUAL, 2);
        return createToken(TOKEN_NEGATION);
    case '=':
        if (lookHead(1) == '=') return createToken(TOKEN_EQUAL, 2);
        return createToken(TOKEN_ASSIGN);
    case '>':
        if (lookHead(1) == '>')
        {
            if (lookHead(2) == '=') return createToken(TOKEN_RIGHT_SHIFT_ASSIGN, 3);
            return createToken(TOKEN_RIGHT_SHIFT, 2);
        }
        else if (lookHead(1) == '=') return createToken(TOKEN_GREATER_EQUAL, 2);
        return createToken(TOKEN_GREATER);
    case '<':
        if (lookHead(1) == '<')
        {
            if (lookHead(2) == '=') return createToken(TOKEN_LEFT_SHIFT_ASSIGN, 3);
            return createToken(TOKEN_LEFT_SHIFT, 2);
        }
        else if (lookHead(1) == '=') return createToken(TOKEN_LESS_EQUAL, 2);
        return createToken(TOKEN_LESS);
    case ';':
        return createToken(TOKEN_SEMICOLON);
    case ',':
        return createToken(TOKEN_COMMA);
    case ':':
        return createToken(TOKEN_COLON);
    case '?':
        return createToken(TOKEN_QUESTIONMARK);
    case '\'':
    case '"':
        for (i = 1; (lookHead(i) != c || lookHead(i - 1) == '\\') && lookHead(i) != '\n' && lookHead(i) != CHAR_EOF; i++);
        if (lookHead(i) == '\n') return createToken(TOKEN_ERROR, i, "Unterminated string literal in new line");
        if (lookHead(i) == CHAR_EOF) return createToken(TOKEN_ERROR, i, "Unterminated string literal in EOF");
        return createToken(TOKEN_STRING_LITERAL, i + 1);
    default:
        if (isIdentifierHead(c))
        {
            for (i = 1; isIdentifier(lookHead(i)); i++);
            t = createToken(TOKEN_IDENTIFIER, i);
            if (t.raw == "true" || t.raw == "false") t.type = TOKEN_BOOL_LITERAL;
            if (t.raw == "null") t.type = TOKEN_NULL_LITERAL;
            return t;
        }
        if (c == '0')
            switch (lookHead(1))
            {
            case 'b':
            case 'B':
                for (i = 2; isBin(lookHead(i)); i++);
                return createToken(TOKEN_BIN_INTEGER_LITERAL, i);
            case 'x':
            case 'X':
                for (i = 2; isHex(lookHead(i)); i++);
                return createToken(TOKEN_HEX_INTEGER_LITERAL, i);
            case '.':
                break;
            default:
                for (i = 1; isOct(lookHead(i)); i++);
                return createToken(TOKEN_OCT_INTEGER_LITERAL, i);
            }
        if (c == '.')
        {
            if (isNumber(lookHead(1)))
            {
                for (i = 1; isNumber(lookHead(i)); i++);
                if (lookHead(i) == 'F' || lookHead(i) == 'f') return createToken(TOKEN_FLOAT_LITERAL, i + 1);
                return createToken(TOKEN_FLOAT_LITERAL, i);
            }
            else
                return createToken(TOKEN_DOT);
        }
        if (isNumber(c))
        {
            for (i = 1; isNumber(lookHead(i)); i++);
            if (lookHead(i) != '.')
            {
                if (lookHead(i) == 'F' || lookHead(i) == 'f') return createToken(TOKEN_FLOAT_LITERAL, i + 1);
                return createToken(TOKEN_DEC_INTEGER_LITERAL, i);
            }
            for (i++; isNumber(lookHead(i)); i++);
            if (lookHead(i) == 'F' || lookHead(i) == 'f') i++;
            return createToken(TOKEN_FLOAT_LITERAL, i);
        }
        return createToken(TOKEN_ERROR, 1, "Unexcepted symbol");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, (%rsi)
je 0x192c9
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0x80(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0xb0(%rsp), %rsi
movq %r14, %rdi
callq 0x18f96
testb %al, %al
je 0x1930b
movq %r14, %rdi
callq 0x18f4c
movq %r14, %rdi
xorl %esi, %esi
callq 0x18d6a
movl %eax, %ebp
movzbl %al, %eax
pushq $0x1
popq %r15
leal -0x21(%rax), %ecx
pushq $0x2
popq %r12
cmpl $0x1e, %ecx
ja 0x19320
leaq 0x4e6f(%rip), %rdx      # 0x1e0d8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
pushq $0x2
popq %r15
leal -0x1(%r15), %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb %bpl, %al
jne 0x1929e
leal -0x2(%r15), %esi
movq %r14, %rdi
callq 0x18d6a
cmpb $0x5c, %al
jne 0x1936b
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $0xa, %al
je 0x1936b
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $-0x1, %al
je 0x1936b
incl %r15d
jmp 0x19276
leaq 0x5129(%rip), %rsi      # 0x1e3f9
leaq 0xb0(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x9c4a
leaq 0xb0(%rsp), %r8
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x18f12
leaq 0xb0(%rsp), %rdi
callq 0x6130
jmp 0x1993c
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
callq 0x15e50
jmp 0x19925
leal -0x7b(%rax), %ecx
cmpl $0x3, %ecx
jbe 0x19354
cmpl $0x5b, %eax
je 0x1960f
cmpl $0x5d, %eax
je 0x19670
cmpl $0x5e, %eax
je 0x1961d
cmpl $0xff, %eax
jne 0x193ae
xorl %r15d, %r15d
pushq $0x1
jmp 0x19914
leaq 0x4df9(%rip), %rax      # 0x1e154
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
pushq $0x12
jmp 0x19914
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $0xa, %al
jne 0x195f5
leaq 0x5084(%rip), %rsi      # 0x1e409
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9c4a
leaq 0x10(%rsp), %r8
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movl %r12d, %ecx
callq 0x18f12
jmp 0x198a0
cmpb $0x5f, %bpl
je 0x19677
movl %ebp, %ecx
andb $-0x21, %cl
addb $-0x41, %cl
cmpb $0x19, %cl
jbe 0x19677
cmpb $0x2e, %bpl
je 0x197be
cmpl $0x30, %eax
jne 0x197f5
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
cmpb $0x2e, %al
je 0x197ff
movzbl %al, %eax
cmpl $0x42, %eax
je 0x198d3
cmpl $0x58, %eax
je 0x19416
cmpl $0x62, %eax
je 0x198d3
cmpl $0x78, %eax
jne 0x1994f
pushq $0x2
popq %r15
movabsq $0x3f0000003f, %r12     # imm = 0x3F0000003F
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
jb 0x19450
movzbl %al, %eax
addl $-0x41, %eax
cmpl $0x25, %eax
ja 0x19912
btq %rax, %r12
jae 0x19912
incl %r15d
jmp 0x19424
pushq $0x2c
jmp 0x19914
pushq $0x29
jmp 0x19914
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
pushq $0x20
jmp 0x19633
pushq $0xe
jmp 0x19914
pushq $0x1
popq %r12
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
pushq $0x2
popq %r15
cmpb $0x2b, %al
je 0x1978a
movzbl %al, %eax
cmpl $0x3d, %eax
jne 0x19792
pushq $0x3
jmp 0x19914
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
pushq $0x1e
jmp 0x19633
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
movl %r15d, %ebp
xorl $0xb, %ebp
jmp 0x19637
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
cmpb $0x3c, %al
jne 0x19720
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
pushq $0x26
jmp 0x19541
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
cmpb $0x3e, %al
jne 0x1973d
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
pushq $0x22
popq %rbp
subl %r15d, %ebp
orl $0x2, %r15d
jmp 0x19915
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
movl %r15d, %ebp
xorl $0x9, %ebp
jmp 0x19637
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
cmpb $0x26, %al
je 0x19796
movzbl %al, %eax
cmpl $0x3d, %eax
jne 0x1979e
pushq $0x18
jmp 0x197ae
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
movl %r15d, %ebp
xorl $0xd, %ebp
jmp 0x19637
pushq $0xf
jmp 0x19914
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
cmpb $0x2d, %al
je 0x1979a
movzbl %al, %eax
cmpl $0x3d, %eax
jne 0x197a5
pushq $0x6
jmp 0x197ae
pushq $0x2a
jmp 0x19914
pushq $0x2d
jmp 0x19914
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $-0x1, %al
je 0x1975a
pushq $0x2f
jmp 0x19914
pushq $0x10
jmp 0x19914
pushq $0x13
jmp 0x19914
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
pushq $0x1c
popq %rbp
subl %r15d, %ebp
incl %r15d
jmp 0x19915
pushq $0x1a
jmp 0x19914
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
cmpb $0x7c, %al
je 0x197ac
movzbl %al, %eax
cmpl $0x3d, %eax
jne 0x197b7
pushq $0x15
jmp 0x197ae
pushq $0x11
jmp 0x19914
leaq 0x70(%rsp), %r15
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x18d6a
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
jb 0x1969d
cmpb $0x5f, %al
je 0x1969d
andb $-0x21, %al
addb $-0x41, %al
cmpb $0x19, %al
ja 0x196a1
incl %ebp
jmp 0x1967f
leaq 0x10(%rsp), %rdi
pushq $0x2e
popq %rdx
movq %r14, %rsi
movl %ebp, %ecx
callq 0x18e6c
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x19a04
movq %r14, %rdi
callq 0x77da
leaq 0x3c9f(%rip), %rsi      # 0x1d373
movq %r15, %rdi
callq 0x9d30
testb %al, %al
jne 0x196f3
leaq 0x3c91(%rip), %rsi      # 0x1d378
movq %r15, %rdi
callq 0x9d30
testb %al, %al
je 0x196fb
movl $0x34, 0x60(%rsp)
leaq 0x3caa(%rip), %rsi      # 0x1d3ac
movq %r15, %rdi
callq 0x9d30
testb %al, %al
je 0x19716
movl $0x35, 0x60(%rsp)
leaq 0x60(%rsp), %rsi
jmp 0x19313
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
leal 0x27(%r15), %ebp
jmp 0x19637
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x18d6a
xorl %r15d, %r15d
cmpb $0x3d, %al
sete %r15b
leal 0x23(%r15), %ebp
jmp 0x19637
leaq 0x4cd0(%rip), %rsi      # 0x1e431
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9c4a
leaq 0x10(%rsp), %r8
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movl %r12d, %ecx
callq 0x18f12
jmp 0x198a0
movl %r15d, %ebp
jmp 0x19915
pushq $0x4
jmp 0x197ae
pushq $0x17
jmp 0x197ae
pushq $0x5
jmp 0x197ae
pushq $0x19
jmp 0x19914
pushq $0x7
jmp 0x19914
pushq $0x14
popq %rbp
movl %r12d, %r15d
jmp 0x19915
pushq $0x16
jmp 0x19914
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
addb $-0x30, %al
cmpb $0x9, %al
ja 0x198ac
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
addb $-0x30, %al
cmpb $0x9, %al
ja 0x198b0
incl %r15d
jmp 0x197db
addb $-0x30, %bpl
cmpb $0x9, %bpl
ja 0x19875
pushq $0x2
popq %r15
leal -0x1(%r15), %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
addb $-0x30, %al
cmpb $0x9, %al
ja 0x1981d
incl %r15d
jmp 0x19803
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $0x2e, %al
jne 0x198f0
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
addb $-0x30, %al
incl %r15d
cmpb $0xa, %al
jb 0x19830
leal -0x1(%r15), %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $0x46, %al
je 0x1990e
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $0x66, %al
je 0x1990e
pushq $0x36
jmp 0x197ae
leaq 0x4bd8(%rip), %rsi      # 0x1e454
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x9c4a
pushq $0x1
popq %rcx
leaq 0x10(%rsp), %r8
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x18f12
leaq 0x10(%rsp), %rdi
callq 0x6130
jmp 0x19925
pushq $0x2b
jmp 0x19914
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
cmpb $0x46, %al
je 0x198ce
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
cmpb $0x66, %al
jne 0x1990e
incl %r15d
jmp 0x1990e
pushq $0x2
popq %r15
pushq $0x30
popq %rbp
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
andb $-0x2, %al
cmpb $0x30, %al
jne 0x19915
incl %r15d
jmp 0x198da
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $0x46, %al
je 0x1990e
movq %r14, %rdi
movl %r12d, %esi
callq 0x18d6a
cmpb $0x66, %al
jne 0x19968
pushq $0x36
jmp 0x19914
pushq $0x33
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0x18e6c
leaq 0x60(%rsp), %rdi
callq 0x77da
leaq 0xb0(%rsp), %rdi
callq 0x77da
movq %rbx, %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x31
popq %rbp
movq %r14, %rdi
movl %r15d, %esi
callq 0x18d6a
andb $-0x8, %al
cmpb $0x30, %al
jne 0x19915
incl %r15d
jmp 0x19952
pushq $0x32
jmp 0x197ae
jmp 0x19979
jmp 0x199b3
jmp 0x19979
jmp 0x199b3
jmp 0x199b3
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6130
jmp 0x199b6
jmp 0x199b3
jmp 0x199b3
jmp 0x199b3
jmp 0x199b3
jmp 0x199b3
jmp 0x199b3
jmp 0x199b3
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x6130
jmp 0x199cd
movq %rax, %rbx
jmp 0x199cd
jmp 0x199b3
jmp 0x199b3
jmp 0x199b3
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x77da
leaq 0xb0(%rsp), %rdi
callq 0x77da
movq %rbx, %rdi
callq 0x6460
nop