1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 01:45:33 +00:00
openmw-tes3mp/apps/mwcompiler/main.cpp
2010-06-28 00:50:48 +02:00

33 lines
877 B
C++

// Stand-alone MW-script compiler
#include <exception>
#include <iostream>
#include <fstream>
#include <components/compiler/streamerrorhandler.hpp>
#include <components/compiler/scanner.hpp>
#include <components/compiler/fileparser.hpp>
#include <components/compiler/context.hpp>
int main (int argc, char **argv)
{
try
{
Compiler::Context context;
Compiler::StreamErrorHandler errorHandler (std::cout);
Compiler::FileParser parser (errorHandler, context);
std::ifstream file (argc>1 ? argv[1] : "test.mwscript");
Compiler::Scanner scanner (errorHandler, file);
scanner.scan (parser);
std::cout << "parsed script: " << parser.getName() << std::endl;
}
catch (const std::exception &e)
{
std::cout << "\nERROR: " << e.what() << std::endl;
return 1;
}
}