X-Git-Url: https://gitweb.ps.run/toc/blobdiff_plain/71a20a4f3d4e5f5278f7d004af710af89dfd7ebc..c2ba7425955ae538e220cec79d9124756d1b4c8b:/src/main.cpp diff --git a/src/main.cpp b/src/main.cpp index 4c78f5b..e7c03e6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,14 +7,14 @@ #include "toc.h" #include "repr.h" #include "repr_get.h" -#include "check.h" +//#include "check.h" using namespace antlr4; int main(int argc, const char * argv[]) { - std::ifstream ifs("test.toc"); + std::ifstream ifs("test/test2.toc"); ANTLRInputStream input(ifs); @@ -35,16 +35,23 @@ int main(int argc, const char * argv[]) //std::cout << "Parse Tree: " << s << std::endl; - Program prg = getProgram(prog); + Program prg = getProgram(prog, nullptr); - tocProgram(std::cout, prg); + try + { + tocProgram(std::cout, prg); - if (!checkProgram(prg)) - std::cerr << "Error" << std::endl; + // if (!checkProgram(prg)) + // std::cerr << "Error" << std::endl; - //std::ofstream ofs("output.c"); - //tocProg(ofs, prg); - //ofs.close(); + std::ofstream ofs("output.c"); + tocProgram(ofs, prg); + ofs.close(); + } + catch (const char * e) + { + std::cerr << "Error: " << e << std::endl; + } return 0; } \ No newline at end of file