// File: /workspace/github_cpp_makefile_star2_O1/lishen2[P]Excel_formula_parser_cpp/FormulaParser.cpp
// Function: ExcelFormula::FormulaParser::parserToToken2()
void FormulaParser::parserToToken2()
	{
		// move tokenList to new set, excluding unnecessary white-space m_tmpAry and converting necessary ones to intersections

		TokenArray tmpAry2;
		m_tmpAry.reset();
		for(Token* pToken = m_tmpAry.getCurrent();
				!m_tmpAry.isEOF(); 
				m_tmpAry.moveNext(),pToken = m_tmpAry.getCurrent())
		{
			if (pToken == NULL) continue;

			if (pToken->getType() != Token::Whitespace) {
				tmpAry2.add(pToken->clone());
				continue;        
			}

			if (m_tmpAry.isBOF() || m_tmpAry.isEOF()) continue;

			Token* previous = m_tmpAry.getPrevious();

			if (previous == NULL) continue;

			if (!(
						((previous->getType() == Token::Function) && (previous->getSubtype() == Token::Stop)) || 
						((previous->getType() == Token::Subexpression) && (previous->getSubtype() == Token::Stop)) || 
						(previous->getType() == Token::Operand)
				 )
			   ) continue;

			Token* next = m_tmpAry.getNext();

			if (next == NULL) continue;

			if (!(
						((next->getType() == Token::Function) && (next->getSubtype() == Token::Start)) || 
						((next->getType() == Token::Subexpression) && (next->getSubtype() == Token::Start)) ||
						(next->getType() == Token::Operand)
				 )
			   ) continue;

			tmpAry2.add(MakeToken("", Token::OperatorInfix, Token::Intersection));
		}

		// move m_tmpAry to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators 
		// to noop when appropriate, identifying operand and infix-operator subtypes, and pulling "@" from function names

		m_tmpAry.releaseAll();
		tmpAry2.reset();
		for(Token* pToken = tmpAry2.getCurrent();
				!tmpAry2.isEOF();
				tmpAry2.moveNext(), pToken = tmpAry2.getCurrent())
		{
			if (pToken == NULL) continue;

			Token* previous = tmpAry2.getPrevious();
			Token* next = tmpAry2.getNext();

			if ((pToken->getType() == Token::OperatorInfix) && (pToken->getStrValue().compare("-") == 0)) {
				if (tmpAry2.isBOF())
					pToken->setType(Token::OperatorPrefix);
				else if (
						((previous->getType() == Token::Function) && (previous->getSubtype() == Token::Stop)) || 
						((previous->getType() == Token::Subexpression) && (previous->getSubtype() == Token::Stop)) || 
						(previous->getType() == Token::OperatorPostfix) || 
						(previous->getType() == Token::Operand)
						)
					pToken->setSubtype(Token::Math);
				else
					pToken->setType(Token::OperatorPrefix);

				m_tmpAry.add(pToken);
				continue;          
			}

			if ((pToken->getType() == Token::OperatorInfix) && (pToken->getStrValue().compare("+") == 0)) {
				if (tmpAry2.isBOF())
					continue;
				else if (
						((previous->getType() == Token::Function) && (previous->getSubtype() == Token::Stop)) || 
						((previous->getType() == Token::Subexpression) && (previous->getSubtype() == Token::Stop)) || 
						(previous->getType() == Token::OperatorPostfix) || 
						(previous->getType() == Token::Operand)
						)
					pToken->setSubtype(Token::Math);
				else
					continue;

				m_tmpAry.add(pToken);
				continue;          
			}

			if ((pToken->getType() == Token::OperatorInfix) && (pToken->getSubtype() == Token::Nothing)) {
				static string marks("<>=");
				if (marks.find_first_of(*(pToken->getValue())) != string::npos) 
					pToken->setSubtype(Token::Logical);
				else if (pToken->getStrValue().compare("&") == 0)
					pToken->setSubtype(Token::Concatenation);
				else
					pToken->setSubtype(Token::Math);

				m_tmpAry.add(pToken);
				continue;
			}

			if ((pToken->getType() == Token::Operand) && (pToken->getSubtype() == Token::Nothing)) {
				if (StrUtils::is_number(pToken->getStrValue()))
					pToken->setSubtype(Token::Number);
				else
					if ((pToken->getStrValue().compare("TRUE") == 0) || (pToken->getStrValue().compare("FALSE") == 0))
						pToken->setSubtype(Token::Logical);
					else
						pToken->setSubtype(Token::Range);

				m_tmpAry.add(pToken);
				continue;
			}

			if (pToken->getType() == Token::Function) {
				if (pToken->getStrValue().size() > 0) {
					if (*(pToken->getValue()) == '@') {
						pToken->setValue(pToken->getStrValue().substr(1).c_str());
					}
				}
			}

			m_tmpAry.add(pToken);
		}//while

		m_tmpAry.toVector(m_tokens);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq -0x48(%rbp), %rdi
callq 0x43d0
leaq 0x38(%rbx), %r14
movq $0x0, 0x38(%rbx)
movq %r14, %rdi
callq 0x43e0
leaq 0x1ab4(%rip), %r15      # 0x51ec
leaq -0x48(%rbp), %r12
movq 0x38(%rbx), %rcx
movq 0x48(%rbx), %rdx
subq 0x40(%rbx), %rdx
sarq $0x3, %rdx
cmpq %rdx, %rcx
jae 0x382e
testq %rax, %rax
je 0x3819
cmpl $0x7, 0x20(%rax)
jne 0x3806
testq %rcx, %rcx
je 0x3819
movq %r14, %rdi
callq 0x442a
testq %rax, %rax
je 0x3819
movl 0x20(%rax), %ecx
testl %ecx, %ecx
je 0x37b0
cmpl $0x2, %ecx
je 0x37a6
cmpl $0x1, %ecx
jne 0x3819
cmpl $0x2, 0x24(%rax)
je 0x37b0
testl %ecx, %ecx
je 0x37b0
cmpl $0x2, %ecx
jne 0x3819
testl %ecx, %ecx
je 0x37b0
cmpl $0x2, 0x24(%rax)
jne 0x3819
movq %r14, %rdi
callq 0x4404
testq %rax, %rax
je 0x3819
movl 0x20(%rax), %ecx
testl %ecx, %ecx
je 0x37e7
cmpl $0x2, %ecx
je 0x37dd
cmpl $0x1, %ecx
jne 0x3819
cmpl $0x1, 0x24(%rax)
je 0x37e7
testl %ecx, %ecx
je 0x37e7
cmpl $0x2, %ecx
jne 0x3819
testl %ecx, %ecx
je 0x37e7
cmpl $0x1, 0x24(%rax)
jne 0x3819
movq %r15, %rdi
movl $0x5, %esi
movl $0xa, %edx
callq 0x4268
movq %r12, %rdi
movq %rax, %rsi
callq 0x4444
jmp 0x3819
movq %rax, %rdi
callq 0x4252
movq %r12, %rdi
movq %rax, %rsi
callq 0x4444
movq %r14, %rdi
callq 0x447e
movq %r14, %rdi
callq 0x43e0
jmp 0x373c
movq %r14, %rdi
callq 0x44c8
leaq -0x48(%rbp), %rdi
movq $0x0, (%rdi)
callq 0x43e0
movq %rax, %r13
leaq -0x48(%rbp), %r15
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
sarq $0x3, %rax
cmpq %rax, -0x48(%rbp)
jae 0x3b53
testq %r13, %r13
je 0x3ad8
movq %r15, %rdi
callq 0x442a
movq %rax, %r12
movq %r15, %rdi
callq 0x4404
cmpl $0x5, 0x20(%r13)
jne 0x389d
movq %r13, %rdi
leaq 0x187f(%rip), %rsi      # 0x510f
callq 0x2080
testl %eax, %eax
je 0x3977
cmpl $0x5, 0x20(%r13)
jne 0x38bb
movq %r13, %rdi
leaq 0x18b5(%rip), %rsi      # 0x5163
callq 0x2080
testl %eax, %eax
je 0x39d5
movl 0x20(%r13), %eax
testl %eax, %eax
je 0x38e9
cmpl $0x1, %eax
je 0x38fd
cmpl $0x5, %eax
jne 0x3acd
cmpl $0x0, 0x24(%r13)
je 0x3a7e
cmpl $0x1, %eax
je 0x38fd
testl %eax, %eax
jne 0x3acd
cmpl $0x0, 0x24(%r13)
je 0x3a3b
cmpl $0x1, %eax
jne 0x3acd
cmpq $0x0, 0x8(%r13)
je 0x3acd
movq (%r13), %rax
cmpb $0x40, (%rax)
jne 0x3acd
movl $0x1, %edx
leaq -0x70(%rbp), %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x2190
movq -0x70(%rbp), %r12
movq 0x8(%r13), %rax
movq %rax, -0x50(%rbp)
movq %r12, %rdi
callq 0x20c0
movq %r13, %rdi
xorl %esi, %esi
movq -0x50(%rbp), %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x2210
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3acd
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x3acd
cmpq $0x0, -0x48(%rbp)
je 0x39c8
movl 0x20(%r12), %eax
cmpq $0x6, %rax
ja 0x39c8
leaq 0x1748(%rip), %rdx      # 0x50d8
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x2, 0x24(%r12)
je 0x3a2e
testl %eax, %eax
je 0x3a2e
cmpl $0x6, %eax
je 0x3a2e
cmpl $0x2, %eax
jne 0x39c8
cmpl $0x2, 0x24(%r12)
je 0x3a2e
cmpl $0x6, %eax
je 0x3a2e
testl %eax, %eax
je 0x3a2e
movl $0x4, 0x20(%r13)
jmp 0x3acd
cmpq $0x0, -0x48(%rbp)
je 0x3ad8
movl 0x20(%r12), %eax
cmpq $0x6, %rax
ja 0x3ad8
leaq 0x16c6(%rip), %rdx      # 0x50bc
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x2, 0x24(%r12)
je 0x3a2e
testl %eax, %eax
je 0x3a2e
cmpl $0x6, %eax
je 0x3a2e
cmpl $0x2, %eax
jne 0x3ad8
cmpl $0x2, 0x24(%r12)
je 0x3a2e
cmpl $0x6, %eax
je 0x3a2e
testl %eax, %eax
jne 0x3ad8
movl $0x8, 0x24(%r13)
jmp 0x3acd
movq %r13, %rdi
callq 0x4062
movl $0x4, %ecx
testb %al, %al
jne 0x3ac9
movq %r13, %rdi
leaq 0x1715(%rip), %rsi      # 0x516b
callq 0x2080
testl %eax, %eax
je 0x3ac4
movq %r13, %rdi
leaq 0x1707(%rip), %rsi      # 0x5170
callq 0x2080
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
leal 0x5(,%rcx,2), %ecx
jmp 0x3ac9
movb 0x472c(%rip), %al       # 0x81b0
testb %al, %al
je 0x3af0
movq (%r13), %rax
movsbl (%rax), %esi
leaq 0x46fa(%rip), %rdi      # 0x8190
xorl %edx, %edx
callq 0x21b0
movl $0x5, %ecx
cmpq $-0x1, %rax
jne 0x3ac9
movq %r13, %rdi
leaq 0x16b7(%rip), %rsi      # 0x5169
callq 0x2080
cmpl $0x1, %eax
movl $0x0, %ecx
adcl $0x8, %ecx
jmp 0x3ac9
movl $0x5, %ecx
movl %ecx, 0x24(%r13)
movq %r14, %rdi
movq %r13, %rsi
callq 0x4444
movq %r15, %rdi
callq 0x447e
movq %r15, %rdi
callq 0x43e0
movq %rax, %r13
jmp 0x384d
leaq 0x46b9(%rip), %rdi      # 0x81b0
callq 0x2270
testl %eax, %eax
je 0x3a88
leaq 0x4699(%rip), %rax      # 0x81a0
movq %rax, 0x4682(%rip)      # 0x8190
leaq 0x467b(%rip), %rdi      # 0x8190
leaq 0x1649(%rip), %rsi      # 0x5165
leaq 0x1645(%rip), %rdx      # 0x5168
callq 0x3eda
movq 0x4491(%rip), %rdi      # 0x7fc0
leaq 0x465a(%rip), %rsi      # 0x8190
leaq 0x4613(%rip), %rdx      # 0x8150
callq 0x2150
leaq 0x4667(%rip), %rdi      # 0x81b0
callq 0x20f0
jmp 0x3a88
addq $0x20, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x44a6
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3b77
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x4620(%rip), %rdi      # 0x81b0
callq 0x20e0
jmp 0x3bca
jmp 0x3bc7
jmp 0x3bc7
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3bca
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x3bca
jmp 0x3bc7
jmp 0x3bc7
jmp 0x3bc7
jmp 0x3bc7
jmp 0x3bc7
jmp 0x3bc7
jmp 0x3bc7
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3bdf
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq %rbx, %rdi
callq 0x2250
nop