// File: kram[P]kram/./src/parser/parser.cpp
// Function: Parser::keyword_new()
Instruction* Parser::keyword_new() {
	Instruction* ins = new Instruction(Ins::CREATE_INSTANCE);

	this->advance();

	// The name of the type/class to push
	lexer::Token* n = this->get_and_expect_token(lexer::Token::NAME(""));
	ins->name = n->value;

	this->advance();
	this->get_and_expect_token(lexer::Token::OPERATOR("("));

	// All parameters
	do {
		ins->right = this->read_until(std::vector<lexer::Token>{
			lexer::Token::OPERATOR(")"),
			lexer::Token::OPERATOR(","),
		}, ins->right);
	} while (this->get_token()->sub == lexer::Type::OPERATOR_COMMA);

	return this->lookahead(ins, ON::DEFAULT);
}

// Assembly:
subq $0x258, %rsp            # imm = 0x258
movq %rdi, 0x250(%rsp)
movq 0x250(%rsp), %rax
movq %rax, 0x80(%rsp)
movl $0x80, %edi
callq 0x32e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x88(%rsp)
movl $0xc, %esi
callq 0x26dd0
jmp 0x25493
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rax
movq %rax, 0x248(%rsp)
callq 0x21220
leaq 0x1e7(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x34a0
movq 0x78(%rsp), %rdx
leaq 0x6394(%rip), %rsi      # 0x2b862
leaq 0x1e8(%rsp), %rdi
callq 0x3390
jmp 0x254dd
leaq 0x208(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0xd8c0
jmp 0x254f4
movq 0x80(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x229f0
movq %rax, 0x70(%rsp)
jmp 0x25510
leaq 0x208(%rsp), %rdi
callq 0xdeb0
leaq 0x1e8(%rsp), %rdi
callq 0x31f0
leaq 0x1e7(%rsp), %rdi
callq 0x3310
movq 0x70(%rsp), %rax
movq %rax, 0x230(%rsp)
movq 0x230(%rsp), %rsi
addq $0x8, %rsi
movq 0x248(%rsp), %rdi
addq $0x8, %rdi
callq 0x3040
movq 0x80(%rsp), %rdi
callq 0x21220
leaq 0x197(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x34a0
movq 0x68(%rsp), %rdx
leaq 0x5cbd(%rip), %rsi      # 0x2b249
leaq 0x198(%rsp), %rdi
callq 0x3390
jmp 0x2559b
leaq 0x1b8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0xd7e0
jmp 0x255b2
movq 0x80(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x229f0
jmp 0x255c9
leaq 0x1b8(%rsp), %rdi
callq 0xdeb0
leaq 0x198(%rsp), %rdi
callq 0x31f0
leaq 0x197(%rsp), %rdi
callq 0x3310
movb $0x1, 0xae(%rsp)
leaq 0x100(%rsp), %rax
movq %rax, 0xf8(%rsp)
leaq 0xd7(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x34a0
movq 0x60(%rsp), %rdx
leaq 0x65b5(%rip), %rsi      # 0x2bbdb
leaq 0xd8(%rsp), %rdi
callq 0x3390
jmp 0x25635
leaq 0x100(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0xd7e0
jmp 0x2564c
leaq 0x128(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %rax, 0xf8(%rsp)
leaq 0xaf(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x34a0
movq 0x58(%rsp), %rdx
leaq 0x5c07(%rip), %rsi      # 0x2b286
leaq 0xb0(%rsp), %rdi
callq 0x3390
jmp 0x2568e
movq 0x50(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0xd7e0
jmp 0x256a2
movb $0x0, 0xae(%rsp)
leaq 0x100(%rsp), %rax
movq %rax, 0x150(%rsp)
movq $0x2, 0x158(%rsp)
leaq 0xad(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x26940
movq 0x48(%rsp), %rcx
movq 0x150(%rsp), %rsi
movq 0x158(%rsp), %rdx
leaq 0x160(%rsp), %rdi
callq 0x26950
jmp 0x256fc
movq 0x248(%rsp), %rsi
addq $0x50, %rsi
leaq 0x90(%rsp), %rdi
callq 0x5460
jmp 0x25717
movq 0x80(%rsp), %rsi
leaq 0x178(%rsp), %rdi
leaq 0x160(%rsp), %rdx
leaq 0x90(%rsp), %rcx
callq 0x21120
jmp 0x2573e
movq 0x248(%rsp), %rdi
addq $0x50, %rdi
leaq 0x178(%rsp), %rsi
callq 0x26e30
leaq 0x178(%rsp), %rdi
callq 0x5560
leaq 0x90(%rsp), %rdi
callq 0x5560
leaq 0x160(%rsp), %rdi
callq 0x269e0
leaq 0xad(%rsp), %rdi
callq 0x26a40
leaq 0x100(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x50, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x30(%rsp)
callq 0xdeb0
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x40(%rsp)
jne 0x257a1
leaq 0xb0(%rsp), %rdi
callq 0x31f0
leaq 0xaf(%rsp), %rdi
callq 0x3310
leaq 0xd8(%rsp), %rdi
callq 0x31f0
leaq 0xd7(%rsp), %rdi
callq 0x3310
movq 0x80(%rsp), %rdi
callq 0x21200
cmpl $0x12, 0x4(%rax)
je 0x255f0
movq 0x80(%rsp), %rdi
movq 0x248(%rsp), %rsi
xorl %edx, %edx
callq 0x213f0
addq $0x258, %rsp            # imm = 0x258
retq
movq 0x88(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
callq 0x32b0
jmp 0x25ac2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x258b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x258a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x208(%rsp), %rdi
callq 0xdeb0
leaq 0x1e8(%rsp), %rdi
callq 0x31f0
leaq 0x1e7(%rsp), %rdi
callq 0x3310
jmp 0x25ac2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x2591e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x25911
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0xdeb0
leaq 0x198(%rsp), %rdi
callq 0x31f0
leaq 0x197(%rsp), %rdi
callq 0x3310
jmp 0x25ac2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x25a61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x25a54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x25a47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x25a3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x259ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x259e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x5560
leaq 0x160(%rsp), %rdi
callq 0x269e0
leaq 0xad(%rsp), %rdi
callq 0x26a40
leaq 0x100(%rsp), %rax
movq %rax, 0x20(%rsp)
addq $0x50, %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x18(%rsp)
callq 0xdeb0
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x28(%rsp)
jne 0x25a11
jmp 0x25a3a
leaq 0xb0(%rsp), %rdi
callq 0x31f0
leaq 0xaf(%rsp), %rdi
callq 0x3310
leaq 0xd8(%rsp), %rdi
callq 0x31f0
leaq 0xd7(%rsp), %rdi
callq 0x3310
testb $0x1, 0xae(%rsp)
jne 0x25a7a
jmp 0x25ac0
movq 0xf8(%rsp), %rax
leaq 0x100(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x10(%rsp)
je 0x25abe
movq 0x10(%rsp), %rdi
addq $-0x28, %rdi
movq %rdi, 0x8(%rsp)
callq 0xdeb0
movq 0x8(%rsp), %rax
leaq 0x100(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x10(%rsp)
jne 0x25a94
jmp 0x25ac0
jmp 0x25ac2
movq 0x240(%rsp), %rdi
callq 0x3490
nop