39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#include <iostream>
|
|
#include <sstream>
|
|
#include "File.h"
|
|
#include "Global.h"
|
|
#include "Exception.h"
|
|
#include "__jet.h"
|
|
|
|
int main(int argc, char **argv, char **envp) {
|
|
|
|
coreutils::File script(argv[1]);
|
|
script.read();
|
|
coreutils::ZString data = script.asZString();
|
|
data.goeol();
|
|
|
|
jet::Global global(envp);
|
|
|
|
try {
|
|
coreutils::MString out;
|
|
global.errorCursor = data.getCursor();
|
|
jet::__jet *jet = new jet::__jet(data, out, global, NULL, NULL);
|
|
delete jet;
|
|
global.outputHeaders();
|
|
std::cout << out;
|
|
}
|
|
catch(coreutils::Exception e) {
|
|
data.setCursor(global.errorCursor);
|
|
data.moveBackToLineStart();
|
|
std::cout << "-----------------------------" << std::endl;
|
|
std::cout << "Error in jet script '" << argv[1] << "' at line " << data.getLineNumberAtCursor() << std::endl;
|
|
std::cout << "Error text: " << e.text << std::endl;
|
|
std::cout << "-----------------------------" << std::endl;
|
|
std::cout << data.parsed() << std::endl;
|
|
std::cout << "******** Error caught: " << e.text << std::endl;
|
|
std::cout << data.unparsed() << std::endl;
|
|
global.dump();
|
|
}
|
|
|
|
}
|