// File: /workspace/github_cpp_makefile_star2_O2/ssubrandon[P]460Project2/SyntacticalAnalyzer.cpp
// Function: SyntacticalAnalyzer::literal()
int SyntacticalAnalyzer::literal(){
  //This function deals with the literal rules (10-12) and will check for syntactical correctness,
  //this function will then, depending on the token seen, send the program to quoted lit or return.
	ruleFile << "Entering literal function; Current token is: " << lex ->GetTokenName(token) << ", lexeme: " << lex->GetLexeme() << endl;

	int errors =0;
	
	if (token == NUMLIT_T)
	{ 
		ruleFile << "Using Rule 10" << endl;
		token = lex->GetToken();
		ruleFile << "Exiting literal function; current token is: " << lex ->GetTokenName (token) << endl;
		return errors;
	}

	
	if (token == STRLIT_T)
	{
		ruleFile << "Using Rule 11" << endl;
		token = lex->GetToken();
		ruleFile << "Exiting literal function; current token is: " << lex ->GetTokenName (token) << endl;
		return errors;
	}


	if ( token == SQUOTE_T )
	{
		ruleFile << "Using Rule 12" << endl;
		ruleFile << "literal function complete. Current token is: " << lex->GetTokenName(token) << endl;
		token = lex->GetToken();
		errors += quoted_lit(); 
	}
	else{
	  if ( token != RPAREN_T){
	    errors++;
	    ReportError(string("expected either NUMLIT_T, STRLIT_T, or SQUOTE_T in literal but got: " + lex->GetTokenName(token)));
	  }
	}
	ruleFile << "Exiting literal function; current token is: " << lex ->GetTokenName (token) << endl;
	return errors;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x420(%rdi), %r14
leaq 0x2957(%rip), %rsi      # 0x8d8d
movq %r14, %rdi
callq 0x21f0
movq %rax, %r15
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %edx
leaq -0x40(%rbp), %r12
movq %r12, %rdi
callq 0x3df8
movq %r15, %rdi
movq %r12, %rsi
callq 0x21d0
leaq 0x248a(%rip), %rsi      # 0x88f0
movq %rax, %rdi
callq 0x21f0
movq %rax, %r15
movq 0x8(%rbx), %rsi
leaq -0x60(%rbp), %rdi
callq 0x3e22
leaq -0x60(%rbp), %rsi
movq %r15, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x2130
leaq -0x60(%rbp), %rdi
callq 0x2398
leaq -0x40(%rbp), %rdi
callq 0x2398
movl 0x10(%rbx), %edx
cmpl $0x21, %edx
je 0x6598
cmpl $0x3, %edx
je 0x6524
cmpl $0x20, %edx
je 0x6590
cmpl $0x2, %edx
jne 0x6605
leaq 0x28ed(%rip), %rsi      # 0x8dbb
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2130
movq 0x8(%rbx), %rdi
callq 0x35fa
movl %eax, 0x10(%rbx)
leaq 0x28d8(%rip), %rsi      # 0x8dc9
movq %r14, %rdi
callq 0x21f0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %edx
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x3df8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x2130
jmp 0x657f
leaq 0x28cb(%rip), %rsi      # 0x8df6
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2130
movq 0x8(%rbx), %rdi
callq 0x35fa
movl %eax, 0x10(%rbx)
leaq 0x287b(%rip), %rsi      # 0x8dc9
movq %r14, %rdi
callq 0x21f0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %edx
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x3df8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x2130
leaq -0x40(%rbp), %rdi
callq 0x2398
xorl %r15d, %r15d
jmp 0x668b
xorl %r15d, %r15d
jmp 0x664a
leaq 0x2865(%rip), %rsi      # 0x8e04
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2130
leaq 0x285c(%rip), %rsi      # 0x8e12
movq %r14, %rdi
callq 0x21f0
movq %rax, %r15
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %edx
movq %r12, %rdi
callq 0x3df8
movq %r15, %rdi
movq %r12, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x2130
leaq -0x40(%rbp), %rdi
callq 0x2398
movq 0x8(%rbx), %rdi
callq 0x35fa
movl %eax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x66de
movl %eax, %r15d
jmp 0x664a
movq 0x8(%rbx), %rsi
leaq -0x60(%rbp), %r15
movq %r15, %rdi
callq 0x3df8
leaq 0x2824(%rip), %rsi      # 0x8e40
leaq -0x40(%rbp), %rdi
movq %r15, %rdx
callq 0x76ba
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x48e6
leaq -0x40(%rbp), %rdi
callq 0x2398
leaq -0x60(%rbp), %rdi
callq 0x2398
pushq $0x1
popq %r15
leaq 0x2778(%rip), %rsi      # 0x8dc9
movq %r14, %rdi
callq 0x21f0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %edx
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x3df8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x2130
leaq -0x40(%rbp), %rdi
callq 0x2398
movl %r15d, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2398
jmp 0x66ac
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
jmp 0x66d1
jmp 0x66ca
jmp 0x66ca
jmp 0x66ca
jmp 0x66ca
jmp 0x66ca
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2398
jmp 0x66cd
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2398
movq %rbx, %rdi
callq 0x2330