// File: /workspace/github_cpp_makefile_star2_O2/princelab[P]emass/parser.cpp
// Function: Parser::Tokenizer::get_token()
void Parser::Tokenizer::get_token()
{
  States s = START;
  _last = _i;
  for(;;)
    {
      wchar_t c = _input[_i];
      switch(s) {
      case START:
	if(iswspace(c)) {
	  ; // skip whitespace
	} else if(iswdigit(c) || c == L'-') {
	  _ttype = NUM;	
	  _tval = c;
	  s = NUMBER;
	} else if(iswupper(c)) {
	  _ttype = ELEMENT;
	  _tval = c;
	  s = ALPHA;
	} else if(c == L'[') {
	  _ttype = ELEMENT;
	  _tval = L"";
	  s = LITERAL;
	} else if(c == L'(') {
	  _ttype = LPAREN;
	  s = STOP;
	} else if(c == L')') {
	  _ttype = RPAREN;
	  s = STOP;
	} else if(c == L'%') {
	  _ttype = EOS;
	  s = END;
	} else {
	  error(L"Parse error");
	}
	break;
      case ALPHA:
	if(iswlower(c)) {
	  _tval += c;
	} else {
	  return; // we're done
	}
	break;
      case LITERAL:
	if(c == L'%') {
	  error(L"Missing left bracket");
	} else if(c != L']') {
	  _tval += c;
	} else {
	  ++_i; // skip the ']'
	  return; // we're done
	}	
	break;
      case NUMBER:
	if(iswdigit(c)) {
	  _tval += c;
	} else {
	  return; // we're done
	}
	break;
      case END:
	if(_input.find(ENDTOKEN) == _i - 1) {
	  s = STOP;
	} else {
	  error(L"Illegal character: \'%\'");
	}
	break;
      case STOP:
	return; // exit
      }
      ++_i;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq %rax, 0x30(%rdi)
leaq 0x38(%rdi), %r14
leaq 0x8(%rdi), %r15
xorl %ecx, %ecx
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
leaq 0x1b52(%rip), %r12      # 0x71ac
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
pushq $0x3
popq %r13
jmpq *%rcx
movl %ebp, %edi
callq 0x31b0
testl %eax, %eax
jne 0x57b2
movl %ebp, %edi
callq 0x34b0
testl %eax, %eax
setne %al
cmpl $0x2d, %ebp
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x56bc
movl $0x3, (%rbx)
movq %r15, %rdi
movl %ebp, %esi
callq 0x3460
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rcx
movl (%rcx,%rax,4), %ebp
movl %r13d, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl %ebp, %edi
callq 0x33b0
testl %eax, %eax
je 0x56f6
movl $0x4, (%rbx)
movq %r15, %rdi
movl %ebp, %esi
callq 0x3460
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rcx
movl (%rcx,%rax,4), %ebp
pushq $0x1
popq %rcx
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
cmpl $0x25, %ebp
je 0x576b
cmpl $0x28, %ebp
je 0x5790
cmpl $0x29, %ebp
je 0x5746
cmpl $0x5b, %ebp
jne 0x57b6
movl $0x4, (%rbx)
leaq 0x1bf5(%rip), %rsi      # 0x7314
movq %r15, %rdi
callq 0x3270
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rcx
movl (%rcx,%rax,4), %ebp
pushq $0x2
popq %rcx
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl $0x1, (%rbx)
pushq $0x5
popq %rcx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl $0x2, (%rbx)
pushq $0x4
popq %rcx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
andl $0x0, (%rbx)
pushq $0x5
popq %rcx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
xorl %ecx, %ecx
jmp 0x57f2
leaq 0x1b67(%rip), %rsi      # 0x7324
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5eca
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x5b84
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x57e8
jmp 0x594f
callq 0x34c0
jmp 0x5952
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl %ebp, %edi
callq 0x3450
testl %eax, %eax
je 0x5901
movq %r15, %rdi
movl %ebp, %esi
callq 0x30c0
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rcx
movl (%rcx,%rax,4), %ebp
pushq $0x1
popq %rcx
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
cmpl $0x5d, %ebp
je 0x58fa
cmpl $0x25, %ebp
je 0x5910
movq %r15, %rdi
movl %ebp, %esi
callq 0x30c0
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rcx
movl (%rcx,%rax,4), %ebp
pushq $0x2
popq %rcx
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl %ebp, %edi
callq 0x34b0
testl %eax, %eax
je 0x5901
movq %r15, %rdi
movl %ebp, %esi
callq 0x30c0
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rcx
movl (%rcx,%rax,4), %ebp
movl %r13d, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
leaq 0x5a86(%rip), %rsi      # 0xb340
movq %r14, %rdi
xorl %edx, %edx
callq 0x3490
movq 0x28(%rbx), %rdx
decq %rdx
pushq $0x5
popq %rcx
cmpq %rdx, %rax
je 0x57f2
leaq 0x1aca(%rip), %rsi      # 0x73a8
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5eca
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5b84
incq %rax
movq %rax, 0x28(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a3d(%rip), %rsi      # 0x7354
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5eca
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x5b84
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
jmp 0x57e8
jmp 0x594f
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x57e8
movq %rax, %rbx
movq %rbx, %rdi
callq 0x33f0