// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movl %edx, %ebp
movq %rsi, %r13
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
callq 0x10c10
movw $0x101, 0x51(%rbx)      # imm = 0x101
leaq 0x58(%rbx), %rax
movq %rax, (%rsp)
movl 0x60(%rbx), %r14d
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x15a94(%rip), %rdx     # 0x1a95d
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3c34
incl %r14d
leaq 0x143d9(%rip), %r12     # 0x192bc
decl %r14d
testl %r14d, %r14d
jle 0x4ef8
movq %r15, %rdi
movq %r12, %rsi
callq 0x2380
jmp 0x4ee3
movq %r13, 0x68(%rsp)
leaq 0x1439a(%rip), %rsi     # 0x1929e
leaq 0x8(%rsp), %rdi
callq 0x2380
leaq 0x120(%rsp), %r13
movb $0x1, %r14b
leaq 0x110(%rsp), %r12
xorl %r15d, %r15d
movq 0x80(%rbx), %rdx
movq %r12, %rdi
leaq 0x14387(%rip), %rsi     # 0x192bc
callq 0xddc7
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq (%rsp), %rdi
callq 0x20c0
movq 0x110(%rsp), %rdi
cmpq %r13, %rdi
je 0x4f70
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bpl, %bpl
je 0x4fe7
movq 0x80(%rbx), %rax
cmpl $0x12c, 0x20(%rax)      # imm = 0x12C
jne 0x4fe7
movq 0x88(%rbx), %rsi
movq %r12, %rdi
callq 0x31f0
movq 0x80(%rbx), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x2270
addq $0x20, %r13
movl $0x108, %edx            # imm = 0x108
movq %r13, %rdi
leaq 0x130(%rsp), %rsi
callq 0x2190
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %r13
cmpq %r13, %rdi
je 0x4fe4
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %r14d, %r14d
movq 0x80(%rbx), %rax
movl 0x20(%rax), %ecx
movl $0xfffffefd, %edx       # imm = 0xFFFFFEFD
addl %edx, %ecx
cmpl $0x29, %ecx
ja 0x5010
movabsq $0x2000001c00b, %rdx    # imm = 0x2000001C00B
btq %rcx, %rdx
jae 0x5010
xorl %r14d, %r14d
movl 0x24(%rax), %eax
cmpl 0x78(%rbx), %eax
movzbl %r14b, %r14d
cmovnel %r15d, %r14d
testb $0x1, %r14b
je 0x5083
movq 0x88(%rbx), %rsi
movq %r12, %rdi
callq 0x31f0
movq 0x80(%rbx), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x2270
addq $0x20, %r13
movl $0x108, %edx            # imm = 0x108
movq %r13, %rdi
leaq 0x130(%rsp), %rsi
callq 0x2190
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %r13
cmpq %r13, %rdi
je 0x5083
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
testb $0x1, %r14b
jne 0x4f24
movl 0x78(%rbx), %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r12d
cmpl $0xa, %ebp
jb 0x50ee
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x50e5
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x50eb
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x50ee
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x50b2
addl $-0x3, %r12d
jmp 0x50ee
addl $-0x2, %r12d
jmp 0x50ee
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xf0(%rsp), %rdi
movl $0x2d, %edx
callq 0x2240
leaq 0xf0(%rsp), %r13
addq (%r13), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0xe072
leaq 0x1416c(%rip), %rcx     # 0x192a0
movl $0x13, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
leaq 0x38(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
movq 0x68(%rsp), %r15
je 0x5172
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x5178
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x157c0(%rip), %rsi     # 0x1a95b
callq 0x2380
leaq 0x58(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x51c7
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x51cd
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
callq 0x20c0
leaq 0x80(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5225
movq %rsi, %r13
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
jmp 0x522e
movups (%rcx), %xmm0
movq %rsi, %r13
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x70(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x14043(%rip), %rsi     # 0x19294
callq 0x2380
leaq 0xa0(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5286
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0x528d
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x90(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rdx
callq 0x20c0
leaq 0xc0(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x52e9
movq %rdx, 0xb0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xc0(%rsp)
jmp 0x52f0
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %r14, %r12
movq 0x8(%rax), %rdx
leaq 0xb0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x13f9b(%rip), %rsi     # 0x192b4
callq 0x2380
leaq 0xe0(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x534e
movq %rdx, 0xd0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe0(%rsp)
jmp 0x5355
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0xd0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x20c0
leaq 0x120(%rsp), %rsi
movq %rsi, 0x110(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x53b7
movq %rdx, 0x110(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x120(%rsp)
jmp 0x53bd
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x110(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
callq 0xe420
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %rax
cmpq %rax, %rdi
je 0x5409
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x5426
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x5443
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x5460
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x547a
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x5496
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x54b2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x54cf
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x60(%rbx), %rdx
leaq 0x15483(%rip), %rcx     # 0x1a95d
movq (%rsp), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x22e0
movq 0x80(%rbx), %rax
movl 0x24(%rax), %eax
movl %eax, 0x78(%rbx)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5511
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x564c
movq %rax, %rbx
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %rax
cmpq %rax, %rdi
je 0x5555
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x5555
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x5577
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x5577
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x559c
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x559c
movq %r14, %r12
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0x55c1
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x55c1
movq %r14, %r12
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x55e3
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x55e3
movq %r14, %r12
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x5607
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x5607
movq %r14, %r12
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x562b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x562b
movq %r14, %r12
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x564f
movq 0x100(%rsp), %rsi
jmp 0x568b
jmp 0x564c
jmp 0x564c
jmp 0x564c
jmp 0x564c
jmp 0x564c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x566b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r13, %rdi
je 0x564f
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x564f
nop