jw-python/test/grammar/main.cpp

30 lines
562 B
C++
Raw Normal View History

#include <string>
#include <slog.h>
#include <YMisc.h>
#include "include/grammartest.h"
using namespace std;
int main(int argc, const char *argv[])
{
if (argc < 2) {
fprintf(stderr, "usage: %s input-file\n", filenotdir(argv[0]));
return 1;
}
const char *path = argv[1];
string content;
if (YMisc::suck_in_file(path, content)<0) {
slog(PRI_ERR, "failed to read [%s] (%s)", path, err());
return 1;
}
if (FB_SYM(create_ast)(content.c_str())<0) {
slog(PRI_ERR, "failed to create AST from [%s] (%s)", path, err());
return 1;
}
return 0;
}