update: not using yarn until it is complete. added new files
This commit is contained in:
parent
8d39324a7e
commit
b44464fd8a
5 changed files with 66 additions and 4 deletions
|
|
@ -21,6 +21,8 @@ token_utils \
|
|||
tokenizer \
|
||||
tokenizer_utils \
|
||||
ts_print \
|
||||
yarn/ast_cmd \
|
||||
yarn/ast_op \
|
||||
yarn/yarn \
|
||||
|
||||
GEN_FILES = \
|
||||
|
|
|
|||
27
parser/src/yarn/ast_cmd.c
Normal file
27
parser/src/yarn/ast_cmd.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ast_cmd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/09 12:44:53 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/09 12:45:32 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ast/ast.h"
|
||||
#include "parser/token.h"
|
||||
#include "me/vec/vec_ast.h"
|
||||
#include "me/vec/vec_token.h"
|
||||
|
||||
/// la fonction doit prendre une t_token de type TOK_CMD qui contient que deux type de subtokens TOK_WORD ou TOK_REDIR
|
||||
/// un TOK_WORD == un arguemnt
|
||||
/// un TOK_REDIR == une redirection
|
||||
/// les deux sont dans le bonne ordre.
|
||||
/// il faut push les TOK_REDIR dans ast_node->data.command.prefix;
|
||||
/// let TOK_WORD dans ast_node->data.command.arguements;
|
||||
/// les noms peuvent etre different idk
|
||||
/// a terme la fonction utilisera t_error et tt;
|
||||
/// struct s_ast_command `ast/include/ast/_raw_structs.h`
|
||||
t_ast_node ast_from_cmd(t_token tok);
|
||||
28
parser/src/yarn/ast_op.c
Normal file
28
parser/src/yarn/ast_op.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ast_op.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/09 12:44:53 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/09 12:46:06 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ast/ast.h"
|
||||
#include "parser/token.h"
|
||||
#include "me/vec/vec_ast.h"
|
||||
#include "me/vec/vec_token.h"
|
||||
|
||||
/// en fonction de op, qui peut etre: TOK_AND TOK_PIPE TOK_OR
|
||||
/// choisir le bon ast_node a faire (t_ast_node->data.list + set operator ou t_asdt_node->data.pipeline)
|
||||
/// pop deux element de output_queue. pour l'instant la fonction doit print une error si il n'y as pas asser d'element
|
||||
/// utilise me_abort(MSG) pour faire un abort et print le msg + la stacktrace.
|
||||
///
|
||||
/// a terme la fonction utilisera t_error et tt;
|
||||
///
|
||||
/// struct s_ast_list if (tok.type == TOK_AND || tok.type == TOK_OR)
|
||||
/// struct s_ast_pipeline if (tok.type == TOK_PIPE)
|
||||
/// `ast/include/ast/_raw_structs.h`
|
||||
t_ast_node ast_from_op(t_token tok, t_vec_ast *output_queue);
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/07 18:04:13 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/08 15:47:39 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/09 12:44:24 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -36,6 +36,7 @@ t_str token_name(t_token *token);
|
|||
/// let TOK_WORD dans ast_node->data.command.arguements;
|
||||
/// les noms peuvent etre different idk
|
||||
/// a terme la fonction utilisera t_error et tt;
|
||||
/// struct s_ast_command `ast/include/ast/_raw_structs.h`
|
||||
t_ast_node ast_from_cmd(t_token tok);
|
||||
|
||||
/// en fonction de op, qui peut etre: TOK_AND TOK_PIPE TOK_OR
|
||||
|
|
@ -44,6 +45,10 @@ t_ast_node ast_from_cmd(t_token tok);
|
|||
/// utilise me_abort(MSG) pour faire un abort et print le msg + la stacktrace.
|
||||
///
|
||||
/// a terme la fonction utilisera t_error et tt;
|
||||
///
|
||||
/// struct s_ast_list if (tok.type == TOK_AND || tok.type == TOK_OR)
|
||||
/// struct s_ast_pipeline if (tok.type == TOK_PIPE)
|
||||
/// `ast/include/ast/_raw_structs.h`
|
||||
t_ast_node ast_from_op(t_token tok, t_vec_ast *output_queue);
|
||||
|
||||
t_error yarn(t_vec_token ts, t_vec_ast *out)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/08 14:41:06 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/09 12:40:13 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -111,8 +111,8 @@ void parse_str(t_state *state)
|
|||
return ;
|
||||
if (ts_apply_passes(tokens, &tokens))
|
||||
return ;
|
||||
if (yarn(tokens, &tokens))
|
||||
return ;
|
||||
//if (yarn(tokens, &tokens))
|
||||
// return ;
|
||||
printf("\n\nEND TOKENS\n");
|
||||
ts_print(&tokens);
|
||||
vec_token_free(tokens);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue