// File: WayfireWM[P]wf-utils/wayfire/lexer/lexer.cpp
// Function: wf::lexer_t::parse_symbol()
symbol_t lexer_t::parse_symbol()
{
    if (_reversed)
    {
        auto position = _history.size() - _reversed;
        auto pair = _history.at(position);
        auto symbol = std::get<symbol_t>(pair);

        --_reversed;

        return symbol;
    }
    else
    {
        if (_parse_position >= _size)
        {
            return symbol_t(symbol_t::type_t::END);
        }

        while (std::isspace(_text.at(_parse_position)))
        {
            ++_parse_position;
        }

        _symbol_position = _parse_position;
        symbol_t symbol = _parse_literal();

        _history.push_back({_symbol_position, symbol});

        return symbol;
    }
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x28(%rsp)
movq %rdi, %rax
movq %rax, 0x30(%rsp)
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rax)
je 0xc382
movq 0x38(%rsp), %rdi
addq $0x40, %rdi
movq %rdi, 0x18(%rsp)
callq 0xc500
movq 0x38(%rsp), %rcx
movq 0x18(%rsp), %rdi
movq 0x38(%rcx), %rcx
subq %rcx, %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rsi
callq 0xc520
movq %rax, %rsi
leaq 0xb8(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xc560
movq 0x20(%rsp), %rdi
movb $0x0, 0xb7(%rsp)
callq 0xc5a0
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0xc5b0
jmp 0xc31b
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x38(%rax)
movb $0x1, 0xb7(%rsp)
testb $0x1, 0xb7(%rsp)
jne 0xc370
jmp 0xc366
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0xc610
jmp 0xc4e7
movq 0x28(%rsp), %rdi
callq 0xc5f0
leaq 0xb8(%rsp), %rdi
callq 0xc610
jmp 0xc4da
movq 0x38(%rsp), %rcx
movq 0x28(%rcx), %rax
cmpq (%rcx), %rax
jb 0xc3a1
movq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x12180
jmp 0xc4da
jmp 0xc3a3
movq 0x38(%rsp), %rax
movq %rax, %rdi
addq $0x8, %rdi
movq 0x28(%rax), %rsi
callq 0x6550
movsbl (%rax), %edi
callq 0x6050
cmpl $0x0, %eax
je 0xc3d8
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
jmp 0xc3a3
movq 0x38(%rsp), %rsi
movq 0x28(%rsi), %rax
movq %rax, 0x30(%rsi)
movb $0x0, 0xa3(%rsp)
leaq 0x78(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xc630
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x12210
jmp 0xc40d
leaq 0x78(%rsp), %rdi
callq 0x99d0
movq 0x38(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rsi, %rax
addq $0x40, %rax
movq %rax, 0x8(%rsp)
addq $0x30, %rsi
leaq 0x40(%rsp), %rdi
callq 0xcb10
jmp 0xc43d
movq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xcae0
jmp 0xc44e
leaq 0x40(%rsp), %rdi
callq 0xc610
movb $0x1, 0xa3(%rsp)
testb $0x1, 0xa3(%rsp)
jne 0xc4cc
jmp 0xc4c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x99d0
jmp 0xc4e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
jmp 0xc4ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa8(%rsp)
movl %eax, 0xa4(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xc610
jmp 0xc4ce
movq 0x28(%rsp), %rdi
callq 0xc5f0
jmp 0xc4da
movq 0x28(%rsp), %rdi
callq 0xc5f0
jmp 0xc4e7
movq 0x30(%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
retq
movq 0xa8(%rsp), %rdi
callq 0x64f0
nopw %cs:(%rax,%rax)
nop