update: Updated stuff so the scanner works great now
This commit is contained in:
parent
475038e2b7
commit
163db2241f
15 changed files with 738 additions and 648 deletions
28
parser/include/parser/inner/reduce_action_inner.h
Normal file
28
parser/include/parser/inner/reduce_action_inner.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* reduce_action_inner.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/06 16:56:42 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/06 16:57:13 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef REDUCE_ACTION_INNER_H
|
||||
#define REDUCE_ACTION_INNER_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "parser/inner/ptypes.h"
|
||||
|
||||
struct s_reduce_action
|
||||
{
|
||||
t_u32 count;
|
||||
TSSymbol symbol;
|
||||
int dynamic_precedence;
|
||||
t_u16 production_id;
|
||||
};
|
||||
typedef struct s_reduce_action t_reduce_action;
|
||||
|
||||
#endif /* REDUCE_ACTION_INNER_H */
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/02 13:22:04 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/02 17:40:15 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/09/06 16:57:20 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,65 +17,4 @@
|
|||
#include "me/vec/vec_heredoc.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
// typedef struct s_scanner t_scanner;
|
||||
|
||||
// struct s_scanner
|
||||
// {
|
||||
// t_u8 last_glob_paren_depth;
|
||||
// bool ext_was_in_double_quote;
|
||||
// bool ext_saw_outside_quote;
|
||||
// t_vec_heredoc heredocs;
|
||||
// };
|
||||
|
||||
// enum e_token_type
|
||||
// {
|
||||
// HEREDOC_START,
|
||||
// SIMPLE_HEREDOC_BODY,
|
||||
// HEREDOC_BODY_BEGINNING,
|
||||
// HEREDOC_CONTENT,
|
||||
// HEREDOC_END,
|
||||
// FILE_DESCRIPTOR,
|
||||
// EMPTY_VALUE,
|
||||
// CONCAT,
|
||||
// VARIABLE_NAME,
|
||||
// REGEX,
|
||||
// EXPANSION_WORD,
|
||||
// EXTGLOB_PATTERN,
|
||||
// BARE_DOLLAR,
|
||||
// IMMEDIATE_DOUBLE_HASH,
|
||||
// HEREDOC_ARROW,
|
||||
// HEREDOC_ARROW_DASH,
|
||||
// NEWLINE,
|
||||
// OPENING_PAREN,
|
||||
// ESAC,
|
||||
// ERROR_RECOVERY,
|
||||
// };
|
||||
|
||||
// struct s_heredoc_scan_state
|
||||
// {
|
||||
// t_scanner *scanner;
|
||||
// TSLexer *lexer;
|
||||
// enum e_token_type middle_type;
|
||||
// enum e_token_type end_type;
|
||||
// bool did_advance;
|
||||
// t_heredoc *heredoc;
|
||||
// bool return_value;
|
||||
// };
|
||||
|
||||
// typedef bool (*t_heredoc_content_func)(struct s_heredoc_scan_state *state);
|
||||
|
||||
// bool advance_word(TSLexer *lexer, t_string *unquoted_word);
|
||||
// bool check_scan_concat(t_scanner *scanner, TSLexer *lexer, const bool *valid_symbols);
|
||||
// bool scan(t_scanner *scanner, TSLexer *lexer, const bool *valid_symbols);
|
||||
// bool scan_bare_dollar(TSLexer *lexer);
|
||||
// bool scan_concat(t_scanner *scanner, TSLexer *lexer, const bool *valid_symbols);
|
||||
// bool scan_double_hash(t_scanner *scanner, TSLexer *lexer, const bool *valid_symbols);
|
||||
// bool scan_expansion_word(t_scanner *scanner, TSLexer *lexer, const bool *valid_symbols);
|
||||
// bool scan_heredoc_content(t_scanner *scanner, TSLexer *lexer, enum e_token_type middle_type, enum e_token_type end_type);
|
||||
// bool scan_heredoc_end(t_scanner *scanner, TSLexer *lexer);
|
||||
// bool scan_heredoc_end_identifier(t_heredoc *heredoc, TSLexer *lexer);
|
||||
// bool scan_heredoc_start(t_heredoc *heredoc, TSLexer *lexer);
|
||||
// bool scan_varname(t_scanner *scanner, TSLexer *lexer, const bool *valid_symbols);
|
||||
// void reset(t_scanner *scanner);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/02 20:01:50 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/02 20:16:23 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/09/06 17:00:26 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -36,17 +36,17 @@ struct s_subtree_data
|
|||
TSSymbol symbol;
|
||||
TSStateId parse_state;
|
||||
|
||||
bool visible : 1;
|
||||
bool named : 1;
|
||||
bool extra : 1;
|
||||
bool fragile_left : 1;
|
||||
bool fragile_right : 1;
|
||||
bool has_changes : 1;
|
||||
bool has_external_tokens : 1;
|
||||
bool has_external_scanner_state_change : 1;
|
||||
bool depends_on_column : 1;
|
||||
bool is_missing : 1;
|
||||
bool is_keyword : 1;
|
||||
bool visible;
|
||||
bool named;
|
||||
bool extra;
|
||||
bool fragile_left;
|
||||
bool fragile_right;
|
||||
bool has_changes;
|
||||
bool has_external_tokens;
|
||||
bool has_external_scanner_state_change;
|
||||
bool depends_on_column;
|
||||
bool is_missing;
|
||||
bool is_keyword;
|
||||
|
||||
union {
|
||||
// Non-terminal subtrees (`child_count > 0`)
|
||||
|
|
|
|||
|
|
@ -6,28 +6,21 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/31 12:03:09 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/08/31 18:31:33 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/09/06 17:08:38 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef REDUCE_ACTION_H
|
||||
#define REDUCE_ACTION_H
|
||||
|
||||
#include "me/types.h"
|
||||
#include "parser/api.h"
|
||||
#include "parser/array.h"
|
||||
#include "me/types.h"
|
||||
#include "parser/inner/reduce_action_inner.h"
|
||||
#include "me/vec/vec_reduce_action.h"
|
||||
|
||||
struct s_reduce_action
|
||||
{
|
||||
t_u32 count;
|
||||
TSSymbol symbol;
|
||||
int dynamic_precedence;
|
||||
t_u16 production_id;
|
||||
};
|
||||
typedef t_vec_reduce_action ReduceActionSet;
|
||||
|
||||
typedef struct s_reduce_action ReduceAction;
|
||||
typedef Array(ReduceAction) ReduceActionSet;
|
||||
|
||||
void ts_reduce_action_set_add(ReduceActionSet *self, ReduceAction new_action);
|
||||
void ts_reduce_action_set_add(ReduceActionSet *self, t_reduce_action new_action);
|
||||
|
||||
#endif // REDUCE_ACTION_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue