jw-python/test/grammar/main.cpp
Jan Lindemann 3cba245b77 grammar.py and friends: Improve line numbers and headers
Line numbers of parsed input are now automatically maintained. More
needed data structures are now automatically created in the API header
file.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-03 12:54:19 +01:00

30 lines
562 B
C++

#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;
}