Start work on recording parse action conflicts

This commit is contained in:
Max Brunsfeld 2014-04-08 08:19:55 -07:00
parent 1da9f1fdfd
commit 3982b73ed6
12 changed files with 278 additions and 26 deletions

View file

@ -1,6 +1,8 @@
#include "compiler_spec_helper.h"
#include <fstream>
#include "stream_methods.h"
static string src_dir() {
const char * dir = getenv("TREESITTER_DIR");
if (!dir) dir = getenv("PWD");
@ -22,7 +24,11 @@ describe("compiling the example grammars", []() {
auto compile_grammar = [&](const Grammar &grammar, string language) {
it(("compiles the " + language + " grammar").c_str(), [&]() {
ofstream file(example_parser_dir + language + ".c");
file << compile(grammar, language);
auto result = compile(grammar, language);
// cout << "\n conflicts for " << language << "\n:" << result.second;
file << result.first;
file.close();
});
};