// File: 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
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x7570
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x6020
jmp 0x5365
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x75a0
movq %rax, -0xa0(%rbp)
jmp 0x537e
movq -0xa0(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x6040
movb %al, -0xa1(%rbp)
jmp 0x53a1
movb -0xa1(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x53b2
jmp 0x564e
cmpq $0x0, -0x40(%rbp)
jne 0x53cf
jmp 0x5613
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x5da4
movq -0x40(%rbp), %rdi
callq 0x6000
movl %eax, -0xa8(%rbp)
jmp 0x53e0
movl -0xa8(%rbp), %eax
cmpl $0x7, %eax
je 0x5414
movq -0x40(%rbp), %rdi
callq 0x7340
movq %rax, -0xb0(%rbp)
jmp 0x53fd
movq -0xb0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x76d0
jmp 0x540f
jmp 0x5613
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x6080
movb %al, -0xb1(%rbp)
jmp 0x542c
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x545c
jmp 0x5438
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x6040
movb %al, -0xb2(%rbp)
jmp 0x5450
movb -0xb2(%rbp), %al
testb $0x1, %al
jne 0x545c
jmp 0x5461
jmp 0x5613
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x7670
movq %rax, -0xc0(%rbp)
jmp 0x547a
movq -0xc0(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x5491
jmp 0x5613
movq -0x48(%rbp), %rdi
callq 0x6000
movl %eax, -0xc4(%rbp)
jmp 0x54a2
movl -0xc4(%rbp), %eax
cmpl $0x1, %eax
jne 0x54c9
movq -0x48(%rbp), %rdi
callq 0x2aa0
movl %eax, -0xc8(%rbp)
jmp 0x54be
movl -0xc8(%rbp), %eax
cmpl $0x2, %eax
je 0x5522
movq -0x48(%rbp), %rdi
callq 0x6000
movl %eax, -0xcc(%rbp)
jmp 0x54da
movl -0xcc(%rbp), %eax
cmpl $0x2, %eax
jne 0x5501
movq -0x48(%rbp), %rdi
callq 0x2aa0
movl %eax, -0xd0(%rbp)
jmp 0x54f6
movl -0xd0(%rbp), %eax
cmpl $0x2, %eax
je 0x5522
movq -0x48(%rbp), %rdi
callq 0x6000
movl %eax, -0xd4(%rbp)
jmp 0x5512
movl -0xd4(%rbp), %eax
cmpl $0x0, %eax
je 0x5522
jmp 0x5613
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x7610
movq %rax, -0xe0(%rbp)
jmp 0x553b
movq -0xe0(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x5552
jmp 0x5613
movq -0x50(%rbp), %rdi
callq 0x6000
movl %eax, -0xe4(%rbp)
jmp 0x5563
movl -0xe4(%rbp), %eax
cmpl $0x1, %eax
jne 0x558a
movq -0x50(%rbp), %rdi
callq 0x2aa0
movl %eax, -0xe8(%rbp)
jmp 0x557f
movl -0xe8(%rbp), %eax
cmpl $0x1, %eax
je 0x55e0
movq -0x50(%rbp), %rdi
callq 0x6000
movl %eax, -0xec(%rbp)
jmp 0x559b
movl -0xec(%rbp), %eax
cmpl $0x2, %eax
jne 0x55c2
movq -0x50(%rbp), %rdi
callq 0x2aa0
movl %eax, -0xf0(%rbp)
jmp 0x55b7
movl -0xf0(%rbp), %eax
cmpl $0x1, %eax
je 0x55e0
movq -0x50(%rbp), %rdi
callq 0x6000
movl %eax, -0xf4(%rbp)
jmp 0x55d3
movl -0xf4(%rbp), %eax
cmpl $0x0, %eax
je 0x55e0
jmp 0x5613
leaq 0x4bbe(%rip), %rdi      # 0xa1a5
movl $0x5, %esi
movl $0xa, %edx
callq 0x7390
movq %rax, -0x100(%rbp)
jmp 0x55ff
movq -0x100(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x76d0
jmp 0x5611
jmp 0x5613
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x7700
jmp 0x5625
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x75a0
movq %rax, -0x108(%rbp)
jmp 0x563e
movq -0x108(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x5389
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
callq 0x77b0
jmp 0x5660
leaq -0x28(%rbp), %rdi
callq 0x6020
jmp 0x566b
leaq -0x28(%rbp), %rdi
callq 0x75a0
movq %rax, -0x110(%rbp)
jmp 0x567d
movq -0x110(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6040
movb %al, -0x111(%rbp)
jmp 0x5699
movb -0x111(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x56aa
jmp 0x5d79
cmpq $0x0, -0x58(%rbp)
jne 0x56b6
jmp 0x5d4c
leaq -0x28(%rbp), %rdi
callq 0x7670
movq %rax, -0x120(%rbp)
jmp 0x56c8
movq -0x120(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x7610
movq %rax, -0x128(%rbp)
jmp 0x56e5
movq -0x128(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rdi
callq 0x6000
movl %eax, -0x12c(%rbp)
jmp 0x5701
movl -0x12c(%rbp), %eax
cmpl $0x5, %eax
jne 0x5859
movq -0x58(%rbp), %rdi
callq 0x60a0
movq %rax, -0x138(%rbp)
jmp 0x5722
movq -0x138(%rbp), %rdi
leaq 0x4987(%rip), %rsi      # 0xa0b7
callq 0x2080
cmpl $0x0, %eax
jne 0x5859
leaq -0x28(%rbp), %rdi
callq 0x6080
movb %al, -0x139(%rbp)
jmp 0x574f
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x575b
jmp 0x5770
movq -0x58(%rbp), %rdi
movl $0x4, %esi
callq 0x60b0
jmp 0x576b
jmp 0x583e
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x140(%rbp)
jmp 0x5781
movl -0x140(%rbp), %eax
cmpl $0x1, %eax
jne 0x57a8
movq -0x60(%rbp), %rdi
callq 0x2aa0
movl %eax, -0x144(%rbp)
jmp 0x579d
movl -0x144(%rbp), %eax
cmpl $0x2, %eax
je 0x5818
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x148(%rbp)
jmp 0x57b9
movl -0x148(%rbp), %eax
cmpl $0x2, %eax
jne 0x57e0
movq -0x60(%rbp), %rdi
callq 0x2aa0
movl %eax, -0x14c(%rbp)
jmp 0x57d5
movl -0x14c(%rbp), %eax
cmpl $0x2, %eax
je 0x5818
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x150(%rbp)
jmp 0x57f1
movl -0x150(%rbp), %eax
cmpl $0x6, %eax
je 0x5818
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x154(%rbp)
jmp 0x580d
movl -0x154(%rbp), %eax
cmpl $0x0, %eax
jne 0x582a
movq -0x58(%rbp), %rdi
movl $0x8, %esi
callq 0x60d0
jmp 0x5828
jmp 0x583c
movq -0x58(%rbp), %rdi
movl $0x4, %esi
callq 0x60b0
jmp 0x583a
jmp 0x583c
jmp 0x583e
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
movq -0x58(%rbp), %rsi
callq 0x76d0
jmp 0x5854
jmp 0x5d4c
movq -0x58(%rbp), %rdi
callq 0x6000
movl %eax, -0x158(%rbp)
jmp 0x586a
movl -0x158(%rbp), %eax
cmpl $0x5, %eax
jne 0x59a5
movq -0x58(%rbp), %rdi
callq 0x60a0
movq %rax, -0x160(%rbp)
jmp 0x588b
movq -0x160(%rbp), %rdi
leaq 0x4872(%rip), %rsi      # 0xa10b
callq 0x2080
cmpl $0x0, %eax
jne 0x59a5
leaq -0x28(%rbp), %rdi
callq 0x6080
movb %al, -0x161(%rbp)
jmp 0x58b8
movb -0x161(%rbp), %al
testb $0x1, %al
jne 0x58c4
jmp 0x58c9
jmp 0x5d4c
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x168(%rbp)
jmp 0x58da
movl -0x168(%rbp), %eax
cmpl $0x1, %eax
jne 0x5901
movq -0x60(%rbp), %rdi
callq 0x2aa0
movl %eax, -0x16c(%rbp)
jmp 0x58f6
movl -0x16c(%rbp), %eax
cmpl $0x2, %eax
je 0x5971
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x170(%rbp)
jmp 0x5912
movl -0x170(%rbp), %eax
cmpl $0x2, %eax
jne 0x5939
movq -0x60(%rbp), %rdi
callq 0x2aa0
movl %eax, -0x174(%rbp)
jmp 0x592e
movl -0x174(%rbp), %eax
cmpl $0x2, %eax
je 0x5971
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x178(%rbp)
jmp 0x594a
movl -0x178(%rbp), %eax
cmpl $0x6, %eax
je 0x5971
movq -0x60(%rbp), %rdi
callq 0x6000
movl %eax, -0x17c(%rbp)
jmp 0x5966
movl -0x17c(%rbp), %eax
cmpl $0x0, %eax
jne 0x5983
movq -0x58(%rbp), %rdi
movl $0x8, %esi
callq 0x60d0
jmp 0x5981
jmp 0x5988
jmp 0x5d4c
jmp 0x598a
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
movq -0x58(%rbp), %rsi
callq 0x76d0
jmp 0x59a0
jmp 0x5d4c
movq -0x58(%rbp), %rdi
callq 0x6000
movl %eax, -0x180(%rbp)
jmp 0x59b6
movl -0x180(%rbp), %eax
cmpl $0x5, %eax
jne 0x5b2f
movq -0x58(%rbp), %rdi
callq 0x2aa0
movl %eax, -0x184(%rbp)
jmp 0x59d6
movl -0x184(%rbp), %eax
cmpl $0x0, %eax
jne 0x5b2f
cmpb $0x0, 0x884c(%rip)      # 0xe238
jne 0x5a5a
leaq 0x8843(%rip), %rdi      # 0xe238
callq 0x2350
cmpl $0x0, %eax
je 0x5a5a
leaq -0x69(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x2330
movq -0x190(%rbp), %rdx
leaq 0x87fb(%rip), %rdi      # 0xe218
leaq 0x46e9(%rip), %rsi      # 0xa10d
callq 0x5f10
jmp 0x5a2b
leaq -0x69(%rbp), %rdi
callq 0x2260
movq 0x857d(%rip), %rdi      # 0xdfb8
leaq 0x87d6(%rip), %rsi      # 0xe218
leaq 0x878f(%rip), %rdx      # 0xe1d8
callq 0x21b0
leaq 0x87e3(%rip), %rdi      # 0xe238
callq 0x2140
movq -0x58(%rbp), %rdi
callq 0x60f0
movq %rax, -0x198(%rbp)
jmp 0x5a6c
movq -0x198(%rbp), %rax
leaq 0x879e(%rip), %rdi      # 0xe218
xorl %ecx, %ecx
movl %ecx, %edx
movsbl (%rax), %esi
callq 0x2120
cmpq $-0x1, %rax
je 0x5ac4
movq -0x58(%rbp), %rdi
movl $0x5, %esi
callq 0x60d0
jmp 0x5a9c
jmp 0x5b14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x2260
leaq 0x877e(%rip), %rdi      # 0xe238
callq 0x2130
jmp 0x5da4
movq -0x58(%rbp), %rdi
callq 0x60a0
movq %rax, -0x1a0(%rbp)
jmp 0x5ad6
movq -0x1a0(%rbp), %rdi
leaq 0x462d(%rip), %rsi      # 0xa111
callq 0x2080
cmpl $0x0, %eax
jne 0x5b00
movq -0x58(%rbp), %rdi
movl $0x9, %esi
callq 0x60d0
jmp 0x5afe
jmp 0x5b12
movq -0x58(%rbp), %rdi
movl $0x8, %esi
callq 0x60d0
jmp 0x5b10
jmp 0x5b12
jmp 0x5b14
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
movq -0x58(%rbp), %rsi
callq 0x76d0
jmp 0x5b2a
jmp 0x5d4c
movq -0x58(%rbp), %rdi
callq 0x6000
movl %eax, -0x1a4(%rbp)
jmp 0x5b40
movl -0x1a4(%rbp), %eax
cmpl $0x0, %eax
jne 0x5c48
movq -0x58(%rbp), %rdi
callq 0x2aa0
movl %eax, -0x1a8(%rbp)
jmp 0x5b60
movl -0x1a8(%rbp), %eax
cmpl $0x0, %eax
jne 0x5c48
movq -0x58(%rbp), %rdi
callq 0x60a0
movq %rax, -0x1b0(%rbp)
jmp 0x5b81
movq -0x1b0(%rbp), %rdi
callq 0x6cd0
movb %al, -0x1b1(%rbp)
jmp 0x5b95
movb -0x1b1(%rbp), %al
testb $0x1, %al
jne 0x5ba1
jmp 0x5bb3
movq -0x58(%rbp), %rdi
movl $0x4, %esi
callq 0x60d0
jmp 0x5bb1
jmp 0x5c2d
movq -0x58(%rbp), %rdi
callq 0x60a0
movq %rax, -0x1c0(%rbp)
jmp 0x5bc5
movq -0x1c0(%rbp), %rdi
leaq 0x4540(%rip), %rsi      # 0xa113
callq 0x2080
cmpl $0x0, %eax
je 0x5c07
movq -0x58(%rbp), %rdi
callq 0x60a0
movq %rax, -0x1c8(%rbp)
jmp 0x5bef
movq -0x1c8(%rbp), %rdi
leaq 0x451b(%rip), %rsi      # 0xa118
callq 0x2080
cmpl $0x0, %eax
jne 0x5c19
movq -0x58(%rbp), %rdi
movl $0x5, %esi
callq 0x60d0
jmp 0x5c17
jmp 0x5c2b
movq -0x58(%rbp), %rdi
movl $0x7, %esi
callq 0x60d0
jmp 0x5c29
jmp 0x5c2b
jmp 0x5c2d
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
movq -0x58(%rbp), %rsi
callq 0x76d0
jmp 0x5c43
jmp 0x5d4c
movq -0x58(%rbp), %rdi
callq 0x6000
movl %eax, -0x1cc(%rbp)
jmp 0x5c59
movl -0x1cc(%rbp), %eax
cmpl $0x1, %eax
jne 0x5d34
movq -0x58(%rbp), %rdi
callq 0x60a0
movq %rax, -0x1d8(%rbp)
jmp 0x5c7a
movq -0x1d8(%rbp), %rdi
callq 0x2160
cmpq $0x0, %rax
jbe 0x5d32
movq -0x58(%rbp), %rdi
callq 0x60f0
movq %rax, -0x1e0(%rbp)
jmp 0x5ca2
movq -0x1e0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x40, %eax
jne 0x5d30
movq -0x58(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x60a0
movq %rax, -0x1e8(%rbp)
jmp 0x5cca
movq -0x1e8(%rbp), %rsi
leaq -0x90(%rbp), %rdi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x2230
jmp 0x5ceb
leaq -0x90(%rbp), %rdi
callq 0x20c0
movq -0x1f0(%rbp), %rdi
movq %rax, %rsi
callq 0x6110
jmp 0x5d08
leaq -0x90(%rbp), %rdi
callq 0x23a8
jmp 0x5d30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x23a8
jmp 0x5da4
jmp 0x5d32
jmp 0x5d34
movq -0x98(%rbp), %rdi
addq $0x38, %rdi
movq -0x58(%rbp), %rsi
callq 0x76d0
jmp 0x5d4a
jmp 0x5d4c
leaq -0x28(%rbp), %rdi
callq 0x7700
jmp 0x5d57
leaq -0x28(%rbp), %rdi
callq 0x75a0
movq %rax, -0x1f8(%rbp)
jmp 0x5d69
movq -0x1f8(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x5688
movq -0x98(%rbp), %rsi
movq %rsi, %rdi
addq $0x38, %rdi
addq $0x20, %rsi
callq 0x7750
jmp 0x5d92
leaq -0x28(%rbp), %rdi
callq 0x2bb0
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x2bb0
movq -0x30(%rbp), %rdi
callq 0x2320
nopw %cs:(%rax,%rax)