// File: /workspace/github_cpp_makefile_star2_O2/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 0x3e60
leaq 0x38(%rbx), %r14
andq $0x0, 0x38(%rbx)
movq %r14, %rdi
callq 0x3e70
leaq 0x1dc8(%rip), %r15      # 0x51a1
pushq $0xa
popq %r12
leaq -0x48(%rbp), %r13
movq 0x38(%rbx), %rcx
movq 0x48(%rbx), %rdx
subq 0x40(%rbx), %rdx
sarq $0x3, %rdx
cmpq %rdx, %rcx
jae 0x3499
testq %rax, %rax
je 0x3484
cmpl $0x7, 0x20(%rax)
jne 0x3471
testq %rcx, %rcx
je 0x3484
movq %r14, %rdi
callq 0x3eba
testq %rax, %rax
je 0x3484
movl 0x20(%rax), %ecx
testl %ecx, %ecx
je 0x3432
cmpl $0x2, %ecx
je 0x342c
cmpl $0x1, %ecx
jne 0x3484
cmpl $0x2, 0x24(%rax)
jne 0x3484
movq %r14, %rdi
callq 0x3e94
testq %rax, %rax
je 0x3484
movl 0x20(%rax), %ecx
testl %ecx, %ecx
je 0x3456
cmpl $0x2, %ecx
je 0x3450
cmpl $0x1, %ecx
jne 0x3484
cmpl $0x1, 0x24(%rax)
jne 0x3484
movq %r15, %rdi
pushq $0x5
popq %rsi
movl %r12d, %edx
callq 0x3d38
movq %r13, %rdi
movq %rax, %rsi
callq 0x3ed4
jmp 0x3484
movq %rax, %rdi
callq 0x3d22
movq %r13, %rdi
movq %rax, %rsi
callq 0x3ed4
movq %r14, %rdi
callq 0x3ef8
movq %r14, %rdi
callq 0x3e70
jmp 0x33e1
movq %r14, %rdi
callq 0x3f42
leaq -0x48(%rbp), %rdi
andq $0x0, (%rdi)
callq 0x3e70
movq %rax, %r12
leaq -0x48(%rbp), %r13
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
sarq $0x3, %rax
cmpq %rax, -0x48(%rbp)
jae 0x370f
testq %r12, %r12
je 0x36a1
movq %r13, %rdi
callq 0x3eba
movq %rax, %r15
movq %r13, %rdi
callq 0x3e94
movl 0x20(%r12), %eax
cmpl $0x5, %eax
jne 0x358b
movq %r12, %rdi
leaq 0x1c10(%rip), %rsi      # 0x510f
callq 0x2070
testl %eax, %eax
je 0x3632
movl 0x20(%r12), %eax
cmpl $0x5, %eax
jne 0x358b
movq %r12, %rdi
leaq 0x1c43(%rip), %rsi      # 0x5163
callq 0x2070
testl %eax, %eax
je 0x3665
movl 0x20(%r12), %eax
cmpl $0x5, %eax
jne 0x358b
cmpl $0x0, 0x24(%r12)
jne 0x3696
movb 0x4c4f(%rip), %al       # 0x8198
testb %al, %al
je 0x36b9
movq (%r12), %rax
movsbl (%rax), %esi
leaq 0x4c19(%rip), %rdi      # 0x8178
xorl %edx, %edx
callq 0x21a0
pushq $0x5
popq %rcx
cmpq $-0x1, %rax
jne 0x35e6
movq %r12, %rdi
leaq 0x1bf0(%rip), %rsi      # 0x5169
callq 0x2070
cmpl $0x1, %eax
movl $0x0, %ecx
adcl $0x8, %ecx
jmp 0x35e6
cmpl $0x1, %eax
je 0x35f0
testl %eax, %eax
jne 0x3696
cmpl $0x0, 0x24(%r12)
jne 0x3696
movq %r12, %rdi
callq 0x3b64
pushq $0x4
popq %rcx
testb %al, %al
jne 0x35e6
movq %r12, %rdi
leaq 0x1bae(%rip), %rsi      # 0x516b
callq 0x2070
pushq $0x5
popq %rcx
testl %eax, %eax
je 0x35e6
movq %r12, %rdi
leaq 0x1b9d(%rip), %rsi      # 0x5170
callq 0x2070
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
leal 0x5(,%rcx,2), %ecx
movl %ecx, 0x24(%r12)
jmp 0x3696
cmpq $0x0, 0x8(%r12)
je 0x3696
movq (%r12), %rax
cmpb $0x40, (%rax)
jne 0x3696
leaq -0x68(%rbp), %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2190
movq -0x68(%rbp), %rsi
movq %r12, %rdi
callq 0x2250
leaq -0x68(%rbp), %rdi
callq 0x2268
jmp 0x3696
cmpq $0x0, -0x48(%rbp)
je 0x365a
movl 0x20(%r15), %eax
cmpq $0x6, %rax
ja 0x365a
leaq 0x1a8e(%rip), %rcx      # 0x50d8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x2, 0x24(%r15)
je 0x368d
movl $0x4, 0x20(%r12)
jmp 0x3696
cmpq $0x0, -0x48(%rbp)
je 0x36a1
movl 0x20(%r15), %eax
cmpq $0x6, %rax
ja 0x36a1
leaq 0x1a3f(%rip), %rcx      # 0x50bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x2, 0x24(%r15)
jne 0x36a1
movl $0x8, 0x24(%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0x3ed4
movq %r13, %rdi
callq 0x3ef8
movq %r13, %rdi
callq 0x3e70
movq %rax, %r12
jmp 0x34b5
leaq 0x4ad8(%rip), %rdi      # 0x8198
callq 0x2230
testl %eax, %eax
je 0x3551
leaq 0x4aa4(%rip), %rdi      # 0x8178
leaq 0x1a8a(%rip), %rsi      # 0x5165
leaq -0x68(%rbp), %rdx
callq 0x3812
movq 0x48d5(%rip), %rdi      # 0x7fc0
leaq 0x4a86(%rip), %rsi      # 0x8178
leaq 0x4a3f(%rip), %rdx      # 0x8138
callq 0x2140
leaq 0x4a93(%rip), %rdi      # 0x8198
callq 0x20f0
jmp 0x3551
addq $0x20, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3f20
leaq -0x40(%rbp), %rdi
callq 0x26cc
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x4a58(%rip), %rdi      # 0x8198
callq 0x20e0
jmp 0x376a
jmp 0x3767
jmp 0x3767
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x2268
jmp 0x376a
jmp 0x3767
jmp 0x3767
jmp 0x3767
jmp 0x3767
jmp 0x3767
jmp 0x3767
jmp 0x3767
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x26cc
movq %rbx, %rdi
callq 0x2210
nop