#include "graphics/Texture.h"
#include "loader/Caster.h"
#include "loader/Interpreter.h"
+#include "loader/Loader.h"
#include "loader/ParsedSource.h"
#include "loader/Parser.h"
#include "loader/TypeDescription.h"
using graphics::Texture;
using loader::Caster;
using loader::Interpreter;
+using loader::Loader;
using loader::ParsedSource;
using loader::Parser;
using loader::TypeDescription;
ParsedSource source;
+ Loader ld;
+
for (vector<char *>::const_iterator i(args.Infiles().begin()), end(args.Infiles().end()); i != end; ++i) {
- Parser(*i, source).Parse();
+ string filePath(*i);
+ switch (filePath[filePath.size() - 1]) {
+ case 'o':
+ ld.Load(filePath);
+ break;
+ case 's':
+ Parser(filePath, source).Parse();
+ break;
+ default:
+ throw std::runtime_error("don't know what to do with " + filePath);
+ }
}
switch (args.GetRunLevel()) {
source.WriteHeader(outstream);
break;
}
+ 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());
}