update: changed the way heredocs are parsed
This commit is contained in:
parent
8272d72997
commit
43b969183d
365 changed files with 20907 additions and 51362 deletions
|
|
@ -1,57 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* heredoc.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/01 15:06:56 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/01 19:01:16 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef HEREDOC_H
|
||||
#define HEREDOC_H
|
||||
|
||||
#include "me/string/string.h"
|
||||
|
||||
typedef struct s_heredoc t_heredoc;
|
||||
|
||||
struct s_heredoc
|
||||
{
|
||||
bool is_raw;
|
||||
bool started;
|
||||
bool allows_indent;
|
||||
t_string delimiter;
|
||||
t_string current_leading_word;
|
||||
};
|
||||
|
||||
static inline t_heredoc heredoc_new(void)
|
||||
{
|
||||
return (t_heredoc){
|
||||
.is_raw = false,
|
||||
.started = false,
|
||||
.allows_indent = false,
|
||||
.delimiter = string_new(16),
|
||||
.current_leading_word = string_new(16),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
static inline void reset_heredoc(t_heredoc *heredoc)
|
||||
{
|
||||
if (heredoc == NULL)
|
||||
return;
|
||||
heredoc->is_raw = false;
|
||||
heredoc->started = false;
|
||||
heredoc->allows_indent = false;
|
||||
string_clear(&heredoc->delimiter);
|
||||
}
|
||||
|
||||
static inline void heredoc_free(t_heredoc heredoc)
|
||||
{
|
||||
string_free(heredoc.delimiter);
|
||||
string_free(heredoc.current_leading_word);
|
||||
}
|
||||
|
||||
#endif /* HEREDOC_TYPE_H */
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/10 13:57:11 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/10 13:57:53 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/09/15 20:26:31 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,8 +18,6 @@
|
|||
#include "me/str/str.h"
|
||||
#include "me/string/string.h"
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_heredoc.h"
|
||||
#include "parser/inner/heredoc.h"
|
||||
#include "parser/lexer.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
|
|
@ -28,11 +26,6 @@ typedef struct s_scanner t_scanner;
|
|||
|
||||
enum e_token_type
|
||||
{
|
||||
HEREDOC_START,
|
||||
SIMPLE_HEREDOC_BODY,
|
||||
HEREDOC_BODY_BEGINNING,
|
||||
HEREDOC_CONTENT,
|
||||
HEREDOC_END,
|
||||
FILE_DESCRIPTOR,
|
||||
EMPTY_VALUE,
|
||||
CONCAT,
|
||||
|
|
@ -42,11 +35,8 @@ enum e_token_type
|
|||
EXTGLOB_PATTERN,
|
||||
BARE_DOLLAR,
|
||||
IMMEDIATE_DOUBLE_HASH,
|
||||
HEREDOC_ARROW,
|
||||
HEREDOC_ARROW_DASH,
|
||||
NEWLINE,
|
||||
OPENING_PAREN,
|
||||
ESAC,
|
||||
ERROR_RECOVERY,
|
||||
};
|
||||
|
||||
|
|
@ -55,7 +45,6 @@ struct s_scanner
|
|||
t_u8 last_glob_paren_depth;
|
||||
bool ext_was_in_double_quote;
|
||||
bool ext_saw_outside_quote;
|
||||
t_vec_heredoc heredocs;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue