#include "graphics/Menu.h"
#include "graphics/SimpleAnimation.h"
#include "graphics/Sprite.h"
-#include "loader/Compiler.h"
#include "loader/Interpreter.h"
#include "loader/ParsedSource.h"
#include "loader/Parser.h"
using graphics::Menu;
using graphics::SimpleAnimation;
using graphics::Sprite;
-using loader::Compiler;
using loader::Interpreter;
using loader::ParsedSource;
using loader::Parser;
ParsedSource source;
for (vector<char *>::const_iterator i(args.Infiles().begin()), end(args.Infiles().end()); i != end; ++i) {
- string filePath(*i);
- switch (filePath[filePath.size() - 1]) {
- case 'o':
- // TODO: load object file
- break;
- case 's':
- Parser(filePath, source).Parse();
- break;
- default:
- throw std::runtime_error("don't know what to do with " + filePath);
- }
+ Parser(*i, source).Parse();
}
-// Parser("test-data/test.l2s", source).Parse();
-// Parser("test-data/ikaris.l2s", source).Parse();
-// Parser("test-data/items.l2s", source).Parse();
-// Parser("test-data/spells.l2s", source).Parse();
-// Parser("test-data/constants.l2s", source).Parse();
-
- Interpreter intp(source);
- intp.ReadSource();
-
switch (args.DetectRunLevel()) {
- case Arguments::COMPILE:
+ case Arguments::WRITE:
{
int length(std::strlen(args.OutfilePath()));
switch (args.OutfilePath()[length - 1]) {
source.WriteHeader(outstream);
break;
}
- default:
- case 'o': {
- std::ofstream outstream(args.OutfilePath());
- Compiler(intp).Write(outstream);
- break;
+ default: {
+ throw std::runtime_error(string("don't know how to write file ") + args.OutfilePath());
}
}
return 0;
break;
}
+ Interpreter intp(source);
+ intp.ReadSource();
+
int battleResId(TypeDescription::GetTypeId("BattleResources"));
int heroId(TypeDescription::GetTypeId("Hero"));
int itemId(TypeDescription::GetTypeId("Item"));