// File: /workspace/github_cpp_makefile_star2_O3/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, 0x68(%rsp)
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
callq 0x10b34
movw $0x101, 0x51(%rbx)      # imm = 0x101
leaq 0x58(%rbx), %rax
movq %rax, 0x20(%rsp)
movl 0x60(%rbx), %r14d
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x15a7d(%rip), %rdx     # 0x1a95d
movq %rsp, %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3c42
incl %r14d
leaq 0x143c4(%rip), %r12     # 0x192bc
decl %r14d
testl %r14d, %r14d
jle 0x4f0d
movq %r15, %rdi
movq %r12, %rsi
callq 0x2380
jmp 0x4ef8
leaq 0x1438a(%rip), %rsi     # 0x1929e
movq %rsp, %rdi
callq 0x2380
leaq 0x120(%rsp), %r14
movb $0x1, %r13b
leaq 0x110(%rsp), %r12
xorl %r15d, %r15d
movq 0x80(%rbx), %rdx
movq %r12, %rdi
leaq 0x14379(%rip), %rsi     # 0x192bc
callq 0xdcc7
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq 0x20(%rsp), %rdi
callq 0x20c0
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0x4f7f
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x80(%rbx), %rax
testb %bpl, %bpl
je 0x4ffd
cmpl $0x12c, 0x20(%rax)      # imm = 0x12C
jne 0x4ffd
movq 0x88(%rbx), %rsi
movq %r12, %rdi
callq 0x31f0
movq 0x80(%rbx), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x2270
addq $0x20, %r14
movl $0x108, %edx            # imm = 0x108
movq %r14, %rdi
leaq 0x130(%rsp), %rsi
callq 0x2190
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %rax
cmpq %rax, %rdi
je 0x4ff3
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x80(%rbx), %rax
xorl %r13d, %r13d
movl 0x20(%rax), %ecx
movl $0xfffffefd, %edx       # imm = 0xFFFFFEFD
addl %edx, %ecx
cmpl $0x29, %ecx
ja 0x501f
movabsq $0x2000001c00b, %rdx    # imm = 0x2000001C00B
btq %rcx, %rdx
jae 0x501f
xorl %r13d, %r13d
movl 0x24(%rax), %eax
cmpl 0x78(%rbx), %eax
movzbl %r13b, %r13d
cmovnel %r15d, %r13d
testb $0x1, %r13b
je 0x509b
movq 0x88(%rbx), %rsi
movq %r12, %rdi
callq 0x31f0
movq 0x80(%rbx), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x2270
addq $0x20, %r14
movl $0x108, %edx            # imm = 0x108
movq %r14, %rdi
leaq 0x130(%rsp), %rsi
callq 0x2190
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %r14
cmpq %r14, %rdi
je 0x4f32
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x4f32
movl 0x78(%rbx), %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
movl $0x1, %r12d
cmpl $0xa, %ebp
jb 0x50fc
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x50f3
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x50f9
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x50fc
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x50c0
addl $-0x3, %r12d
jmp 0x50fc
addl $-0x2, %r12d
jmp 0x50fc
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x48(%rsp), %rdi
movl $0x2d, %edx
callq 0x2240
leaq 0x48(%rsp), %r14
addq (%r14), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0xdf80
leaq 0x14168(%rip), %rcx     # 0x192a0
movl $0x13, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
leaq 0x80(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5178
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
jmp 0x5180
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x70(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x157b8(%rip), %rsi     # 0x1a95b
callq 0x2380
leaq 0xa0(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x51d8
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0x51df
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x90(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x68(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x20c0
leaq 0xc0(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x523f
movq %rdx, 0xb0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xc0(%rsp)
jmp 0x5246
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0xb0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x14028(%rip), %rsi     # 0x19294
callq 0x2380
leaq 0x38(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5298
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x529e
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)
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rdx
callq 0x20c0
leaq 0xe0(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x52f7
movq %rdx, 0xd0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe0(%rsp)
jmp 0x52ff
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0xd0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x13f8f(%rip), %rsi     # 0x192b4
callq 0x2380
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x535a
movq %rdx, 0xf0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x100(%rsp)
jmp 0x5361
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0xf0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rsi
movq 0x8(%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 0x53c2
movq %rdx, 0x110(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x120(%rsp)
jmp 0x53c8
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 0xe32e
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %rax
cmpq %rax, %rdi
je 0x5414
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x5431
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xd0(%rsp), %rdi
cmpq %r13, %rdi
je 0x544e
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
leaq 0x10(%rsp), %r13
je 0x546f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xb0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x548c
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x54a9
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x54c3
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x54df
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x60(%rbx), %rdx
leaq 0x15473(%rip), %rcx     # 0x1a95d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x22e0
movq 0x80(%rbx), %rax
movl 0x24(%rax), %eax
movl %eax, 0x78(%rbx)
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x551c
movq 0x10(%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 0x5646
movq %rax, %rbx
movq 0x110(%rsp), %rdi
leaq 0x120(%rsp), %rax
cmpq %rax, %rdi
je 0x5560
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x5560
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x5582
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x5582
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r13, %rdi
je 0x55a4
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x55a4
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x55c5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x55c5
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x55e7
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x55e7
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x5609
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x5609
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x5628
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x5628
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x5670
movq 0x58(%rsp), %rsi
jmp 0x5668
jmp 0x564b
jmp 0x564b
jmp 0x564b
jmp 0x564b
movq %rax, %rbx
jmp 0x5675
movq %rax, %rbx
jmp 0x5670
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0x5670
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x10(%rsp), %r13
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x568b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
nop