rename: heredoc finished
This commit is contained in:
parent
7ed0c2288a
commit
d7bc70ce2f
1 changed files with 0 additions and 0 deletions
48
ast/src/_here_doc.c
Normal file
48
ast/src/_here_doc.c
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* _here_doc_not_done.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/02 16:37:28 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/06 10:53:13 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "app/node.h"
|
||||
#include "ast/_from_node.h"
|
||||
#include "ast/ast.h"
|
||||
#include "gmr/symbols.h"
|
||||
#include "gmr/field_identifiers.h"
|
||||
#include "me/str/str.h"
|
||||
#include "me/types.h"
|
||||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
||||
t_error build_sym_heredoc_redirect(t_parse_node self, t_const_str input, \
|
||||
t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_usize i;
|
||||
|
||||
if (ts_node_symbol(self) != sym_heredoc_redirect || \
|
||||
input == NULL || out == NULL)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_HEREDOC_REDIRECTION);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
if (ts_node_field_id_for_child(self, i) == field_op)
|
||||
ret->data.heredoc_redirection.op = \
|
||||
_get_redirection_op(ts_node_child(self, i));
|
||||
else if (ts_node_symbol(ts_node_child(self, i)) == sym_heredoc_start)
|
||||
ret->data.heredoc_redirection.delimiter = \
|
||||
_extract_str(ts_node_child(self, i), input);
|
||||
else if (ts_node_symbol(ts_node_child(self, i)) == sym_heredoc_body)
|
||||
ret->data.heredoc_redirection.content = \
|
||||
_extract_str(ts_node_child(self, i), input);
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue