// File: /workspace/github_cpp_makefile_star2_O1/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
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %r12
cmpq %r12, %rax
je 0x3d63c
movabsq $0x100002600, %rcx      # imm = 0x100002600
movzbl (%rax), %edx
cmpq $0x20, %rdx
ja 0x3d63c
btq %rdx, %rcx
jae 0x3d63c
incq %rax
movq %rax, 0x28(%r14)
cmpq %r12, %rax
jne 0x3d621
movq 0x28(%r14), %rax
movq %rax, 0x10(%rsp)
cmpq %r12, %rax
je 0x3d7b9
leaq 0x8(%rbx), %rax
movq %rax, (%rsp)
movq $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rax
movb $0x0, (%rax)
movb $0x1, %r15b
movq $0x0, 0x8(%rsp)
leaq 0x354ec(%rip), %rbp     # 0x72b64
movq 0x28(%r14), %rax
cmpq 0x30(%r14), %rax
je 0x3d68f
leaq 0x1(%rax), %rcx
movq %rcx, 0x28(%r14)
movb (%rax), %r13b
jmp 0x3d692
xorl %r13d, %r13d
movzbl %r13b, %eax
leal -0x20(%rax), %ecx
cmpl $0x9, %ecx
ja 0x3d6cb
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
movl $0x3, (%rbx)
movq 0x10(%rbx), %rsi
xorl %r15d, %r15d
movl $0x1, %ecx
movq (%rsp), %rdi
xorl %edx, %edx
movl $0x21, %r8d
jmp 0x3d7a5
testl %eax, %eax
je 0x3d7aa
cmpl $0x7c, %eax
jne 0x3d706
testb $0x1, 0x8(%rsp)
jne 0x3d77e
movl $0x2, (%rbx)
movq 0x10(%rbx), %rsi
xorl %r15d, %r15d
movl $0x1, %ecx
movq (%rsp), %rdi
xorl %edx, %edx
movl $0x7c, %r8d
jmp 0x3d7a5
movl $0x0, (%rbx)
movq 0x10(%rbx), %rsi
movsbl %r13b, %r8d
movl $0x1, %ecx
movq (%rsp), %rdi
xorl %edx, %edx
callq 0x27bd0
movb $0x1, %r15b
movb $0x1, %al
movq %rax, 0x8(%rsp)
jmp 0x3d7aa
testb $0x1, 0x8(%rsp)
jne 0x3d77e
movl $0x1, (%rbx)
movq 0x10(%rbx), %rsi
xorl %r15d, %r15d
movl $0x1, %ecx
movq (%rsp), %rdi
xorl %edx, %edx
movl $0x26, %r8d
jmp 0x3d7a5
movl $0x4, (%rbx)
movq 0x10(%rbx), %rsi
xorl %r15d, %r15d
movl $0x1, %ecx
movq (%rsp), %rdi
xorl %edx, %edx
movl $0x28, %r8d
jmp 0x3d7a5
testb $0x1, 0x8(%rsp)
je 0x3d787
decq 0x28(%r14)
xorl %r15d, %r15d
jmp 0x3d7aa
movl $0x5, (%rbx)
movq 0x10(%rbx), %rsi
xorl %r15d, %r15d
movl $0x1, %ecx
movq (%rsp), %rdi
xorl %edx, %edx
movl $0x29, %r8d
callq 0x27bd0
testb %r13b, %r13b
je 0x3d7b9
testb $0x1, %r15b
jne 0x3d678
cmpq %r12, 0x10(%rsp)
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq