// File: /workspace/github_cpp_makefile_star2_O3/melop[P]admixem/./parser/parser.cpp
// Function: Parser::GetToken(bool)
const Parser::TokenType Parser::GetToken (const bool ignoreSign)
  {
  word_.erase (0, std::string::npos);
  
  // skip spaces
  while (*pWord_ && isspace (*pWord_))
    ++pWord_;

  pWordStart_ = pWord_;   // remember where word_ starts *now*
  
  // look out for unterminated statements and things
  if (*pWord_ == 0 &&  // we have EOF
      type_ == END)  // after already detecting it
    throw std::runtime_error ("Unexpected end of expression.");

  unsigned char cFirstCharacter = *pWord_;        // first character in new word_
  
  if (cFirstCharacter == 0)    // stop at end of file
    {
    word_ = "<end of expression>";
    return type_ = END;
    }
  
  unsigned char cNextCharacter  = *(pWord_ + 1);  // 2nd character in new word_
  
  // look for number
  // can be: + or - followed by a decimal point
  // or: + or - followed by a digit
  // or: starting with a digit
  // or: decimal point followed by a digit
  if ((!ignoreSign &&
	   (cFirstCharacter == '+' || cFirstCharacter == '-') &&
	   (isdigit (cNextCharacter) || cNextCharacter == '.')
	   )
	  || isdigit (cFirstCharacter)
	  // allow decimal numbers without a leading 0. e.g. ".5"
	  // Dennis Jones 01-30-2009
	  || (cFirstCharacter == '.' && isdigit (cNextCharacter)) )
	  {
    // skip sign for now
    if ((cFirstCharacter == '+' || cFirstCharacter == '-'))
      pWord_++;
    while (isdigit (*pWord_) || *pWord_ == '.')
      pWord_++;
    
    // allow for 1.53158e+15
    if (*pWord_ == 'e' || *pWord_ == 'E')
      {
      pWord_++; // skip 'e'
      if ((*pWord_  == '+' || *pWord_  == '-'))
        pWord_++; // skip sign after e
      while (isdigit (*pWord_))  // now digits after e
        pWord_++;      
      }
    
    word_ = std::string (pWordStart_, pWord_ - pWordStart_);
    
    std::istringstream is (word_);
    // parse std::string into double value
    is >> value_;
      
    if (is.fail () || !is.eof ())
      throw std::runtime_error ("Bad numeric literal: " + word_);
    return type_ = NUMBER;
    }   // end of number found

  // special test for 2-character sequences: <= >= == !=
  // also +=, -=, /=, *=
  if (cNextCharacter == '=')
    {
    switch (cFirstCharacter)
      {
      // comparisons
      case '=': type_ = EQ;   break;
      case '<': type_ = LE;   break;
      case '>': type_ = GE;   break;
      case '!': type_ = NE;   break;
      // assignments
      case '+': type_ = ASSIGN_ADD;   break;
      case '-': type_ = ASSIGN_SUB;   break;
      case '*': type_ = ASSIGN_MUL;   break;
      case '/': type_ = ASSIGN_DIV;   break;
      // none of the above
      default:  type_ = NONE; break;
      } // end of switch on cFirstCharacter
    
    if (type_ != NONE)
      {
      word_ = std::string (pWordStart_, 2);
      pWord_ += 2;   // skip both characters
      return type_;
      } // end of found one    
    } // end of *=
  
  switch (cFirstCharacter)
    {
    case '&': if (cNextCharacter == '&')    // &&
                {
                word_ = std::string (pWordStart_, 2);
                pWord_ += 2;   // skip both characters
                return type_ = AND;
                }
              break;
   case '|': if (cNextCharacter == '|')   // ||
                {
                word_ = std::string (pWordStart_, 2);
                pWord_ += 2;   // skip both characters
                return type_ = OR;
                }
              break;
    // single-character symboles
    case '=':
    case '<':
    case '>':
    case '+':
    case '-':
    case '/':
    case '*':
    case '(':
    case ')':
    case ',':
    case '!':
      word_ = std::string (pWordStart_, 1);
      ++pWord_;   // skip it
      return type_ = TokenType (cFirstCharacter);
    } // end of switch on cFirstCharacter
  
  if (!isalpha (cFirstCharacter))
    {
    if (cFirstCharacter < ' ')
      {
      std::ostringstream s;
      s << "Unexpected character (decimal " << int (cFirstCharacter) << ")";
      throw std::runtime_error (s.str ());    
      }
    else
      throw std::runtime_error ("Unexpected character: " + std::string (1, cFirstCharacter));
    }
  
  // we have a word (starting with A-Z) - pull it out
  while (isalnum (*pWord_) || *pWord_ == '_')
    ++pWord_;
  
  word_ = std::string (pWordStart_, pWord_ - pWordStart_);
  return type_ = NAME;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %esi, %ebp
movq %rdi, %rbx
movq $0x0, 0x40(%rdi)
movq 0x38(%rdi), %rax
movb $0x0, (%rax)
movq 0x20(%rdi), %r15
movb (%r15), %al
testb %al, %al
je 0x892e
incq %r15
movsbl %al, %edi
callq 0x7090
testl %eax, %eax
je 0x892b
movq %r15, 0x20(%rbx)
movb (%r15), %al
incq %r15
testb %al, %al
jne 0x8911
decq %r15
movq %r15, 0x28(%rbx)
movzbl (%r15), %r12d
testl %r12d, %r12d
jne 0x8945
cmpl $0x3, 0x30(%rbx)
je 0x8de7
leaq 0x38(%rbx), %r14
testb %r12b, %r12b
je 0x89b3
movzbl 0x1(%r15), %eax
testb %bpl, %bpl
jne 0x897b
cmpl $0x2d, %r12d
je 0x8964
cmpl $0x2b, %r12d
jne 0x897b
leal -0x30(%rax), %ecx
cmpl $0xa, %ecx
setb %cl
cmpb $0x2e, %al
sete %dl
orb %cl, %dl
jne 0x8985
jmp 0x8b29
leal -0x30(%r12), %ecx
cmpl $0xa, %ecx
jae 0x89e0
cmpl $0x2d, %r12d
je 0x8994
movq %r15, %rdx
cmpl $0x2b, %r12d
jne 0x899f
leaq 0x1(%r15), %rdx
movq %rdx, 0x20(%rbx)
movb (%rdx), %r12b
cmpb $0x2e, %r12b
je 0x89f9
movsbl %r12b, %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x8a22
jmp 0x89f9
movq 0x40(%rbx), %rdx
leaq 0x2b716(%rip), %rcx     # 0x340d4
movl $0x13, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x7570
movl $0x3, 0x30(%rbx)
movl $0x3, %r12d
jmp 0x8b14
cmpb $0x2e, %r12b
jne 0x8b29
leal -0x30(%rax), %ecx
movq %r15, %rdx
cmpl $0xa, %ecx
jae 0x8b29
incq %rdx
movq %rdx, 0x20(%rbx)
movsbl (%rdx), %r12d
cmpl $0x2e, %r12d
sete %al
leal -0x30(%r12), %ecx
cmpl $0xa, %ecx
setb %cl
orb %al, %cl
incq %rdx
testb %cl, %cl
jne 0x89fc
decq %rdx
movzbl %r12b, %eax
orl $0x20, %eax
cmpl $0x65, %eax
jne 0x8a75
leaq 0x1(%rdx), %rax
movq %rax, 0x20(%rbx)
movzbl 0x1(%rdx), %ecx
cmpl $0x2d, %ecx
je 0x8a44
cmpl $0x2b, %ecx
jne 0x8a4f
leaq 0x2(%rdx), %rax
movq %rax, 0x20(%rbx)
movb 0x2(%rdx), %cl
movsbl %cl, %ecx
addl $-0x30, %ecx
cmpl $0x9, %ecx
ja 0x8a72
incq %rax
movq %rax, 0x20(%rbx)
movsbl (%rax), %ecx
addl $-0x30, %ecx
incq %rax
cmpl $0xa, %ecx
jb 0x8a5d
decq %rax
movq %rax, %rdx
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xa91c
movq %r14, %rdi
movq %r12, %rsi
callq 0x7460
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x8aaf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x7630
leaq 0x58(%rbx), %rsi
movq %r15, %rdi
callq 0x7220
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x48(%rsp,%rax), %eax
andl $0x7, %eax
cmpl $0x2, %eax
jne 0x8e19
movl $0x2, 0x30(%rbx)
movq 0x3f479(%rip), %rsi     # 0x47f70
leaq 0x28(%rsp), %rdi
callq 0x74f0
leaq 0xa0(%rsp), %rdi
callq 0x7120
movl $0x2, %r12d
movl %r12d, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3d, %eax
jne 0x8b93
cmpl $0x3b, %r12d
jg 0x8b58
leal -0x2a(%r12), %ecx
cmpl $0x5, %ecx
ja 0x8b7c
leaq 0x2b4e3(%rip), %rdx     # 0x34028
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x47, %eax
jmp 0x8d8f
cmpl $0x3e, %r12d
je 0x8d83
cmpl $0x3d, %r12d
je 0x8d8a
cmpl $0x3c, %r12d
jne 0x8b8c
movl $0x3f, %eax
jmp 0x8d8f
cmpl $0x21, %r12d
jne 0x8b8c
movl $0x42, %eax
jmp 0x8d8f
movl $0x0, 0x30(%rbx)
cmpl $0x3e, %r12d
ja 0x8c6c
movl %r12d, %ecx
movabsq $0x7000bf0200000000, %rdx # imm = 0x7000BF0200000000
btq %rcx, %rdx
jae 0x8bff
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movb (%r15), %al
movb %al, (%r13)
movq $0x1, -0x8(%r13)
movb $0x0, 0x1(%r13)
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7460
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x8bf2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
incq 0x20(%rbx)
movl %r12d, 0x30(%rbx)
jmp 0x8b14
cmpq $0x26, %rcx
jne 0x8c6c
cmpl $0x26, %eax
jne 0x8cd5
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movzwl (%r15), %eax
movw %ax, (%r12)
movq $0x2, -0x8(%r12)
movb $0x0, 0x2(%r12)
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7460
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8c55
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x2, 0x20(%rbx)
movl $0x43, 0x30(%rbx)
movl $0x43, %r12d
jmp 0x8b14
cmpl $0x7c, %r12d
jne 0x8cd5
cmpl $0x7c, %eax
jne 0x8cd5
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movzwl (%r15), %eax
movw %ax, (%r12)
movq $0x2, -0x8(%r12)
movb $0x0, 0x2(%r12)
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7460
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8cbe
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x2, 0x20(%rbx)
movl $0x44, 0x30(%rbx)
movl $0x44, %r12d
jmp 0x8b14
movl %r12d, %edi
callq 0x75b0
testl %eax, %eax
je 0x8e67
movsbl (%r15), %ebp
movl %ebp, %edi
callq 0x73a0
cmpl $0x5f, %ebp
je 0x8cfc
movq %r15, %r12
testl %eax, %eax
je 0x8d1f
leaq 0x1(%r15), %r12
movq %r12, 0x20(%rbx)
movsbl (%r12), %ebp
movl %ebp, %edi
callq 0x73a0
incq %r12
cmpl $0x5f, %ebp
je 0x8d00
testl %eax, %eax
jne 0x8d00
decq %r12
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xa91c
movq %r14, %rdi
movq %r13, %rsi
callq 0x7460
movq (%r13), %rdi
cmpq %rbp, %rdi
je 0x8d5c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
movl $0x1, 0x30(%rbx)
movl $0x1, %r12d
jmp 0x8b14
movl $0x48, %eax
jmp 0x8d8f
movl $0x45, %eax
jmp 0x8d8f
movl $0x46, %eax
jmp 0x8d8f
movl $0x40, %eax
jmp 0x8d8f
movl $0x41, %eax
movl %eax, 0x30(%rbx)
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movzwl (%r15), %eax
movw %ax, (%r12)
movq $0x2, -0x8(%r12)
movb $0x0, 0x2(%r12)
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7460
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8dd9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
addq $0x2, 0x20(%rbx)
movl 0x30(%rbx), %r12d
jmp 0x8b14
movl $0x10, %edi
callq 0x7180
movq %rax, %r14
leaq 0x2b2bb(%rip), %rsi     # 0x340b6
movq %rax, %rdi
callq 0x7140
movq 0x3f1e6(%rip), %rsi     # 0x47ff0
movq 0x3f16f(%rip), %rdx     # 0x47f80
movq %r14, %rdi
callq 0x7660
movl $0x10, %edi
callq 0x7180
movq %rax, %r15
leaq 0x2b2bb(%rip), %rsi     # 0x340e8
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x9a1b
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x75d0
xorl %ebp, %ebp
movq 0x3f19d(%rip), %rsi     # 0x47ff0
movq 0x3f126(%rip), %rdx     # 0x47f80
movq %r15, %rdi
callq 0x7660
jmp 0x8f60
cmpb $0x1f, %r12b
ja 0x8ef9
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x74c0
leaq 0x2b279(%rip), %rsi     # 0x340fe
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x7400
leaq 0x28(%rsp), %rdi
movl %r12d, %esi
callq 0x7670
leaq 0x2cb35(%rip), %rsi     # 0x359db
movl $0x1, %edx
movq %rax, %rdi
callq 0x7400
movl $0x10, %edi
callq 0x7180
movq %rax, %r14
leaq 0x30(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x75a0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x75d0
xorl %ebp, %ebp
movq 0x3f108(%rip), %rsi     # 0x47ff0
movq 0x3f091(%rip), %rdx     # 0x47f80
movq %r14, %rdi
callq 0x7660
jmp 0x8f60
movl $0x10, %edi
callq 0x7180
movq %rax, %r14
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movsbl %r12b, %edx
leaq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x7430
leaq 0x2b1f4(%rip), %rsi     # 0x3411d
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x9aa3
movb $0x1, %bpl
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x75d0
xorl %ebp, %ebp
movq 0x3f09f(%rip), %rsi     # 0x47ff0
movq 0x3f028(%rip), %rdx     # 0x47f80
movq %r14, %rdi
callq 0x7660
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f7e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x7390
testb %bpl, %bpl
jne 0x8f88
jmp 0x8ffa
movq %rax, %rbx
movq %r14, %rdi
callq 0x72a0
jmp 0x8ffa
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8fb0
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8fc7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x7390
testb %bpl, %bpl
jne 0x906d
jmp 0x9075
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x906d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x7390
jmp 0x906d
jmp 0x906a
movq %rax, %rbx
movq 0x3ef87(%rip), %rsi     # 0x47f88
leaq 0x28(%rsp), %rdi
callq 0x71c0
leaq 0x98(%rsp), %rdi
jmp 0x9063
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9033
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x7390
testb %bpl, %bpl
jne 0x903d
jmp 0x904a
movq %rax, %rbx
movq %r15, %rdi
callq 0x72a0
jmp 0x904a
movq %rax, %rbx
movq 0x3ef1f(%rip), %rsi     # 0x47f70
leaq 0x28(%rsp), %rdi
callq 0x74f0
leaq 0xa0(%rsp), %rdi
callq 0x7120
jmp 0x9075
movq %rax, %rbx
movq %r14, %rdi
callq 0x72a0
movq %rbx, %rdi
callq 0x76a0
nop