Expose debug flag on document
This commit is contained in:
parent
c0a3f8d39c
commit
43ecac2a1d
3 changed files with 9 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ void ts_document_set_language(TSDocument *, const TSLanguage *);
|
|||
void ts_document_set_input(TSDocument *, TSInput);
|
||||
void ts_document_set_input_string(TSDocument *, const char *);
|
||||
void ts_document_edit(TSDocument *, TSInputEdit);
|
||||
void ts_document_set_debug(TSDocument *, int);
|
||||
TSNode *ts_document_root_node(const TSDocument *);
|
||||
|
||||
#define ts_builtin_sym_error 0
|
||||
|
|
|
|||
|
|
@ -291,6 +291,7 @@ describe("Document", [&]() {
|
|||
describe("when the error is an empty string", [&]() {
|
||||
it("computes the error node's size and position correctly", [&]() {
|
||||
ts_document_set_input_string(doc, " [123, , true]");
|
||||
|
||||
AssertThat(ts_node_string(ts_document_root_node(doc)), Equals(
|
||||
"(DOCUMENT (array (number) (ERROR ',') (true)))"));
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ struct TSDocument {
|
|||
TSParser parser;
|
||||
TSInput input;
|
||||
TSNode *node;
|
||||
int debug;
|
||||
};
|
||||
|
||||
TSDocument *ts_document_make() { return calloc(sizeof(TSDocument), 1); }
|
||||
|
|
@ -35,9 +36,15 @@ void ts_document_set_language(TSDocument *document,
|
|||
const TSLanguage *language) {
|
||||
ts_parser_destroy(&document->parser);
|
||||
document->parser = ts_parser_make(language);
|
||||
document->parser.debug = document->debug;
|
||||
reparse(document, NULL);
|
||||
}
|
||||
|
||||
void ts_document_set_debug(TSDocument *document, int debug) {
|
||||
document->debug = debug;
|
||||
document->parser.debug = debug;
|
||||
}
|
||||
|
||||
void ts_document_set_input(TSDocument *document, TSInput input) {
|
||||
document->input = input;
|
||||
reparse(document, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue