]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
added comments (/*…*/ and //…\n)
[l2e.git] / src / main.cpp
index 424404febe492414d4584d9291037e70717837e9..7a8b425d1a8bea52ddb3f302556f8c1ca5923d3e 100644 (file)
@@ -25,6 +25,7 @@
 #include "graphics/Menu.h"
 #include "graphics/SimpleAnimation.h"
 #include "graphics/Sprite.h"
+#include "loader/Interpreter.h"
 #include "loader/ParsedSource.h"
 #include "loader/Parser.h"
 #include "sdl/InitImage.h"
@@ -34,7 +35,6 @@
 #include <cstdlib>
 #include <ctime>
 #include <exception>
-#include <fstream>
 #include <iostream>
 #include <SDL.h>
 #include <SDL_image.h>
@@ -58,6 +58,7 @@ using graphics::Gauge;
 using graphics::Menu;
 using graphics::SimpleAnimation;
 using graphics::Sprite;
+using loader::Interpreter;
 using loader::ParsedSource;
 using loader::Parser;
 using sdl::InitImage;
@@ -78,12 +79,12 @@ int main(int argc, char **argv) {
 //     std::srand(std::time(0));
 
        try {
-               std::ifstream file("test-data/test.l2s");
                ParsedSource source;
-               Parser parser(file, source);
+               Parser parser("test-data/test.l2s", source);
                parser.Parse();
-
                cout << source;
+               Interpreter intp(source);
+               intp.ReadSource();
 
                return 0;
 
@@ -738,6 +739,9 @@ int main(int argc, char **argv) {
                app.Run();
 
                return 0;
+       } catch (Parser::Error &e) {
+               cerr << "parsing exception in file " << e.File() << " on line " << e.Line() << ": " << e.what() << endl;
+               return 1;
        } catch (exception &e) {
                cerr << "exception in main(): " << e.what() << endl;
                return 1;