// File: pranavmodx[P]modlang/src/parser.cpp
// Function: Parser::parseHashSetLiteral()
Expression *Parser::parseHashSetLiteral()
{
	HashSetLiteral *exp = new HashSetLiteral();
	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->pairs.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 0x23bc0
jmp 0x1ff6d
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 0x45b6b(%rip), %rsi     # 0x65b00
callq 0x21d00
testb $0x1, %al
jne 0x1ffe2
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x1ffb6
movq -0x50(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20111
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x60, %esi
callq 0x52b0
jmp 0x2011b
movq -0x48(%rbp), %rdi
leaq 0x45b33(%rip), %rsi     # 0x65b20
callq 0x21d00
testb $0x1, %al
jne 0x2001b
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x2000e
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20111
movq -0x48(%rbp), %rdi
leaq 0x45c3a(%rip), %rsi     # 0x65c60
callq 0x21d00
testb $0x1, %al
jne 0x20054
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
je 0x20047
movq -0x60(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20111
jmp 0x20056
movq -0x48(%rbp), %rdi
addq $0x70, %rdi
leaq 0x45c1b(%rip), %rsi     # 0x65c80
callq 0x22d80
testb $0x1, %al
jne 0x20070
jmp 0x200d3
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 0x45bd8(%rip), %rsi     # 0x65c80
callq 0x22d80
testb $0x1, %al
jne 0x200b3
jmp 0x200d1
movq -0x48(%rbp), %rdi
leaq 0x45b02(%rip), %rsi     # 0x65bc0
callq 0x21d00
testb $0x1, %al
jne 0x200d1
movq $0x0, -0x8(%rbp)
jmp 0x20111
jmp 0x20056
movq -0x48(%rbp), %rdi
leaq 0x45ba2(%rip), %rsi     # 0x65c80
callq 0x21d00
testb $0x1, %al
jne 0x20109
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x200ff
movq -0x68(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x20111
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)