// File: pranavmodx[P]modlang/src/parser.cpp
// Function: Parser::parseDequeLiteral()
Expression *Parser::parseDequeLiteral()
{
	DequeLiteral *exp = new DequeLiteral();
	exp->token = curToken;

	if (!expectPeek(LT))
	{
		delete exp;
		return nullptr;
	}

	if (!expectPeek(GT))
	{
		delete exp;
		return nullptr;
	}

	if (!expectPeek(LBRACE))
	{
		delete exp;
		return nullptr;
	}

	while (peekToken.type != RBRACE)
	{
		nextToken();

		Expression *value = parseExpression(LOWEST);

		exp->elements.push_back(value);

		if (peekToken.type != RBRACE && !expectPeek(COMMA))
			return nullptr;
	}

	if (!expectPeek(RBRACE))
	{
		delete exp;
		return nullptr;
	}

	return exp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x60, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, -0x40(%rbp)
movq %rdi, %rax
movq %rax, -0x38(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
callq 0x23d80
jmp 0x2057d
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
addq $0x30, %rsi
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x22d00
movq -0x48(%rbp), %rdi
leaq 0x4555b(%rip), %rsi     # 0x65b00
callq 0x21d00
testb $0x1, %al
jne 0x205f2
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x205c6
movq -0x50(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20721
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x60, %esi
callq 0x52b0
jmp 0x2072b
movq -0x48(%rbp), %rdi
leaq 0x45523(%rip), %rsi     # 0x65b20
callq 0x21d00
testb $0x1, %al
jne 0x2062b
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x2061e
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20721
movq -0x48(%rbp), %rdi
leaq 0x4562a(%rip), %rsi     # 0x65c60
callq 0x21d00
testb $0x1, %al
jne 0x20664
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
je 0x20657
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20721
jmp 0x20666
movq -0x48(%rbp), %rdi
addq $0x70, %rdi
leaq 0x4560b(%rip), %rsi     # 0x65c80
callq 0x22d80
testb $0x1, %al
jne 0x20680
jmp 0x206e3
movq -0x48(%rbp), %rdi
callq 0x1f390
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x21d60
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
leaq -0x30(%rbp), %rsi
callq 0x23c30
movq -0x48(%rbp), %rdi
addq $0x70, %rdi
leaq 0x455c8(%rip), %rsi     # 0x65c80
callq 0x22d80
testb $0x1, %al
jne 0x206c3
jmp 0x206e1
movq -0x48(%rbp), %rdi
leaq 0x454f2(%rip), %rsi     # 0x65bc0
callq 0x21d00
testb $0x1, %al
jne 0x206e1
movq $0x0, -0x8(%rbp)
jmp 0x20721
jmp 0x20666
movq -0x48(%rbp), %rdi
leaq 0x45592(%rip), %rsi     # 0x65c80
callq 0x21d00
testb $0x1, %al
jne 0x20719
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x2070f
movq -0x68(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20721
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x5490
nopw %cs:(%rax,%rax)