moved some more headers

This commit is contained in:
Maieul BOYER 2024-04-30 14:30:58 +02:00
parent 43e276cc1e
commit dfdd8e4503
No known key found for this signature in database
10 changed files with 70 additions and 87 deletions

View file

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error_costs.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/30 14:26:02 by maiboyer #+# #+# */
/* Updated: 2024/04/30 14:26:04 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ERROR_COSTS_H
#define ERROR_COSTS_H
#define ERROR_STATE 0
#define ERROR_COST_PER_RECOVERY 500
#define ERROR_COST_PER_MISSING_TREE 110
#define ERROR_COST_PER_SKIPPED_TREE 100
#define ERROR_COST_PER_SKIPPED_LINE 30
#define ERROR_COST_PER_SKIPPED_CHAR 1
#endif /* ERROR_COSTS_H */

View file

@ -6,21 +6,52 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/23 19:51:24 by maiboyer #+# #+# */
/* Updated: 2024/04/24 23:03:33 by maiboyer ### ########.fr */
/* Updated: 2024/04/30 14:28:34 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef LEXER_H
#define LEXER_H
#include <stdbool.h>
#include <stdint.h>
#include "me/types.h"
#include "parser/api.h"
#include "parser/parser_length.h"
#include "parser/types/types_lexer.h"
#ifndef TREE_SITTER_API_H_
typedef uint16_t t_state_id;
typedef uint16_t t_symbol;
typedef uint16_t t_field_id;
typedef struct s_language t_language;
#endif
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
typedef struct s_liblexer
{
t_lexer data;
t_parse_length current_position;
t_parse_length token_start_position;
t_parse_length token_end_position;
t_parser_range *included_ranges;
const char *chunk;
t_parse_input input;
t_parse_logger 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;
char debug_buffer[TREE_SITTER_SERIALIZATION_BUFFER_SIZE];
} t_liblexer;
void ts_lexer_init(t_liblexer *self);
void ts_lexer_delete(t_liblexer *self);
void ts_lexer_set_input(t_liblexer *self, t_parse_input input);
void ts_lexer_reset(t_liblexer *self, t_parse_length range);
void ts_lexer_start(t_liblexer *self);
void ts_lexer_finish(t_liblexer *self, t_i32 *data);
void ts_lexer_advance_to_end(t_liblexer *self);
void ts_lexer_mark_end(t_liblexer *self);
bool ts_lexer_set_included_ranges(t_liblexer *self,
const t_parser_range *ranges, t_u32 count);
t_parser_range *ts_lexer_included_ranges(const t_liblexer *self, t_u32 *count);
#endif /* LEXER_H */

View file

@ -2,7 +2,7 @@
#define TREE_SITTER_PARSER_H_
#include "../parse_types.h"
#include "./lexer.h"
#include "parser/lexer.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>