Refactoring some stuff in the parser lib, moving functions out of headers

This commit is contained in:
Maix0 2024-07-04 00:43:43 +02:00
parent 4580d68951
commit fb3a2d94a0
19 changed files with 522 additions and 608 deletions

View file

@ -1,42 +1,41 @@
#ifndef TREE_SITTER_LEXER_H_
#define TREE_SITTER_LEXER_H_
#ifndef LEXER_H
#define LEXER_H
#include "./api.h"
#include "./length.h"
#include "./parser.h"
#include "me/types.h"
typedef struct Lexer
struct Lexer
{
TSLexer data;
Length current_position;
Length token_start_position;
Length token_end_position;
TSLexer data;
Length current_position;
Length token_start_position;
Length token_end_position;
TSRange *included_ranges;
const t_u8 *chunk;
TSInput input;
TSLogger logger;
t_u32 included_range_count;
t_u32 current_included_range_index;
t_u32 chunk_start;
t_u32 chunk_size;
t_u32 lookahead_size;
bool did_get_column;
t_u8 debug_buffer[TREE_SITTER_SERIALIZATION_BUFFER_SIZE];
};
t_u32 included_range_count;
t_u32 current_included_range_index;
t_u32 chunk_start;
t_u32 chunk_size;
t_u32 lookahead_size;
bool did_get_column;
typedef struct Lexer Lexer;
t_u8 debug_buffer[TREE_SITTER_SERIALIZATION_BUFFER_SIZE];
} Lexer;
void ts_lexer_init(Lexer *);
void ts_lexer_delete(Lexer *);
void ts_lexer_set_input(Lexer *, TSInput);
void ts_lexer_reset(Lexer *, Length);
void ts_lexer_start(Lexer *);
void ts_lexer_finish(Lexer *, t_u32 *);
void ts_lexer_advance_to_end(Lexer *);
void ts_lexer_mark_end(Lexer *);
void ts_lexer_init(Lexer *self);
void ts_lexer_delete(Lexer *self);
void ts_lexer_set_input(Lexer *self, TSInput input);
void ts_lexer_reset(Lexer *self, Length length);
void ts_lexer_start(Lexer *self);
void ts_lexer_finish(Lexer *self, t_u32 *lookahead);
void ts_lexer_advance_to_end(Lexer *self);
void ts_lexer_mark_end(Lexer *self);
bool ts_lexer_set_included_ranges(Lexer *self, const TSRange *ranges, t_u32 count);
TSRange *ts_lexer_included_ranges(const Lexer *self, t_u32 *count);
#endif // TREE_SITTER_LEXER_H_
#endif // LEXER_H