// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_ruleparser.h
// Function: BamTools::RuleParser::readToken(BamTools::RuleToken&)
inline
bool RuleParser::readToken(RuleToken& token) {
  
    // skip any preceding whitespace
    skipSpaces();
    if ( m_current == m_end ) return false;

    // clear out prior token value
    token.Value.clear();
    
    // read chars while still in token
    char c = 1;
    bool keepReading = true;
    bool inOperandString = false;
    while ( keepReading && (c != 0) ) {
      
      // get next char
      c = getNextChar();
      switch (c) {
        
          // current char is '('
          case ( LEFT_PARENTHESIS_CHAR ) :
              token.Type = RuleToken::LEFT_PARENTHESIS;
              token.Value.append(1, LEFT_PARENTHESIS_CHAR);
              keepReading = false;
              break;
              
          // current char is ')'
          case ( RIGHT_PARENTHESIS_CHAR ) :
              if ( inOperandString )
                  --m_current;
              else {
                  token.Type = RuleToken::RIGHT_PARENTHESIS;
                  token.Value.append(1, RIGHT_PARENTHESIS_CHAR);
              }
              keepReading = false;
              break;
        
          // current char is '&'
          case ( AND_OPERATOR_CHAR ) :
              if ( inOperandString ) 
                  --m_current;
              else {
                  token.Type = RuleToken::AND_OPERATOR;
                  token.Value.append(1, AND_OPERATOR_CHAR);
              }
              keepReading = false;
              break;
              
          // current char is '|' 
          case ( OR_OPERATOR_CHAR ) :
              if ( inOperandString )
                  --m_current;
              else {  
                  token.Type = RuleToken::OR_OPERATOR;
                  token.Value.append(1, OR_OPERATOR_CHAR);
              }
              keepReading = false;
              break;
              
          // current char is '!'
          case ( NOT_OPERATOR_CHAR ) :
              token.Type = RuleToken::NOT_OPERATOR;
              token.Value.append(1, NOT_OPERATOR_CHAR);
              keepReading = false;
              break;
              
          // current char is ' '
          case ( SPACE_CHAR ) : 
              keepReading = false;
              break;
            
          // current char is a true value token
          default:
              if ( c != 0 ) {
                  token.Type = RuleToken::OPERAND;
                  token.Value.append(1, c);
                  inOperandString = true;
                  keepReading = true;
              }
        }         
    }
      
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x46a70
movq 0x28(%r14), %rax
movq 0x30(%r14), %rcx
movq %rax, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
cmpq %rcx, %rax
je 0x46a3a
leaq 0x8(%rbx), %r15
andq $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rax
movb $0x0, (%rax)
movb $0x1, %r12b
xorl %ebp, %ebp
leaq 0x2b1a6(%rip), %r13     # 0x71b00
movb $0x1, %al
testb %r12b, %r12b
je 0x46a3a
testb $0x1, %al
je 0x46a3a
movq 0x28(%r14), %rcx
xorl %r12d, %r12d
movb $0x1, %al
cmpq 0x30(%r14), %rcx
je 0x4695c
leaq 0x1(%rcx), %rax
movq %rax, 0x28(%r14)
movb (%rcx), %r12b
movzbl %r12b, %eax
leal -0x20(%rax), %edx
cmpl $0x9, %edx
ja 0x469af
xorl %eax, %eax
movslq (%r13,%rdx,4), %rdx
addq %r13, %rdx
jmpq *%rdx
movl $0x3, (%rbx)
movq %r15, %rdi
pushq $0x1
popq %rsi
pushq $0x21
jmp 0x46a2a
testl %eax, %eax
je 0x4695a
cmpl $0x7c, %eax
jne 0x469ce
testb $0x1, %bpl
jne 0x46a16
movl $0x2, (%rbx)
movq %r15, %rdi
pushq $0x1
popq %rsi
pushq $0x7c
jmp 0x46a2a
andl $0x0, (%rbx)
movsbl %r12b, %edx
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x35630
movb $0x1, %al
movb $0x1, %bpl
jmp 0x4695c
testb $0x1, %bpl
jne 0x46a16
movl $0x1, (%rbx)
movq %r15, %rdi
pushq $0x1
popq %rsi
pushq $0x26
jmp 0x46a2a
movl $0x4, (%rbx)
movq %r15, %rdi
pushq $0x1
popq %rsi
pushq $0x28
jmp 0x46a2a
testb $0x1, %bpl
je 0x46a1c
movq %rcx, 0x28(%r14)
jmp 0x46a30
movl $0x5, (%rbx)
movq %r15, %rdi
pushq $0x1
popq %rsi
pushq $0x29
popq %rdx
callq 0x35630
movb $0x1, %r12b
xorl %eax, %eax
jmp 0x4695c
movq 0x8(%rsp), %rax
cmpq %rax, 0x10(%rsp)
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq