moved some more headers
This commit is contained in:
parent
43e276cc1e
commit
dfdd8e4503
10 changed files with 70 additions and 87 deletions
23
parser/includes/error_costs.h
Normal file
23
parser/includes/error_costs.h
Normal 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 */
|
||||||
|
|
@ -6,21 +6,52 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/04/23 19:51:24 by maiboyer #+# #+# */
|
/* 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
|
#ifndef LEXER_H
|
||||||
#define LEXER_H
|
#define LEXER_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include "me/types.h"
|
||||||
#include <stdint.h>
|
#include "parser/api.h"
|
||||||
|
#include "parser/parser_length.h"
|
||||||
|
#include "parser/types/types_lexer.h"
|
||||||
|
|
||||||
#ifndef TREE_SITTER_API_H_
|
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
||||||
typedef uint16_t t_state_id;
|
|
||||||
typedef uint16_t t_symbol;
|
typedef struct s_liblexer
|
||||||
typedef uint16_t t_field_id;
|
{
|
||||||
typedef struct s_language t_language;
|
t_lexer data;
|
||||||
#endif
|
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 */
|
#endif /* LEXER_H */
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#define TREE_SITTER_PARSER_H_
|
#define TREE_SITTER_PARSER_H_
|
||||||
|
|
||||||
#include "../parse_types.h"
|
#include "../parse_types.h"
|
||||||
#include "./lexer.h"
|
#include "parser/lexer.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef TREE_SITTER_ERROR_COSTS_H_
|
|
||||||
#define TREE_SITTER_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
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "./lexer.h"
|
#include "parser/lexer.h"
|
||||||
#include "parser/parser_length.h"
|
#include "parser/parser_length.h"
|
||||||
#include "./subtree.h"
|
#include "./subtree.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* lexer.h :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2024/04/29 16:17:29 by maiboyer #+# #+# */
|
|
||||||
/* Updated: 2024/04/29 16:55:37 by maiboyer ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#ifndef TREE_SITTER_LEXER_H_
|
|
||||||
#define TREE_SITTER_LEXER_H_
|
|
||||||
|
|
||||||
#include "parser/parser_length.h"
|
|
||||||
#include "./parser.h"
|
|
||||||
#include "./subtree.h"
|
|
||||||
#include "parser/api.h"
|
|
||||||
|
|
||||||
#include "me/types.h"
|
|
||||||
#include "parser/types/types_lexer.h"
|
|
||||||
|
|
||||||
#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 *);
|
|
||||||
void ts_lexer_delete(t_liblexer *);
|
|
||||||
void ts_lexer_set_input(t_liblexer *, t_parse_input);
|
|
||||||
void ts_lexer_reset(t_liblexer *, t_parse_length);
|
|
||||||
void ts_lexer_start(t_liblexer *);
|
|
||||||
void ts_lexer_finish(t_liblexer *, t_i32 *);
|
|
||||||
void ts_lexer_advance_to_end(t_liblexer *);
|
|
||||||
void ts_lexer_mark_end(t_liblexer *);
|
|
||||||
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 // TREE_SITTER_LEXER_H_
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#include "./array.h"
|
#include "./array.h"
|
||||||
#include "./error_costs.h"
|
#include "parser/error_costs.h"
|
||||||
#include "./language.h"
|
#include "./language.h"
|
||||||
#include "parser/parser_length.h"
|
#include "parser/parser_length.h"
|
||||||
#include "./lexer.h"
|
#include "parser/lexer.h"
|
||||||
#include "./reduce_action.h"
|
#include "./reduce_action.h"
|
||||||
#include "./reusable_node.h"
|
#include "./reusable_node.h"
|
||||||
#include "./stack.h"
|
#include "./stack.h"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ extern "C" {
|
||||||
|
|
||||||
#include "./array.h"
|
#include "./array.h"
|
||||||
#include "./subtree.h"
|
#include "./subtree.h"
|
||||||
#include "./error_costs.h"
|
#include "parser/error_costs.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
typedef struct Stack Stack;
|
typedef struct Stack Stack;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include "./array.h"
|
#include "./array.h"
|
||||||
|
|
||||||
#include "./error_costs.h"
|
#include "parser/error_costs.h"
|
||||||
#include "./language.h"
|
#include "./language.h"
|
||||||
#include "parser/parser_length.h"
|
#include "parser/parser_length.h"
|
||||||
#include "./subtree.h"
|
#include "./subtree.h"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include "parser/types/types_symbol.h"
|
#include "parser/types/types_symbol.h"
|
||||||
|
|
||||||
#include "./array.h"
|
#include "./array.h"
|
||||||
#include "./error_costs.h"
|
#include "parser/error_costs.h"
|
||||||
#include "parser/parser_length.h"
|
#include "parser/parser_length.h"
|
||||||
#include "./parser.h"
|
#include "./parser.h"
|
||||||
#include "parser/api.h"
|
#include "parser/api.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue