]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
added test data
[l2e.git] / src / main.cpp
index 424404febe492414d4584d9291037e70717837e9..ddd6b7adcda7cefc261bbb074316eccc1334d6ab 100644 (file)
@@ -34,7 +34,6 @@
 #include <cstdlib>
 #include <ctime>
 #include <exception>
-#include <fstream>
 #include <iostream>
 #include <SDL.h>
 #include <SDL_image.h>
@@ -78,9 +77,8 @@ 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;
@@ -738,6 +736,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;