Add some edit sequences to corpus tests

This commit is contained in:
Max Brunsfeld 2015-09-22 21:19:19 -07:00
parent d032114d7a
commit 90862dd18f
3 changed files with 27 additions and 9 deletions

View file

@ -1,20 +1,22 @@
#include "tree_sitter/runtime.h"
#include <stdio.h>
static void log_debug(void *data, TSDebugType type, const char *msg) {
static void log_debug(void *payload, TSDebugType type, const char *msg) {
bool include_lexing = (bool)payload;
switch (type) {
case TSDebugTypeParse:
fprintf(stderr, "* %s\n", msg);
break;
case TSDebugTypeLex:
fprintf(stderr, " %s\n", msg);
if (include_lexing)
fprintf(stderr, " %s\n", msg);
break;
}
}
TSDebugger log_debugger_make() {
TSDebugger log_debugger_make(bool include_lexing) {
TSDebugger result;
result.payload = NULL;
result.payload = (void *)include_lexing;
result.debug_fn = log_debug;
return result;
}