| 1 |
#ifndef TREE_SITTER_LEXER_H_ |
| 2 |
#define TREE_SITTER_LEXER_H_ |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" { |
| 6 |
#endif |
| 7 |
|
| 8 |
#include "./length.h" |
| 9 |
#include "./subtree.h" |
| 10 |
#include "tree_sitter/api.h" |
| 11 |
#include "./parser.h" |
| 12 |
|
| 13 |
typedef struct { |
| 14 |
uint32_t value; |
| 15 |
bool valid; |
| 16 |
} ColumnData; |
| 17 |
|
| 18 |
typedef struct { |
| 19 |
TSLexer data; |
| 20 |
Length current_position; |
| 21 |
Length token_start_position; |
| 22 |
Length token_end_position; |
| 23 |
|
| 24 |
TSRange *included_ranges; |
| 25 |
const char *chunk; |
| 26 |
TSInput input; |
| 27 |
TSLogger logger; |
| 28 |
|
| 29 |
uint32_t included_range_count; |
| 30 |
uint32_t current_included_range_index; |
| 31 |
uint32_t chunk_start; |
| 32 |
uint32_t chunk_size; |
| 33 |
uint32_t lookahead_size; |
| 34 |
bool did_get_column; |
| 35 |
ColumnData column_data; |
| 36 |
|
| 37 |
char debug_buffer[TREE_SITTER_SERIALIZATION_BUFFER_SIZE]; |
| 38 |
} Lexer; |
| 39 |
|
| 40 |
void ts_lexer_init(Lexer *self); |
| 41 |
void ts_lexer_delete(Lexer *self); |
| 42 |
void ts_lexer_set_input(Lexer *self, TSInput input); |
| 43 |
void ts_lexer_reset(Lexer *self, Length position); |
| 44 |
void ts_lexer_start(Lexer *self); |
| 45 |
void ts_lexer_finish(Lexer *self, uint32_t *lookahead_end_byte); |
| 46 |
void ts_lexer_mark_end(Lexer *self); |
| 47 |
bool ts_lexer_set_included_ranges(Lexer *self, const TSRange *ranges, uint32_t count); |
| 48 |
TSRange *ts_lexer_included_ranges(const Lexer *self, uint32_t *count); |
| 49 |
|
| 50 |
#ifdef __cplusplus |
| 51 |
} |
| 52 |
#endif |
| 53 |
|
| 54 |
#endif // TREE_SITTER_LEXER_H_ |