Allow lexical debug mode to be enabled on documents

- `ts_document_set_debug(doc, 1)` implies parse debug mode
- `ts_document_set_debug(doc, > 1)` implies parse and lex debug mode
This commit is contained in:
Max Brunsfeld 2014-09-11 13:12:06 -07:00
parent 68d6e242ee
commit e23f11b7c4
4 changed files with 21 additions and 11 deletions

View file

@ -37,13 +37,18 @@ static TSTree *accept(TSLexer *lexer, TSSymbol symbol, int is_hidden) {
* this library.
*/
TSLexer ts_lexer_make() {
return (TSLexer) { .chunk = NULL,
.debug = 0,
.chunk_start = 0,
.chunk_size = 0,
.position_in_chunk = 0,
.token_start_position = 0,
.token_end_position = 0,
.advance_fn = advance,
.accept_fn = accept, };
TSLexer result = (TSLexer) { .debug = 0,
.advance_fn = advance,
.accept_fn = accept, };
ts_lexer_reset(&result);
return result;
}
void ts_lexer_reset(TSLexer *lexer) {
lexer->chunk = NULL;
lexer->chunk_start = 0;
lexer->chunk_size = 0;
lexer->position_in_chunk = 0;
lexer->token_start_position = 0;
lexer->token_end_position = 0;
}