// File: /workspace/github_cpp_makefile_star2_O3/navrajsaini[P]PL_Compiler_design_project/scanner.cpp
// Function: Scanner::tokenLine(char*, int)
void Scanner::tokenLine(char now[], int y)
{
   out.open(tokenFileName.c_str(), ios::app);
   string token;
   int prnt, i, b=0;
   //TOKENLINE BLOCK 0
   for(i=0; i<=255; i++)
   {
      ahead=now[i+1];      
      if(isComment(now[i])==true)
      {
	 out.close();
	 return;
      }
      //wiping token for next iteration
      token="";
      while(isSpace(now[i])==true)
      {
	 i++;
	 ahead=now[i+1];
      }
      //TOKENLINE BLOCK 1
      if(isAlpha(now[i])==true)
      {
	 while(isAlpha(now[i])==true)
	 {
	    token.push_back(now[i]);
	    i++;
	    ahead=now[i+1];
	    //just incase there is a numeral inside the word
	    while(isNumeric(now[i])==true)
	    {
	       token.push_back(now[i]);
	       i++;
	       ahead=now[i+1];
	    }	    
	 }
	 //call to store token and move to next token, in this case an alpha
	 prnt = getToken(token);
	 out<<prnt<<" ";
	 i--;
	 ahead=now[i+1];
      }
      //TOKENLINE BLOCK 2
      else if(isNumeric(now[i])==true)
      {
	 while(isNumeric(now[i])==true)
	 {	    
	    token.push_back(now[i]);
	    i++;
	    ahead=now[i+1];	    
	 }
	 if(isAlpha(now[i]==true))
	 {	    
	    cout<<endl<<spellS(BADNAME)<<" on line:" ;
	    return;
	 }
	 //call to store token and move to next token, in this case a numeric
	 prnt = getNum(token);
	 //minus 1 becasue it was incrimnted inside getnum
	 lineToke[TN-1][2] = numericVAl(token);
	 out<<prnt<<" ";
	 i--;
	 ahead=now[i+1];
      }
      //TOKENLINE BLOCK 3
      else if(isSpecial(now[i])==true)
      {
	 token.push_back(now[i]);
	 if(now[i]==':'&&ahead=='=')
	 {
	    token.push_back(ahead);
	    i++;
	    ahead=now[i+1];	    
	 }
	 else if(now[i]=='-'&&ahead=='>')
	 {
	    token.push_back(ahead);
	    i++;
	    ahead=now[i+1];	    
	 }
	 else if(now[i]=='['&&ahead==']')
	 {
	    token.push_back(ahead);
	    i++;
	    ahead=now[i+1];
	    
	 }else
	 {
	 }
	 if(now[i]==92)
	 {
	    prnt = getToken("%");
	    out<<prnt<<" ";
	 }
	 else
	 {
	    //call to store token and move to next token, in this case an alpha
	    prnt = getToken(token);
	    out<<prnt<<" ";
	 }
      }
      //TOKENLINE BLOCK 4
      else if(token=="")
      {
	 //the case of if token is empty is the same as if now[i] is empty
	 //since token has not been initialised to anything from before.
      }
      else
      {	 
	 cout<<endl<<token<<" is a not identified token on line: "<<LN;
	 cout<<endl;
      }
      
   }
   out.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r14
movq %rdi, %r15
addq $0xc30, %rdi            # imm = 0xC30
movq 0xe50(%r15), %rsi
movq %rdi, -0x50(%rbp)
movl $0x1, %edx
callq 0x2040
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x28(%r15), %rax
movq %rax, -0x78(%rbp)
leaq 0x1(%r14), %rax
movq %rax, -0x80(%rbp)
xorl %ebx, %ebx
movslq %ebx, %r12
movb 0x1(%r14,%r12), %al
movb %al, (%r15)
cmpb $0x24, (%r14,%r12)
je 0xb87c
movq -0x40(%rbp), %rdx
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
leaq 0x8510(%rip), %rcx      # 0x1390e
xorl %r8d, %r8d
callq 0x22b0
leaq (%r14,%r12), %r13
movb (%r13), %al
cmpb $0x20, %al
jne 0xb42c
addq %r14, %r12
movq %r12, %r13
movb 0x2(%r13), %al
movb %al, (%r15)
movb 0x1(%r13), %al
incq %r13
incl %ebx
cmpb $0x20, %al
je 0xb418
cmpb $0x41, %al
jl 0xb4f8
cmpb $0x5b, %al
setb %cl
leal -0x61(%rax), %edx
cmpb $0x1a, %dl
setb %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0xb60c
movslq %ebx, %rax
leaq (%r14,%rax), %r12
movb (%r14,%rax), %al
cmpb $0x41, %al
jl 0xb714
cmpb $0x5b, %al
setb %cl
leal -0x61(%rax), %edx
cmpb $0x1a, %dl
setb %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0xb714
movsbl %al, %esi
leaq -0x48(%rbp), %rdi
callq 0x2190
movb 0x2(%r12), %al
movslq %ebx, %r12
movb %al, (%r15)
movb 0x1(%r14,%r12), %al
incq %r12
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0xb4ed
movq -0x80(%rbp), %rcx
leaq (%rcx,%r12), %r13
shlq $0x20, %r12
movsbl %al, %esi
leaq -0x48(%rbp), %rdi
callq 0x2190
movslq %ebx, %rbx
movb 0x3(%r14,%rbx), %al
movb %al, (%r15)
movb (%r13), %al
leal -0x30(%rax), %ecx
incl %ebx
movabsq $0x100000000, %rdx      # imm = 0x100000000
addq %rdx, %r12
incq %r13
cmpb $0xa, %cl
jb 0xb4ac
incl %ebx
sarq $0x20, %r12
movb (%r14,%r12), %al
jmp 0xb4f0
movl %r12d, %ebx
addq %r14, %r12
jmp 0xb458
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0xb60c
movslq %ebx, %r12
movb (%r14,%r12), %al
leal -0x30(%rax), %ecx
addq %r14, %r12
cmpb $0x9, %cl
ja 0xb53c
movsbl %al, %esi
leaq -0x48(%rbp), %rdi
callq 0x2190
movb 0x2(%r12), %al
movb %al, (%r15)
movb 0x1(%r12), %al
incq %r12
leal -0x30(%rax), %ecx
incl %ebx
cmpb $0xa, %cl
jb 0xb516
leaq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x424c
movq %r15, %rdi
leaq -0xc0(%rbp), %rsi
callq 0xb2c8
movl %eax, %r13d
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0xb58b
callq 0x21b0
leaq -0xf0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x100(%rbp), %rdi
callq 0x424c
leaq -0x100(%rbp), %rsi
callq 0xb92e
movslq 0xc2c(%r15), %rcx
leaq (%rcx,%rcx,2), %rcx
movq -0x78(%rbp), %rdx
movl %eax, -0x4(%rdx,%rcx,4)
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0xb5e7
callq 0x21b0
movq -0x50(%rbp), %rdi
movl %r13d, %esi
callq 0x22f0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x830b(%rip), %rsi      # 0x1390d
callq 0x2210
jmp 0xb783
movsbl %al, %r12d
movl %r12d, %esi
callq 0xb1aa
testb %al, %al
je 0xb65d
leaq -0x48(%rbp), %rdi
movl %r12d, %esi
callq 0x2190
movzbl (%r13), %eax
cmpl $0x2d, %eax
je 0xb79b
cmpl $0x5b, %eax
leaq -0x70(%rbp), %r12
je 0xb791
cmpl $0x3a, %eax
jne 0xb7bc
movb $0x3d, %al
cmpb $0x3d, (%r15)
je 0xb7a7
jmp 0xb7bc
leaq -0x48(%rbp), %rdi
leaq 0x82a6(%rip), %rsi      # 0x1390e
callq 0x2080
testl %eax, %eax
je 0xb86b
movq 0xd94c(%rip), %rcx      # 0x18fc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0xd92e(%rip), %rdi      # 0x18fc8
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rax, %rdi
callq 0x2210
movq %rax, %r12
movl $0x24, %edx
movq %rax, %rdi
leaq 0x7e2b(%rip), %rsi      # 0x134f4
callq 0x2210
movl 0xc28(%r15), %esi
movq %r12, %rdi
callq 0x22f0
movq 0xd8e4(%rip), %rcx      # 0x18fc8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0xd8c6(%rip), %rdi      # 0x18fc8
callq 0x2030
movq %rax, %rdi
callq 0x2140
jmp 0xb86b
leaq -0xd0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x424c
movq %r15, %rdi
leaq -0xe0(%rbp), %rsi
callq 0xb214
movl %eax, %r13d
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0xb763
callq 0x21b0
movq -0x50(%rbp), %rdi
movl %r13d, %esi
callq 0x22f0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x818f(%rip), %rsi      # 0x1390d
callq 0x2210
decl %ebx
movb (%r12), %al
movb %al, (%r15)
jmp 0xb86b
movb $0x5d, %al
cmpb $0x5d, (%r15)
je 0xb7a7
jmp 0xb7bc
movb $0x3e, %al
cmpb $0x3e, (%r15)
leaq -0x70(%rbp), %r12
jne 0xb7bc
movzbl %al, %esi
leaq -0x48(%rbp), %rdi
callq 0x2190
incl %ebx
movb 0x2(%r13), %al
movb %al, (%r15)
movslq %ebx, %rax
cmpb $0x5c, (%r14,%rax)
jne 0xb7fc
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq %r12, %rdi
leaq 0x7aee(%rip), %rsi      # 0x132c6
leaq 0x7ae8(%rip), %rdx      # 0x132c7
callq 0x42ea
movq %r15, %rdi
movq %r12, %rsi
callq 0xb214
movl %eax, %r12d
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
jmp 0xb841
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x424c
movq %r15, %rdi
leaq -0xa0(%rbp), %rsi
callq 0xb214
movl %eax, %r12d
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0xb84b
callq 0x21b0
movq -0x50(%rbp), %rdi
movl %r12d, %esi
callq 0x22f0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x80a7(%rip), %rsi      # 0x1390d
callq 0x2210
leal 0x1(%rbx), %eax
cmpl $0xff, %ebx
movl %eax, %ebx
jl 0xb3d7
movq -0x50(%rbp), %rdi
callq 0x2270
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xb897
callq 0x21b0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb903
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
jmp 0xb8f1
jmp 0xb903
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
jmp 0xb8f1
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
jmp 0xb8f1
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0xb906
callq 0x21b0
jmp 0xb906
jmp 0xb903
jmp 0xb903
jmp 0xb903
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xb918
callq 0x21b0
movq %rbx, %rdi
callq 0x2310