// File: /workspace/github_cpp_makefile_star2_O2/Blaze2305[P]Compiler-Design-2021-Assignment/src/Scanner/Scanner.cpp
// Function: Scanner::scanToken()
TokenType Scanner::scanToken(){
	TokenType result;
	switch(this->currentChar){
		case ')':
			result = RParen;
			acceptChar();
			break;
		case '(':
			result = LParen;
			acceptChar();
			break;
		case '\u0000':
			result = EOT;
			break;
		default:
			if(isLetter(this->currentChar)){
				while(isLetter(this->currentChar)){
					acceptChar();
					if(isKeyword(this->currentString)){
						try{
							result = TOKEN_MAP.at(this->currentString);
						}catch(std::out_of_range err){
							result = Identifier;
						}
					}else if(isType(this->currentString)){
						result = Type;
					}else if(isStatement(this->currentString)){
						try{
							result = TOKEN_MAP.at(this->currentString);
						}catch(std::out_of_range err){
							result = Statement;
						}
					}else if(isConditional(this->currentString)){
						result = Conditional;
					}else{
						result = Identifier;
					}
				}
			}else if(isDigit(this->currentChar)){
				while(isDigit(this->currentChar)){
					acceptChar();
					result = Number;
				}
			}else if(isOperator(std::string(1,this->currentChar))){
				while(isOperator(std::string(1,this->currentChar))){
					acceptChar();
				}
				
				// get semicolon ,assignment and colon
				try{
					result = TOKEN_MAP.at(this->currentString);
				}catch(std::out_of_range err){
					if(isOperator(this->currentString)){
						result = Operator;
					}else{
						result = None;
					}
				}
			}
			else{
				result = None;
			}
			break;
	}
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movzbl (%rdi), %eax
testl %eax, %eax
je 0x7cfa
movq %rdi, %rbx
cmpl $0x28, %eax
je 0x7cee
cmpl $0x29, %eax
jne 0x7d13
movq %rbx, %rdi
callq 0x7c12
pushq $0x7
jmp 0x7cfc
movq %rbx, %rdi
callq 0x7c12
pushq $0x6
jmp 0x7cfc
pushq $0x8
popq %r12
movl %r12d, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsbl %al, %edi
callq 0x9385
testb %al, %al
je 0x7e95
leaq 0x8(%rbx), %r14
leaq -0x118(%rbp), %r15
movsbl (%rbx), %edi
callq 0x9385
testb %al, %al
je 0x7cfe
movq %rbx, %rdi
callq 0x7c12
movq %r15, %rdi
movq %r14, %rsi
callq 0x22a0
movq %r15, %rdi
callq 0x945b
movl %eax, %r12d
movq %r15, %rdi
callq 0x23b8
testb %r12b, %r12b
je 0x7d79
leaq 0x8cf4(%rip), %rdi      # 0x10a60
movq %r14, %rsi
callq 0x80e0
movl (%rax), %r12d
jmp 0x7d2e
leaq -0xf8(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x22a0
movq %r12, %rdi
callq 0x93c6
movl %eax, %r13d
movq %r12, %rdi
callq 0x23b8
pushq $0x2
popq %r12
testb %r13b, %r13b
leaq -0xd8(%rbp), %r13
jne 0x7d2e
movq %r13, %rdi
movq %r14, %rsi
callq 0x22a0
movq %r13, %rdi
callq 0x93f2
movl %eax, %r12d
movq %r13, %rdi
callq 0x23b8
testb %r12b, %r12b
je 0x7de2
leaq 0x8c88(%rip), %rdi      # 0x10a60
movq %r14, %rsi
callq 0x80e0
jmp 0x7d74
leaq -0xb8(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x22a0
movq %r13, %rdi
callq 0x941e
movl %eax, %r12d
movq %r13, %rdi
callq 0x23b8
movzbl %r12b, %eax
leal (%rax,%rax,8), %r12d
jmp 0x7d2e
movq %rax, %r13
cmpl $0x1, %edx
jne 0x8036
movq %r13, %rdi
callq 0x2250
leaq -0x38(%rbp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x8130
movq %r13, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x22b0
callq 0x2320
pushq $0x5
popq %r12
jmp 0x7d2e
movq %rax, %r13
cmpl $0x1, %edx
jne 0x8036
movq %r13, %rdi
callq 0x2250
leaq -0x38(%rbp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x8130
movq %r13, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x22b0
callq 0x2320
xorl %r12d, %r12d
jmp 0x7d2e
movsbl (%rbx), %edi
callq 0x9374
testb %al, %al
je 0x7ebf
pushq $0x1
popq %r12
movsbl (%rbx), %edi
callq 0x9374
testb %al, %al
je 0x7cfe
movq %rbx, %rdi
callq 0x7c12
jmp 0x7ea5
movsbl (%rbx), %edx
leaq -0x88(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x98(%rbp), %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x2210
movq %r14, %rdi
callq 0x939a
movl %eax, %r14d
leaq -0x98(%rbp), %rdi
callq 0x23b8
testb %r14b, %r14b
je 0x7f3b
leaq -0x68(%rbp), %r13
leaq -0x78(%rbp), %r14
pushq $0x1
popq %r15
movsbl (%rbx), %edx
movq %r13, -0x78(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2210
movq %r14, %rdi
callq 0x939a
movl %eax, %r12d
movq %r14, %rdi
callq 0x23b8
testb %r12b, %r12b
je 0x7f42
movq %rbx, %rdi
callq 0x7c12
jmp 0x7f07
pushq $0x16
jmp 0x7cfc
addq $0x8, %rbx
leaq 0x8b13(%rip), %rdi      # 0x10a60
movq %rbx, %rsi
callq 0x80e0
movl (%rax), %r12d
jmp 0x7cfe
movq %rax, %r13
cmpl $0x1, %edx
jne 0x8036
movq %r13, %rdi
callq 0x2250
leaq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x8130
movq %r13, %rdi
callq 0x20d0
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x22a0
leaq -0x58(%rbp), %rdi
callq 0x939a
movl %eax, %ebx
leaq -0x58(%rbp), %rdi
callq 0x23b8
testb %bl, %bl
pushq $0x3
popq %rax
pushq $0x16
popq %r12
cmovnel %eax, %r12d
leaq -0x38(%rbp), %rdi
callq 0x22b0
callq 0x2320
jmp 0x7cfe
movq %rax, %r13
leaq -0x58(%rbp), %rdi
callq 0x23b8
jmp 0x7fd6
movq %rax, %r13
leaq -0x38(%rbp), %rdi
callq 0x22b0
callq 0x2320
jmp 0x8036
movq %rax, %rdi
callq 0x5532
movq %rax, %r13
leaq -0x98(%rbp), %rdi
jmp 0x8031
movq %rax, %r13
leaq -0xb8(%rbp), %rdi
jmp 0x8031
movq %rax, %r13
leaq -0xd8(%rbp), %rdi
jmp 0x8031
movq %rax, %r13
leaq -0x78(%rbp), %rdi
jmp 0x8031
movq %rax, %r13
leaq -0xf8(%rbp), %rdi
jmp 0x8031
movq %rax, %r13
leaq -0x118(%rbp), %rdi
callq 0x23b8
movq %r13, %rdi
callq 0x2370