40 lines
787 B
C++
40 lines
787 B
C++
#ifdef TEST
|
|
#else
|
|
#include <boost/test/unit_test.hpp>
|
|
using namespace boost::unit_test;
|
|
#endif
|
|
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
#include <script_parser.h>
|
|
|
|
using namespace std;
|
|
|
|
int parseScript(const char* path) {
|
|
ifstream script(path, ios::in);
|
|
if (!script.is_open()) {
|
|
perror(path);
|
|
return ENOENT;
|
|
} else {
|
|
string line;
|
|
while(getline(script, line, '\n')) {
|
|
// cout << line <<endl;
|
|
string word;
|
|
istringstream iss(line);
|
|
while(getline(iss, word, ' ')) {
|
|
cout << word << "+";
|
|
}
|
|
cout << endl;
|
|
}
|
|
script.close();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
#ifdef TEST
|
|
int main(int argc, char** argv) {
|
|
parseScript(argv[1]);
|
|
}
|
|
#endif |