normed the stdme headers
This commit is contained in:
parent
79e039c94a
commit
398dd520d0
84 changed files with 297 additions and 2819 deletions
|
|
@ -1,24 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_char_range.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 15:03:34 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:27:38 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_CHAR_RANGE_H
|
||||
# define TYPES_CHAR_RANGE_H
|
||||
|
||||
# include "me/types.h"
|
||||
|
||||
typedef struct s_char_range
|
||||
{
|
||||
t_i32 start;
|
||||
t_i32 end;
|
||||
} t_char_range;
|
||||
|
||||
#endif /* TYPES_CHAR_RANGE_H */
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_field_entry.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:51:21 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:35:36 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_FIELD_ENTRY_H
|
||||
# define TYPES_FIELD_ENTRY_H
|
||||
|
||||
# include "parser/types/types_field_id.h"
|
||||
|
||||
typedef struct s_field_map_entry
|
||||
{
|
||||
t_field_id field_id;
|
||||
t_u8 child_index;
|
||||
bool inherited;
|
||||
} t_field_map_entry;
|
||||
|
||||
#endif /* TYPES_FIELD_ENTRY_H */
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_field_id.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:44:38 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:44:44 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_FIELD_ID_H
|
||||
# define TYPES_FIELD_ID_H
|
||||
|
||||
# include "me/types.h"
|
||||
|
||||
typedef t_u16 t_field_id;
|
||||
|
||||
#endif /* TYPES_FIELD_ID_H */
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_field_map_entry.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:51:45 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:53:31 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_FIELD_MAP_ENTRY_H
|
||||
# define TYPES_FIELD_MAP_ENTRY_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_field_id.h"
|
||||
|
||||
typedef struct s_field_map_entry
|
||||
{
|
||||
t_field_id field_id;
|
||||
t_u8 child_index;
|
||||
bool inherited;
|
||||
} t_field_map_entry;
|
||||
|
||||
#endif /* TYPES_FIELD_MAP_ENTRY_H */
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_field_map_slice.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:54:41 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:08:21 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_FIELD_MAP_SLICE_H
|
||||
# define TYPES_FIELD_MAP_SLICE_H
|
||||
|
||||
# include "me/types.h"
|
||||
|
||||
typedef struct s_field_map_slice
|
||||
{
|
||||
t_u16 index;
|
||||
t_u16 length;
|
||||
} t_field_map_slice;
|
||||
|
||||
#endif /* TYPES_FIELD_MAP_SLICE_H */
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_heredoc.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/30 13:47:07 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/30 13:48:19 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_HEREDOC_H
|
||||
#define TYPES_HEREDOC_H
|
||||
|
||||
#include "me/string/string.h"
|
||||
#include "me/types.h"
|
||||
|
||||
typedef struct s_heredoc
|
||||
{
|
||||
bool is_raw;
|
||||
bool started;
|
||||
bool allows_indent;
|
||||
t_string delimiter;
|
||||
t_string current_leading_word;
|
||||
} t_heredoc;
|
||||
|
||||
#endif /* TYPES_HEREDOC_H */
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_language.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:39:37 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:36:47 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_LANGUAGE_H
|
||||
# define TYPES_LANGUAGE_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_field_map_entry.h"
|
||||
# include "parser/types/types_field_map_slice.h"
|
||||
# include "parser/types/types_lex_modes.h"
|
||||
# include "parser/types/types_lexer.h"
|
||||
# include "parser/types/types_parse_action_entry.h"
|
||||
# include "parser/types/types_scanner.h"
|
||||
# include "parser/types/types_state_id.h"
|
||||
# include "parser/types/types_symbol.h"
|
||||
# include "parser/types/types_symbol_metadata.h"
|
||||
|
||||
typedef bool (*t_lex_fn)(t_lexer *lex, t_state_id state);
|
||||
|
||||
typedef struct s_language
|
||||
{
|
||||
t_u32 version;
|
||||
t_u32 symbol_count;
|
||||
t_u32 alias_count;
|
||||
t_u32 token_count;
|
||||
t_u32 external_token_count;
|
||||
t_u32 state_count;
|
||||
t_u32 large_state_count;
|
||||
t_u32 production_id_count;
|
||||
t_u32 field_count;
|
||||
t_u16 max_alias_sequence_length;
|
||||
const t_u16 *parse_table;
|
||||
const t_u16 *small_parse_table;
|
||||
const t_u32 *small_parse_table_map;
|
||||
const t_parse_action_entry *parse_actions;
|
||||
const t_const_str *symbol_names;
|
||||
const t_const_str *field_names;
|
||||
const t_field_map_slice *field_map_slices;
|
||||
const t_field_map_entry *field_map_entries;
|
||||
const t_symbol_metadata *symbol_metadata;
|
||||
const t_symbol *public_symbol_map;
|
||||
const t_u16 *alias_map;
|
||||
const t_symbol *alias_sequences;
|
||||
const t_lex_modes *lex_modes;
|
||||
t_lex_fn lex_fn;
|
||||
t_lex_fn keyword_lex_fn;
|
||||
t_symbol keyword_capture_token;
|
||||
t_scanner external_scanner;
|
||||
const t_state_id *primary_state_ids;
|
||||
} t_language;
|
||||
|
||||
#endif /* TYPES_LANGUAGE_H */
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_lex_modes.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 15:01:24 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:01:31 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_LEX_MODES_H
|
||||
# define TYPES_LEX_MODES_H
|
||||
|
||||
# include "me/types.h"
|
||||
|
||||
typedef struct s_lex_modes
|
||||
{
|
||||
t_u16 lex_state;
|
||||
t_u16 external_lex_state;
|
||||
} t_lex_modes;
|
||||
|
||||
#endif /* TYPES_LEX_MODES_H */
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_lexer.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:45:45 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 16:24:16 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_LEXER_H
|
||||
# define TYPES_LEXER_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_symbol.h"
|
||||
|
||||
typedef struct s_lexer
|
||||
{
|
||||
t_i32 lookahead;
|
||||
t_symbol result_symbol;
|
||||
void (*advance)(struct s_lexer *, bool);
|
||||
void (*mark_end)(struct s_lexer *);
|
||||
t_i32 (*get_column)(struct s_lexer *);
|
||||
bool (*is_at_included_range_start)(const struct s_lexer *);
|
||||
bool (*eof)(const struct s_lexer *);
|
||||
} t_lexer;
|
||||
|
||||
#endif /* TYPES_LEXER_H */
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_lexer_state.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:50:20 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:51:00 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_LEXER_STATE_H
|
||||
# define TYPES_LEXER_STATE_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_state_id.h"
|
||||
|
||||
typedef struct s_lexer_state
|
||||
{
|
||||
t_u32 lookahead;
|
||||
t_state_id state;
|
||||
bool result;
|
||||
bool skip;
|
||||
bool eof;
|
||||
} t_lexer_state;
|
||||
|
||||
#endif /* TYPES_LEXER_STATE_H */
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_parse_action_entry.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 15:01:57 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:03:13 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_PARSE_ACTION_ENTRY_H
|
||||
# define TYPES_PARSE_ACTION_ENTRY_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_parse_actions.h"
|
||||
|
||||
struct s_parse_actions_entry_entry
|
||||
{
|
||||
t_u8 count;
|
||||
bool reusable;
|
||||
};
|
||||
|
||||
typedef union u_parse_actions_entry
|
||||
{
|
||||
t_parse_actions action;
|
||||
struct s_parse_actions_entry_entry entry;
|
||||
} t_parse_action_entry;
|
||||
|
||||
#endif /* TYPES_PARSE_ACTION_ENTRY_H */
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_parse_action_type.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:57:22 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:57:32 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_PARSE_ACTION_TYPE_H
|
||||
# define TYPES_PARSE_ACTION_TYPE_H
|
||||
|
||||
typedef enum e_parse_action_type
|
||||
{
|
||||
ActionTypeShift,
|
||||
ActionTypeReduce,
|
||||
ActionTypeAccept,
|
||||
ActionTypeRecover,
|
||||
} t_parse_action_type;
|
||||
|
||||
#endif /* TYPES_PARSE_ACTION_TYPE_H */
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_parse_actions.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:58:36 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:00:51 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_PARSE_ACTIONS_H
|
||||
# define TYPES_PARSE_ACTIONS_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_state_id.h"
|
||||
# include "parser/types/types_symbol.h"
|
||||
|
||||
struct s_parse_action_shift
|
||||
{
|
||||
t_u8 type;
|
||||
t_state_id state;
|
||||
bool extra;
|
||||
bool repetition;
|
||||
};
|
||||
|
||||
struct s_parse_action_reduce
|
||||
{
|
||||
t_u8 type;
|
||||
t_u8 child_count;
|
||||
t_symbol symbol;
|
||||
t_i16 dynamic_precedence;
|
||||
t_u16 production_id;
|
||||
};
|
||||
|
||||
typedef union u_parse_actions
|
||||
{
|
||||
struct s_parse_action_shift shift;
|
||||
struct s_parse_action_reduce reduce;
|
||||
t_u8 type;
|
||||
} t_parse_actions;
|
||||
|
||||
#endif /* TYPES_PARSE_ACTIONS_H */
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_parser_node.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:36:46 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:37:36 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_PARSER_NODE_H
|
||||
# define TYPES_PARSER_NODE_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_parser_tree.h"
|
||||
|
||||
typedef struct s_parser_node
|
||||
{
|
||||
t_u32 context[4];
|
||||
const void *id;
|
||||
const t_parser_tree *tree;
|
||||
} t_parser_node;
|
||||
|
||||
#endif /* TYPES_PARSER_NODE_H */
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_parser_range.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:11:26 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:25:11 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_PARSER_RANGE_H
|
||||
# define TYPES_PARSER_RANGE_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_point.h"
|
||||
|
||||
typedef struct s_parser_range
|
||||
{
|
||||
t_point start_point;
|
||||
t_point end_point;
|
||||
t_u32 start_byte;
|
||||
t_u32 end_byte;
|
||||
|
||||
} t_parser_range;
|
||||
|
||||
#endif /* TYPES_PARSER_RANGE_H */
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_parser_subtree.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:49:40 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:49:40 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_PARSER_SUBTREE_H
|
||||
# define TYPES_PARSER_SUBTREE_H
|
||||
|
||||
#endif /* TYPES_PARSER_SUBTREE_H */
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_parser_tree.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:37:41 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:49:20 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_PARSER_TREE_H
|
||||
# define TYPES_PARSER_TREE_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_language.h"
|
||||
# include "parser/types/types_parser_range.h"
|
||||
# include "parser/types/types_parser_subtree.h"
|
||||
|
||||
typedef struct s_parser_tree
|
||||
{
|
||||
t_parser_subtree root;
|
||||
const t_language *language;
|
||||
t_parser_range *included_ranges;
|
||||
t_i32 included_range_count;
|
||||
} t_parser_tree;
|
||||
|
||||
#endif /* TYPES_PARSER_TREE_H */
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_point.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:20:34 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:21:16 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_POINT_H
|
||||
# define TYPES_POINT_H
|
||||
|
||||
# include "me/types.h"
|
||||
|
||||
typedef struct s_point
|
||||
{
|
||||
t_u32 row;
|
||||
t_u32 column;
|
||||
} t_point;
|
||||
|
||||
#endif /* TYPES_POINT_H */
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_reduce_action.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/30 15:21:59 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/30 15:22:18 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_REDUCE_ACTION_H
|
||||
#define TYPES_REDUCE_ACTION_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "parser/types/types_symbol.h"
|
||||
|
||||
typedef struct s_reduce_action
|
||||
{
|
||||
t_u32 count;
|
||||
t_symbol symbol;
|
||||
t_i32 dynamic_precedence;
|
||||
t_u16 production_id;
|
||||
} t_reduce_action;
|
||||
|
||||
#endif /* TYPES_REDUCE_ACTION_H */
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_scanner.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:42:52 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 15:34:21 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_SCANNER_H
|
||||
# define TYPES_SCANNER_H
|
||||
|
||||
# include "me/types.h"
|
||||
# include "parser/types/types_lexer.h"
|
||||
# include "parser/types/types_symbol.h"
|
||||
|
||||
typedef bool (*t_scanner_scan)(void *self, t_lexer *lex,
|
||||
const bool *symbol_whitelist);
|
||||
typedef void *(*t_scanner_create)(void);
|
||||
typedef void (*t_scanner_destroy)(void *ctx);
|
||||
typedef unsigned (*t_scanner_serialize)(void *self, t_str s);
|
||||
typedef void (*t_scanner_deserialize)(void *self, t_const_str s,
|
||||
t_u32 len);
|
||||
|
||||
typedef struct s_scanner
|
||||
{
|
||||
const bool *states;
|
||||
const t_symbol *symbol_map;
|
||||
t_scanner_create create;
|
||||
t_scanner_destroy destroy;
|
||||
t_scanner_scan scan;
|
||||
t_scanner_serialize serialize;
|
||||
t_scanner_deserialize deserialize;
|
||||
} t_scanner;
|
||||
|
||||
#endif /* TYPES_SCANNER_H */
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_scanner_ctx.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/30 13:41:02 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/30 13:50:24 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_SCANNER_CTX_H
|
||||
#define TYPES_SCANNER_CTX_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_parser_heredoc.h"
|
||||
|
||||
typedef struct s_scanner_ctx
|
||||
{
|
||||
t_u8 last_glob_paren_depth;
|
||||
bool ext_was_in_double_quote;
|
||||
bool ext_saw_outside_quote;
|
||||
t_vec_parser_heredoc heredocs;
|
||||
} t_scanner_ctx;
|
||||
|
||||
#endif /* TYPES_SCANNER_CTX_H */
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_state_id.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:44:15 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:44:47 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_STATE_ID_H
|
||||
# define TYPES_STATE_ID_H
|
||||
|
||||
# include "me/types.h"
|
||||
|
||||
typedef t_u16 t_state_id;
|
||||
|
||||
#endif /* TYPES_STATE_ID_H */
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_symbol.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:43:33 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 16:41:28 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_SYMBOL_H
|
||||
#define TYPES_SYMBOL_H
|
||||
|
||||
#include "me/types.h"
|
||||
|
||||
typedef t_u16 t_symbol;
|
||||
|
||||
#define ts_builtin_sym_end (t_symbol)0
|
||||
#define ts_builtin_sym_error (t_symbol)(-1)
|
||||
|
||||
#endif /* TYPES_SYMBOL_H */
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* types_symbol_metadata.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/29 14:55:57 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/04/29 14:56:04 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TYPES_SYMBOL_METADATA_H
|
||||
# define TYPES_SYMBOL_METADATA_H
|
||||
|
||||
# include "me/types.h"
|
||||
|
||||
typedef struct s_symbol_metadata
|
||||
{
|
||||
bool visible;
|
||||
bool named;
|
||||
bool supertype;
|
||||
} t_symbol_metadata;
|
||||
|
||||
#endif /* TYPES_SYMBOL_METADATA_H */
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/24 23:01:45 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/06/30 18:03:54 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/07/11 18:50:48 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,8 +21,6 @@
|
|||
#include "./src/parser.h"
|
||||
#include "me/types.h"
|
||||
|
||||
#include "parser/types/types_lexer_state.h"
|
||||
|
||||
typedef TSSymbolMetadata t_symbol_metadata;
|
||||
typedef TSSymbol t_symbol;
|
||||
typedef TSStateId t_state_id;
|
||||
|
|
@ -34,6 +32,18 @@ typedef TSParseActionEntry t_parse_action_entry;
|
|||
typedef TSLexMode t_lex_modes;
|
||||
typedef TSCharacterRange t_char_range;
|
||||
|
||||
|
||||
struct s_lexer_state
|
||||
{
|
||||
t_u32 lookahead;
|
||||
t_state_id state;
|
||||
bool result;
|
||||
bool skip;
|
||||
bool eof;
|
||||
};
|
||||
|
||||
typedef struct s_lexer_state t_lexer_state;
|
||||
|
||||
#define ActionTypeShift TSParseActionTypeShift
|
||||
#define ActionTypeReduce TSParseActionTypeReduce
|
||||
#define ActionTypeRecover TSParseActionTypeRecover
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue