2017-10-30 13:05:22 +01:00
|
|
|
#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;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-03 12:54:19 +01:00
|
|
|
if (FB_SYM(create_ast)(content.c_str())<0) {
|
|
|
|
|
slog(PRI_ERR, "failed to create AST from [%s] (%s)", path, err());
|
|
|
|
|
return 1;
|
2017-10-30 13:05:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|