// File: AndrewAlbert[P]Compiler-Theory/SourceCode/parser.cpp
// Function: Parser::CheckToken(int)
bool Parser::CheckToken(int type){
	//skip all comment tokens
	while (token->type == T_COMMENT){
		*token = scanner->getToken();
	}

	if(token->line != currentLine ){
		currentLine = token->line;
		textLine = "";
	}
	//check that current token matches input type, if so move to next token
	if(token->type == type){
		textLine.append(" " + token->ascii);
		*token = scanner->getToken();
		return true;
	}
	else if(token->type == T_UNKNOWN){
			ReportError("Found unknown token " + token->ascii);
			*token = scanner->getToken();
		return CheckToken(type);
	}
	else if(token->type == T_EOF){
		return false;
	}
	else return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x400, %rsp            # imm = 0x400
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x3e8(%rbp)
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rax
cmpl $0x15c, 0x20(%rax)      # imm = 0x15C
jne 0x9376
movq -0x3e8(%rbp), %rax
movq 0x88(%rax), %rsi
leaq -0x140(%rbp), %rdi
callq 0x5520
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rdi
leaq -0x140(%rbp), %rsi
callq 0x12600
leaq -0x140(%rbp), %rdi
callq 0x61d0
jmp 0x931d
movq -0x3e8(%rbp), %rcx
movq 0x80(%rcx), %rax
movl 0x24(%rax), %eax
cmpl 0x78(%rcx), %eax
je 0x93b0
movq -0x3e8(%rbp), %rdi
movq 0x80(%rdi), %rax
movl 0x24(%rax), %eax
movl %eax, 0x78(%rdi)
addq $0x58, %rdi
leaq 0x1d8d6(%rip), %rsi     # 0x26c81
callq 0x3360
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rax
movl 0x20(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x948d
movq -0x3e8(%rbp), %rax
movq %rax, %rcx
addq $0x58, %rcx
movq %rcx, -0x3f8(%rbp)
movq 0x80(%rax), %rdx
leaq 0x1c137(%rip), %rsi     # 0x25524
leaq -0x160(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x124f0
movq -0x3f8(%rbp), %rdi
movq -0x3f0(%rbp), %rsi
callq 0x3490
jmp 0x9415
leaq -0x160(%rbp), %rdi
callq 0x31a0
movq -0x3e8(%rbp), %rax
movq 0x88(%rax), %rsi
leaq -0x298(%rbp), %rdi
callq 0x5520
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rdi
leaq -0x298(%rbp), %rsi
callq 0x12600
leaq -0x298(%rbp), %rdi
callq 0x61d0
movb $0x1, -0x1(%rbp)
jmp 0x9588
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x31a0
jmp 0x9596
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rax
cmpl $0x15e, 0x20(%rax)      # imm = 0x15E
jne 0x9567
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rdx
leaq 0x1c08f(%rip), %rsi     # 0x2554c
leaq -0x2b8(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x124f0
movq -0x3e8(%rbp), %rdi
movq -0x400(%rbp), %rsi
callq 0x9060
jmp 0x94e5
leaq -0x2b8(%rbp), %rdi
callq 0x31a0
movq -0x3e8(%rbp), %rax
movq 0x88(%rax), %rsi
leaq -0x3e0(%rbp), %rdi
callq 0x5520
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rdi
leaq -0x3e0(%rbp), %rsi
callq 0x12600
leaq -0x3e0(%rbp), %rdi
callq 0x61d0
movq -0x3e8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x9300
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x9588
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x31a0
jmp 0x9596
movq -0x3e8(%rbp), %rax
movq 0x80(%rax), %rax
cmpl $0x15d, 0x20(%rax)      # imm = 0x15D
jne 0x9584
movb $0x0, -0x1(%rbp)
jmp 0x9588
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x400, %rsp            # imm = 0x400
popq %rbp
retq
movq -0x168(%rbp), %rdi
callq 0x3420
nopw %cs:(%rax,%rax)