// File: /workspace/github_cpp_makefile_star2_O2/matteorr[P]EarleyParser/EarleyParser.cpp
// Function: EarleyParser::createInputStringVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void EarleyParser::createInputStringVector( string filePath )
{
	string line;
	ifstream inputFile;
	string inputStringToParse;

	inputFile.open( filePath.c_str(), fstream::in );

	if( inputFile.is_open() )
	{
		/*
		 * reads a line (production) from the context free input grammar
		 */
		getline( inputFile, line );

		/*
		 * extracts words of the input string
		 * separated by " "
		 */
		this->splitToVector( line, & this->inputVector, " ", false );

		for( unsigned int i = 0; i < this->inputVector.size(); i++ ){
			cout << "[DEBUG]: " << "line token: [" << this->inputVector.at(i) << "]" << endl;

			EarleyParser::dictionaryHashTable::iterator got = this->earleyDictionary.find( this->inputVector.at(i) );
			if( got != this->earleyDictionary.end() )
			{
				/*
				 * element found in hash table (key tokenVector->at(i) contained)
				 */
				if( i == 0 )
					inputStringToParse += got->second;
				else
					inputStringToParse = inputStringToParse + " " + got->second;

			}else{
				/*
				 * element not found in hash table (key tokenVector->at(i) not contained)
				 * error in input string, word not contained in dictionary
				 */
				cout << "[DEBUG]: BAD INPUT STRING!word " << this->inputVector.at(i) << " not contained in dictionary" << endl << endl;
				exit(1);
			}
		}

		cout << "[DEBUG]: input string of parser [" << inputStringToParse << "]" << endl << endl;

		inputFile.close();

		/*
		 * extracts words of the input string to parse
		 * separated by " "
		 */
		this->splitToVector( inputStringToParse, & this->inputVector, " ", false );

		for( unsigned int i = 0; i < this->inputVector.size(); i++ ){
			cout << "[DEBUG]: " << "input vector element: [" << this->inputVector.at(i) << "]" << endl;
		}


	}else{
		cout << "Error: not able to open input file [" << filePath << "]" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x88(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x2c0(%rbp), %rdi
callq 0x21f0
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r14), %rsi
leaq -0x2c0(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2140
leaq -0x248(%rbp), %rdi
callq 0x2070
testb %al, %al
je 0x33b5
leaq -0x2c0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x2040
leaq 0x532e(%rip), %rsi      # 0x85a1
leaq -0x50(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0x20c0
leaq 0x98(%rbx), %rdx
leaq -0x98(%rbp), %rsi
leaq -0x50(%rbp), %rcx
xorl %r15d, %r15d
movq %rdx, -0x30(%rbp)
xorl %r8d, %r8d
callq 0x2d42
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq 0x48(%rbx), %rax
movq %rax, -0x58(%rbp)
leaq -0xb8(%rbp), %r14
movl %r15d, %r15d
movq 0xa0(%rbx), %rax
subq 0x98(%rbx), %rax
sarq $0x5, %rax
cmpq %r15, %rax
jbe 0x341d
movq 0x9cf7(%rip), %rdi      # 0xcfd8
leaq 0x4d38(%rip), %rsi      # 0x8020
callq 0x21c0
movq %rax, %rdi
leaq 0x4d38(%rip), %rsi      # 0x802f
callq 0x21c0
movq %rax, %r12
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x4c0a
movq %r12, %rdi
movq %rax, %rsi
callq 0x2190
movq %rax, %rdi
leaq 0x4d1d(%rip), %rsi      # 0x803d
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x4c0a
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x5978
movq %rax, %r12
testq %rax, %rax
je 0x351a
testq %r15, %r15
je 0x339d
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
leaq 0x523d(%rip), %rdx      # 0x85a1
callq 0x4d65
addq $0x28, %r12
leaq -0x50(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x4d3c
leaq -0x78(%rbp), %rdi
movq %r13, %rsi
callq 0x2210
movq %r13, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x20f0
jmp 0x33ad
addq $0x28, %r12
leaq -0x78(%rbp), %rdi
movq %r12, %rsi
callq 0x22e0
incl %r15d
jmp 0x32bc
movq 0x9c1c(%rip), %rdi      # 0xcfd8
leaq 0x4d72(%rip), %rsi      # 0x8135
callq 0x21c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x2190
leaq 0x4c63(%rip), %rsi      # 0x803d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
leaq -0x78(%rbp), %rdi
callq 0x20f0
leaq -0x2c0(%rbp), %rdi
callq 0x2080
leaq -0x98(%rbp), %rdi
callq 0x20f0
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9bb4(%rip), %rdi      # 0xcfd8
leaq 0x4dd4(%rip), %rsi      # 0x81ff
callq 0x21c0
leaq -0x78(%rbp), %rsi
movq %rax, %rdi
callq 0x2190
leaq 0x4bfa(%rip), %rsi      # 0x803d
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
leaq -0x2c0(%rbp), %rdi
callq 0x2060
leaq 0x5133(%rip), %rsi      # 0x85a1
leaq -0x50(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0x20c0
leaq -0x78(%rbp), %rsi
leaq -0x50(%rbp), %rcx
xorl %r15d, %r15d
movq -0x30(%rbp), %rdx
xorl %r8d, %r8d
callq 0x2d42
leaq -0x50(%rbp), %rdi
callq 0x20f0
movq 0x9b33(%rip), %r14      # 0xcfd8
leaq 0x4b91(%rip), %r13      # 0x803d
movl %r15d, %r15d
movq 0xa0(%rbx), %rax
subq 0x98(%rbx), %rax
sarq $0x5, %rax
cmpq %r15, %rax
jbe 0x33ea
movq %r14, %rdi
leaq 0x4b4c(%rip), %rsi      # 0x8020
callq 0x21c0
movq %rax, %rdi
leaq 0x4d3e(%rip), %rsi      # 0x8221
callq 0x21c0
movq %rax, %r12
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x4c0a
movq %r12, %rdi
movq %rax, %rsi
callq 0x2190
movq %rax, %rdi
movq %r13, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
incl %r15d
jmp 0x34ac
movq 0x9ab7(%rip), %rdi      # 0xcfd8
leaq 0x4c9a(%rip), %rsi      # 0x81c2
callq 0x21c0
movq %rax, %rbx
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x4c0a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2190
leaq 0x4c94(%rip), %rsi      # 0x81e2
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
pushq $0x1
popq %rdi
callq 0x2200
jmp 0x3572
jmp 0x359d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x358e
jmp 0x359d
movq %rax, %rbx
jmp 0x35b5
jmp 0x359d
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x20f0
jmp 0x35a0
jmp 0x359d
jmp 0x359d
jmp 0x359d
jmp 0x359d
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x20f0
leaq -0x2c0(%rbp), %rdi
callq 0x2080
leaq -0x98(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x22c0
nop