// File: AndrewAlbert[P]Compiler-Theory/SourceCode/parser.cpp
// Function: Parser::ReportLineError(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void Parser::ReportLineError(string message, bool skipSemicolon = true){
	generator->stopCodeGeneration();
	error = true;
	lineError = true;
	
	// Use a '^' under the error text line to indicate where the error was encountered
	int error_location = textLine.size();
	string error_callout = "";
	while(error_location > 0){
		error_location--;
		error_callout.append(" ");
	}
	error_callout.append("^");

	// Get the rest of the line of tokens ( looks for newline or a semicolon )
	bool getNext = true;
	while(getNext){
		textLine.append(" " + token->ascii);
		// attempt to resync for structure keywords
		if(skipSemicolon){
			if( token->type == T_SEMICOLON){
				*token = scanner->getToken();
				getNext = false;
			}
		}
		switch(token->type){
			case T_SEMICOLON: case T_BEGIN: case T_END: case T_PROCEDURE: case T_THEN: case T_ELSE: case T_FOR:
				getNext = false;
				break;
			default:
				break;
		}
		if(token->line != currentLine) getNext = false;
		if(getNext) *token = scanner->getToken();
	}
	error_queue.push("Line Error: line - " + to_string(currentLine) + "\n\t" + message +"\n\tFound: " + textLine + "\n\t       " + error_callout);
	textLine = "";
	currentLine = token->line;
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rsi, -0x3d8(%rbp)
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3d0(%rbp)
movq 0x98(%rax), %rdi
callq 0x19570
movq -0x3d0(%rbp), %rdi
movb $0x1, 0x51(%rdi)
movb $0x1, 0x52(%rdi)
addq $0x58, %rdi
callq 0x31e0
movl %eax, -0x18(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x3430
movq -0x3c8(%rbp), %rdx
leaq 0x1e0c0(%rip), %rsi     # 0x26c81
leaq -0x38(%rbp), %rdi
callq 0x62d0
jmp 0x8bcc
leaq -0x39(%rbp), %rdi
callq 0x32e0
cmpl $0x0, -0x18(%rbp)
jle 0x8c22
movl -0x18(%rbp), %eax
decl %eax
movl %eax, -0x18(%rbp)
leaq 0x1c93a(%rip), %rsi     # 0x25524
leaq -0x38(%rbp), %rdi
callq 0x3480
jmp 0x8bf5
jmp 0x8bd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x32e0
jmp 0x9049
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9040
leaq 0x1c8dd(%rip), %rsi     # 0x25506
leaq -0x38(%rbp), %rdi
callq 0x3480
jmp 0x8c34
movb $0x1, -0x4d(%rbp)
testb $0x1, -0x4d(%rbp)
je 0x8dce
movq -0x3d0(%rbp), %rax
movq %rax, %rcx
addq $0x58, %rcx
movq %rcx, -0x3e0(%rbp)
movq 0x80(%rax), %rdx
leaq 0x1c8bf(%rip), %rsi     # 0x25524
leaq -0x70(%rbp), %rdi
callq 0x124f0
jmp 0x8c70
movq -0x3e0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3490
jmp 0x8c82
leaq -0x70(%rbp), %rdi
callq 0x31a0
testb $0x1, -0x11(%rbp)
je 0x8d0c
movq -0x3d0(%rbp), %rax
movq 0x80(%rax), %rax
cmpl $0x12c, 0x20(%rax)      # imm = 0x12C
jne 0x8d0a
movq -0x3d0(%rbp), %rax
movq 0x88(%rax), %rsi
leaq -0x198(%rbp), %rdi
callq 0x5520
jmp 0x8cc4
movq -0x3d0(%rbp), %rax
movq 0x80(%rax), %rdi
leaq -0x198(%rbp), %rsi
callq 0x12600
leaq -0x198(%rbp), %rdi
callq 0x61d0
movb $0x0, -0x4d(%rbp)
jmp 0x8d0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x31a0
jmp 0x9040
jmp 0x8d0c
movq -0x3d0(%rbp), %rax
movq 0x80(%rax), %rax
movl 0x20(%rax), %eax
movl %eax, -0x3e4(%rbp)
addl $0xfffffefd, %eax       # imm = 0xFFFFFEFD
subl $0x2, %eax
jb 0x8d5f
jmp 0x8d2f
movl -0x3e4(%rbp), %eax
subl $0x106, %eax            # imm = 0x106
je 0x8d5f
jmp 0x8d3e
movl -0x3e4(%rbp), %eax
addl $0xfffffeef, %eax       # imm = 0xFFFFFEEF
subl $0x3, %eax
jb 0x8d5f
jmp 0x8d50
movl -0x3e4(%rbp), %eax
subl $0x12c, %eax            # imm = 0x12C
jne 0x8d65
jmp 0x8d5f
movb $0x0, -0x4d(%rbp)
jmp 0x8d67
jmp 0x8d67
movq -0x3d0(%rbp), %rcx
movq 0x80(%rcx), %rax
movl 0x24(%rax), %eax
cmpl 0x78(%rcx), %eax
je 0x8d81
movb $0x0, -0x4d(%rbp)
testb $0x1, -0x4d(%rbp)
je 0x8dc9
movq -0x3d0(%rbp), %rax
movq 0x88(%rax), %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x5520
jmp 0x8da3
movq -0x3d0(%rbp), %rax
movq 0x80(%rax), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x12600
leaq -0x2c0(%rbp), %rdi
callq 0x61d0
jmp 0x8c38
movq -0x3d0(%rbp), %rax
movq %rax, %rcx
movq %rcx, -0x3f0(%rbp)
movl 0x78(%rax), %esi
leaq -0x3c0(%rbp), %rdi
callq 0x123d0
jmp 0x8df0
leaq 0x1c711(%rip), %rsi     # 0x25508
leaq -0x3a0(%rbp), %rdi
leaq -0x3c0(%rbp), %rdx
callq 0x12380
jmp 0x8e0c
leaq 0x1de6c(%rip), %rdx     # 0x26c7f
leaq -0x380(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x12330
jmp 0x8e28
movq -0x3d8(%rbp), %rdx
leaq -0x360(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x122e0
jmp 0x8e44
leaq 0x1c6b1(%rip), %rdx     # 0x254fc
leaq -0x340(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x12330
jmp 0x8e60
movq -0x3d0(%rbp), %rdx
addq $0x58, %rdx
leaq -0x320(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x122e0
jmp 0x8e80
leaq 0x1c695(%rip), %rdx     # 0x2551c
leaq -0x300(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x12330
jmp 0x8e9c
leaq -0x2e0(%rbp), %rdi
leaq -0x300(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x122e0
jmp 0x8eb5
movq -0x3f0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x122b0
jmp 0x8eca
leaq -0x2e0(%rbp), %rdi
callq 0x31a0
leaq -0x300(%rbp), %rdi
callq 0x31a0
leaq -0x320(%rbp), %rdi
callq 0x31a0
leaq -0x340(%rbp), %rdi
callq 0x31a0
leaq -0x360(%rbp), %rdi
callq 0x31a0
leaq -0x380(%rbp), %rdi
callq 0x31a0
leaq -0x3a0(%rbp), %rdi
callq 0x31a0
leaq -0x3c0(%rbp), %rdi
callq 0x31a0
movq -0x3d0(%rbp), %rdi
addq $0x58, %rdi
leaq 0x1dd45(%rip), %rsi     # 0x26c81
callq 0x3360
jmp 0x8f43
movq -0x3d0(%rbp), %rax
movq 0x80(%rax), %rcx
movl 0x24(%rcx), %ecx
movl %ecx, 0x78(%rax)
leaq -0x38(%rbp), %rdi
callq 0x31a0
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9034
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9028
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x901c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9010
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x9004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x8ff8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x8fec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x31a0
leaq -0x300(%rbp), %rdi
callq 0x31a0
leaq -0x320(%rbp), %rdi
callq 0x31a0
leaq -0x340(%rbp), %rdi
callq 0x31a0
leaq -0x360(%rbp), %rdi
callq 0x31a0
leaq -0x380(%rbp), %rdi
callq 0x31a0
leaq -0x3a0(%rbp), %rdi
callq 0x31a0
leaq -0x3c0(%rbp), %rdi
callq 0x31a0
leaq -0x38(%rbp), %rdi
callq 0x31a0
movq -0x48(%rbp), %rdi
callq 0x3420
nopw %cs:(%rax,%rax)