1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00
OpenMW/apps/mwcompiler/main.cpp

32 lines
795 B
C++
Raw Normal View History

// Stand-alone MW-script compiler
2010-06-27 17:20:21 +00:00
#include <exception>
#include <iostream>
#include <fstream>
2010-06-27 17:20:21 +00:00
#include <components/compiler/streamerrorhandler.hpp>
#include <components/compiler/scanner.hpp>
#include <components/compiler/fileparser.hpp>
#include <components/compiler/context.hpp>
2010-06-27 17:20:21 +00:00
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");
2010-06-27 17:20:21 +00:00
Compiler::Scanner scanner (errorHandler, file);
scanner.scan (parser);
}
catch (const std::exception &e)
{
std::cout << "\nERROR: " << e.what() << std::endl;
return 1;
}
}