// File: Blaze2305[P]Compiler-Design-2021-Assignment/src/Parser/Parser.cpp
// Function: Parser::accept(TokenType)
void Parser::accept(TokenType expected){
	if(expected == Identifier && identifierCheckFlag){
		if(!this->symtab.checkIfSymbolExists(currentToken.Value)){
			std::ostringstream out;
			out << "Syntax error on line ";
			out << currentToken.lineNumber;
			out << "  UNKNOWN IDENTIFIER ";
			out << currentToken.Value;
			throw  std::runtime_error(out.str());
		}
	}
	if(currentToken.tokenType == expected){
		printAcceptedToken(currentToken.tokenType,currentToken.lineNumber,currentToken.Value);
		currentToken =  scanner->getToken();
	}else{
		std::ostringstream out;
		out << "Syntax error on line ";
		out << currentToken.lineNumber;
		out << "  CURRENT TOKEN IS ";
		out << TOKEN_ENUM_TYPE_NAMES[currentToken.tokenType];
		out << "  CURRENT TOKEN NAME IS ";
		out << currentToken.Value;
		out << " BUT EXPECTED TOKEN IS ";
		out << TOKEN_ENUM_TYPE_NAMES[expected];
		throw  std::runtime_error(out.str());
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x430, %rsp            # imm = 0x430
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3d8(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0xd862
movq -0x3d8(%rbp), %rax
testb $0x1, 0x6c(%rax)
je 0xd862
movq -0x3d8(%rbp), %rsi
movq %rsi, %rax
addq $0x38, %rax
movq %rax, -0x3f0(%rbp)
addq $0x8, %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x3120
movq -0x3f0(%rbp), %rdi
movq -0x3e8(%rbp), %rsi
callq 0x13110
movb %al, -0x3d9(%rbp)
jmp 0xd6ec
movb -0x3d9(%rbp), %al
xorb $-0x1, %al
movb %al, -0x3f1(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3558
movb -0x3f1(%rbp), %al
testb $0x1, %al
jne 0xd712
jmp 0xd860
leaq -0x1b8(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x33e0
movq -0x400(%rbp), %rdi
leaq 0xbac2(%rip), %rsi      # 0x191f5
callq 0x3290
jmp 0xd73a
movq -0x3d8(%rbp), %rax
movl 0x28(%rax), %esi
leaq -0x1b8(%rbp), %rdi
callq 0x34e0
jmp 0xd752
leaq 0xbab2(%rip), %rsi      # 0x1920b
leaq -0x1b8(%rbp), %rdi
callq 0x3290
jmp 0xd767
movq -0x3d8(%rbp), %rsi
addq $0x8, %rsi
leaq -0x1b8(%rbp), %rdi
callq 0x3260
jmp 0xd780
movb $0x1, -0x1d9(%rbp)
movl $0x10, %edi
callq 0x3150
movq %rax, -0x408(%rbp)
leaq -0x1d8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x32c0
jmp 0xd7ad
movq -0x408(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x3470
jmp 0xd7c2
movq -0x408(%rbp), %rdi
movb $0x0, -0x1d9(%rbp)
movq 0x14819(%rip), %rsi     # 0x21ff0
movq 0x147e2(%rip), %rdx     # 0x21fc0
callq 0x34d0
jmp 0xdad5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3558
jmp 0xdacc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xd84f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xd836
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x3558
testb $0x1, -0x1d9(%rbp)
jne 0xd841
jmp 0xd84d
movq -0x408(%rbp), %rdi
callq 0x3200
jmp 0xd84f
leaq -0x1b8(%rbp), %rdi
callq 0x30c0
jmp 0xdacc
jmp 0xd862
movq -0x3d8(%rbp), %rax
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0xd921
movq -0x3d8(%rbp), %rsi
movl (%rsi), %eax
movl %eax, -0x418(%rbp)
movl 0x28(%rsi), %eax
movl %eax, -0x414(%rbp)
addq $0x8, %rsi
leaq -0x200(%rbp), %rdi
movq %rdi, -0x410(%rbp)
callq 0x3120
movl -0x418(%rbp), %edi
movl -0x414(%rbp), %esi
movq -0x410(%rbp), %rdx
callq 0x15570
jmp 0xd8bd
leaq -0x200(%rbp), %rdi
callq 0x3558
movq -0x3d8(%rbp), %rax
movq 0x30(%rax), %rsi
leaq -0x230(%rbp), %rdi
callq 0x121a0
movq -0x3d8(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x10610
leaq -0x230(%rbp), %rdi
callq 0x105f0
jmp 0xdac3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x3558
jmp 0xdacc
leaq -0x3a8(%rbp), %rdi
movq %rdi, -0x420(%rbp)
callq 0x33e0
movq -0x420(%rbp), %rdi
leaq 0xb8b3(%rip), %rsi      # 0x191f5
callq 0x3290
jmp 0xd949
movq -0x3d8(%rbp), %rax
movl 0x28(%rax), %esi
leaq -0x3a8(%rbp), %rdi
callq 0x34e0
jmp 0xd961
leaq 0xb8b9(%rip), %rsi      # 0x19221
leaq -0x3a8(%rbp), %rdi
callq 0x3290
jmp 0xd976
movq -0x3d8(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
leaq 0x15370(%rip), %rdi     # 0x22cf8
callq 0xd470
movq %rax, %rsi
leaq -0x3a8(%rbp), %rdi
callq 0x3260
jmp 0xd99e
leaq 0xb890(%rip), %rsi      # 0x19235
leaq -0x3a8(%rbp), %rdi
callq 0x3290
jmp 0xd9b3
movq -0x3d8(%rbp), %rsi
addq $0x8, %rsi
leaq -0x3a8(%rbp), %rdi
callq 0x3260
jmp 0xd9cc
leaq 0xb87b(%rip), %rsi      # 0x1924e
leaq -0x3a8(%rbp), %rdi
callq 0x3290
jmp 0xd9e1
movl -0xc(%rbp), %eax
movl %eax, %esi
leaq 0x1530b(%rip), %rdi     # 0x22cf8
callq 0xd470
movq %rax, %rsi
leaq -0x3a8(%rbp), %rdi
callq 0x3260
jmp 0xda03
movb $0x1, -0x3c9(%rbp)
movl $0x10, %edi
callq 0x3150
movq %rax, -0x428(%rbp)
leaq -0x3c8(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x32c0
jmp 0xda30
movq -0x428(%rbp), %rdi
leaq -0x3c8(%rbp), %rsi
callq 0x3470
jmp 0xda45
movq -0x428(%rbp), %rdi
movb $0x0, -0x3c9(%rbp)
movq 0x14596(%rip), %rsi     # 0x21ff0
movq 0x1455f(%rip), %rdx     # 0x21fc0
callq 0x34d0
jmp 0xdad5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xdab5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xda9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x3558
testb $0x1, -0x3c9(%rbp)
jne 0xdaa7
jmp 0xdab3
movq -0x428(%rbp), %rdi
callq 0x3200
jmp 0xdab5
leaq -0x3a8(%rbp), %rdi
callq 0x30c0
jmp 0xdacc
addq $0x430, %rsp            # imm = 0x430
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3500
nopw %cs:(%rax,%rax)