Adding the files normed
This commit is contained in:
parent
25e6159748
commit
c7ebf63cd1
3 changed files with 241 additions and 175 deletions
137
ast/src/ast_alloc/ast_alloc.c
Normal file
137
ast/src/ast_alloc/ast_alloc.c
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ast_alloc.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/07/30 17:26:13 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/07/30 17:57:57 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "ast/ast.h"
|
||||||
|
#include "gmr/field_identifiers.h"
|
||||||
|
#include "gmr/symbols.h"
|
||||||
|
#include "me/mem/mem.h"
|
||||||
|
#include "me/str/str.h"
|
||||||
|
#include "me/types.h"
|
||||||
|
#include "me/vec/vec_ast.h"
|
||||||
|
#include "parser/api.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_boucle(t_ast_node_kind kind, t_ast_node ret);
|
||||||
|
t_ast_node ast_alloc_condition(t_ast_node_kind kind, t_ast_node ret);
|
||||||
|
t_ast_node ast_alloc_arith(t_ast_node_kind kind, t_ast_node ret);
|
||||||
|
t_ast_node ast_alloc_exec(t_ast_node_kind kind, t_ast_node ret);
|
||||||
|
t_ast_node ast_alloc_redirection(t_ast_node_kind kind, t_ast_node ret);
|
||||||
|
t_ast_node ast_alloc_expantion(t_ast_node_kind kind, t_ast_node ret);
|
||||||
|
t_ast_node ast_alloc_other(t_ast_node_kind kind, t_ast_node ret);
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_arith(t_ast_node_kind kind, t_ast_node ret)
|
||||||
|
{
|
||||||
|
if (kind == AST_ARITHMETIC_EXPANSION)
|
||||||
|
ret->data.arithmetic_expansion.expr = NULL;
|
||||||
|
if (kind == AST_ARITHMETIC_POSTFIX)
|
||||||
|
{
|
||||||
|
ret->data.arithmetic_postfix.value = NULL;
|
||||||
|
ret->data.arithmetic_postfix.op = 0;
|
||||||
|
}
|
||||||
|
if (kind == AST_ARITHMETIC_BINARY)
|
||||||
|
{
|
||||||
|
ret->data.arithmetic_binary.lhs = NULL;
|
||||||
|
ret->data.arithmetic_binary.op = 0;
|
||||||
|
ret->data.arithmetic_binary.rhs = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_exec(t_ast_node_kind kind, t_ast_node ret)
|
||||||
|
{
|
||||||
|
if (kind == AST_COMMAND)
|
||||||
|
{
|
||||||
|
ret->data.command.cmd_word = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.command.prefixes = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.command.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.command.term = AST_TERM_NONE;
|
||||||
|
ret->data.command.bang = false;
|
||||||
|
}
|
||||||
|
if (kind == AST_PROGRAM)
|
||||||
|
ret->data.program.body = vec_ast_new(16, ast_free);
|
||||||
|
if (kind == AST_COMMAND_SUBSTITUTION)
|
||||||
|
ret->data.command_substitution.body = vec_ast_new(16, ast_free);
|
||||||
|
if (kind == AST_PIPELINE)
|
||||||
|
{
|
||||||
|
ret->data.pipeline.bang = false;
|
||||||
|
ret->data.pipeline.statements = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.pipeline.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.pipeline.term = AST_TERM_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_redirection(t_ast_node_kind kind, t_ast_node ret)
|
||||||
|
{
|
||||||
|
if (kind == AST_FILE_REDIRECTION)
|
||||||
|
{
|
||||||
|
ret->data.file_redirection.input = NULL;
|
||||||
|
ret->data.file_redirection.output = NULL;
|
||||||
|
}
|
||||||
|
if (kind == AST_HEREDOC_REDIRECTION)
|
||||||
|
{
|
||||||
|
ret->data.heredoc_redirection.delimiter = NULL;
|
||||||
|
ret->data.heredoc_redirection.output = NULL;
|
||||||
|
}
|
||||||
|
if (kind == AST_LIST)
|
||||||
|
{
|
||||||
|
ret->data.list.left = NULL;
|
||||||
|
ret->data.list.op = AST_LIST_OR;
|
||||||
|
ret->data.list.right = NULL;
|
||||||
|
ret->data.list.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.list.term = AST_TERM_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_other(t_ast_node_kind kind, t_ast_node ret)
|
||||||
|
{
|
||||||
|
if (kind == AST_FUNCTION_DEFINITION)
|
||||||
|
{
|
||||||
|
ret->data.function_definition.body = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.function_definition.name = NULL;
|
||||||
|
}
|
||||||
|
if (kind == AST_COMPOUND_STATEMENT)
|
||||||
|
{
|
||||||
|
ret->data.compound_statement.body = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.compound_statement.suffixes_redirections \
|
||||||
|
= vec_ast_new(16, ast_free);
|
||||||
|
ret->data.compound_statement.term = AST_TERM_NONE;
|
||||||
|
}
|
||||||
|
if (kind == AST_UNTIL)
|
||||||
|
{
|
||||||
|
ret->data.until.condition = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.until.do_ = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.until.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.until.term = AST_TERM_NONE;
|
||||||
|
}
|
||||||
|
if (kind == AST_VARIABLE_ASSIGNMENT)
|
||||||
|
{
|
||||||
|
ret->data.variable_assignment.name = NULL;
|
||||||
|
ret->data.variable_assignment.value = NULL;
|
||||||
|
ret->data.variable_assignment.bang = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t_ast_node ast_alloc(t_ast_node_kind kind)
|
||||||
|
{
|
||||||
|
t_ast_node ret;
|
||||||
|
|
||||||
|
ret = mem_alloc(sizeof(*ret));
|
||||||
|
ret->kind = kind;
|
||||||
|
ast_alloc_boucle(kind, ret);
|
||||||
|
ast_alloc_condition(kind, ret);
|
||||||
|
ast_alloc_arith(kind, ret);
|
||||||
|
ast_alloc_exec(kind, ret);
|
||||||
|
ast_alloc_redirection(kind, ret);
|
||||||
|
ast_alloc_expantion(kind, ret);
|
||||||
|
ast_alloc_other(kind, ret);
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
102
ast/src/ast_alloc/ast_alloc_scripting.c
Normal file
102
ast/src/ast_alloc/ast_alloc_scripting.c
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ast_alloc_scripting.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/07/30 17:57:11 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/07/30 17:57:53 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "ast/ast.h"
|
||||||
|
#include "gmr/field_identifiers.h"
|
||||||
|
#include "gmr/symbols.h"
|
||||||
|
#include "me/mem/mem.h"
|
||||||
|
#include "me/str/str.h"
|
||||||
|
#include "me/types.h"
|
||||||
|
#include "me/vec/vec_ast.h"
|
||||||
|
#include "parser/api.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_expantion(t_ast_node_kind kind, t_ast_node ret)
|
||||||
|
{
|
||||||
|
if (kind == AST_RAW_STRING)
|
||||||
|
{
|
||||||
|
ret->data.raw_string.len = 0;
|
||||||
|
ret->data.raw_string.str = NULL;
|
||||||
|
ret->data.raw_string.kind = AST_WORD_NO_QUOTE;
|
||||||
|
ret->data.raw_string.start = true;
|
||||||
|
ret->data.raw_string.end = true;
|
||||||
|
}
|
||||||
|
if (kind == AST_SUBSHELL)
|
||||||
|
{
|
||||||
|
ret->data.subshell.term = AST_TERM_NONE;
|
||||||
|
ret->data.subshell.body = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.subshell.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.subshell.bang = false;
|
||||||
|
}
|
||||||
|
if (kind == AST_WORD)
|
||||||
|
{
|
||||||
|
ret->data.word.inner = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.word.kind = AST_WORD_NO_QUOTE;
|
||||||
|
}
|
||||||
|
if (kind == AST_EXTGLOB)
|
||||||
|
ret->data.extglob.pattern = NULL;
|
||||||
|
if (kind == AST_REGEX)
|
||||||
|
ret->data.regex.pattern = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_boucle(t_ast_node_kind kind, t_ast_node ret)
|
||||||
|
{
|
||||||
|
if (kind == AST_IF)
|
||||||
|
{
|
||||||
|
ret->data.if_.condition = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.if_.elif_ = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.if_.else_ = NULL;
|
||||||
|
ret->data.if_.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.if_.term = AST_TERM_NONE;
|
||||||
|
ret->data.if_.then = vec_ast_new(16, ast_free);
|
||||||
|
}
|
||||||
|
if (kind == AST_FOR)
|
||||||
|
{
|
||||||
|
ret->data.for_.do_ = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.for_.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.for_.term = AST_TERM_NONE;
|
||||||
|
ret->data.for_.var_name = NULL;
|
||||||
|
ret->data.for_.words = vec_ast_new(16, ast_free);
|
||||||
|
}
|
||||||
|
if (kind == AST_WHILE)
|
||||||
|
{
|
||||||
|
ret->data.while_.condition = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.while_.do_ = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.while_.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.while_.term = AST_TERM_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t_ast_node ast_alloc_condition(t_ast_node_kind kind, t_ast_node ret)
|
||||||
|
{
|
||||||
|
if (kind == AST_CASE_ITEM)
|
||||||
|
{
|
||||||
|
ret->data.case_item.body = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.case_item.pattern = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.case_item.term = AST_TERM_NONE;
|
||||||
|
}
|
||||||
|
if (kind == AST_CASE)
|
||||||
|
{
|
||||||
|
ret->data.case_.cases = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.case_.suffixes_redirections = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.case_.term = AST_TERM_NONE;
|
||||||
|
ret->data.case_.word = NULL;
|
||||||
|
}
|
||||||
|
if (kind == AST_ELIF)
|
||||||
|
{
|
||||||
|
ret->data.elif.condition = vec_ast_new(16, ast_free);
|
||||||
|
ret->data.elif.then = vec_ast_new(16, ast_free);
|
||||||
|
}
|
||||||
|
if (kind == AST_ELSE)
|
||||||
|
ret->data.else_.then = vec_ast_new(16, ast_free);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */
|
/* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/07/30 14:47:24 by rparodi ### ########.fr */
|
/* Updated: 2024/07/30 17:26:52 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "me/vec/vec_ast.h"
|
#include "me/vec/vec_ast.h"
|
||||||
#include "parser/api.h"
|
#include "parser/api.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sym_arithmetic_binary_expression
|
sym_arithmetic_binary_expression
|
||||||
|
|
@ -73,180 +74,6 @@ sym_while_statement
|
||||||
sym_word
|
sym_word
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
t_ast_node ast_alloc(t_ast_node_kind kind)
|
|
||||||
{
|
|
||||||
t_ast_node ret;
|
|
||||||
|
|
||||||
ret = mem_alloc(sizeof(*ret));
|
|
||||||
ret->kind = kind;
|
|
||||||
if (kind == AST_ARITHMETIC_EXPANSION)
|
|
||||||
{
|
|
||||||
ret->data.arithmetic_expansion.expr = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_ARITHMETIC_POSTFIX)
|
|
||||||
{
|
|
||||||
ret->data.arithmetic_postfix.value = NULL;
|
|
||||||
ret->data.arithmetic_postfix.op = 0;
|
|
||||||
}
|
|
||||||
if (kind == AST_ARITHMETIC_BINARY)
|
|
||||||
{
|
|
||||||
ret->data.arithmetic_binary.lhs = NULL;
|
|
||||||
ret->data.arithmetic_binary.op = 0;
|
|
||||||
ret->data.arithmetic_binary.rhs = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_CASE)
|
|
||||||
{
|
|
||||||
ret->data.case_.cases = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.case_.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.case_.term = AST_TERM_NONE;
|
|
||||||
ret->data.case_.word = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_CASE_ITEM)
|
|
||||||
{
|
|
||||||
ret->data.case_item.body = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.case_item.pattern = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.case_item.term = AST_TERM_NONE;
|
|
||||||
}
|
|
||||||
if (kind == AST_COMMAND)
|
|
||||||
{
|
|
||||||
ret->data.command.cmd_word = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.command.prefixes = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.command.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.command.term = AST_TERM_NONE;
|
|
||||||
ret->data.command.bang = false;
|
|
||||||
}
|
|
||||||
if (kind == AST_COMMAND_SUBSTITUTION)
|
|
||||||
{
|
|
||||||
ret->data.command_substitution.body = vec_ast_new(16, ast_free);
|
|
||||||
}
|
|
||||||
if (kind == AST_COMPOUND_STATEMENT)
|
|
||||||
{
|
|
||||||
ret->data.compound_statement.body = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.compound_statement.suffixes_redirections \
|
|
||||||
= vec_ast_new(16, ast_free);
|
|
||||||
ret->data.compound_statement.term = AST_TERM_NONE;
|
|
||||||
}
|
|
||||||
if (kind == AST_ELIF)
|
|
||||||
{
|
|
||||||
ret->data.elif.condition = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.elif.then = vec_ast_new(16, ast_free);
|
|
||||||
}
|
|
||||||
if (kind == AST_ELSE)
|
|
||||||
{
|
|
||||||
ret->data.else_.then = vec_ast_new(16, ast_free);
|
|
||||||
}
|
|
||||||
if (kind == AST_EXPANSION)
|
|
||||||
{
|
|
||||||
ret->data.expansion.args = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.expansion.kind = E_OP_NONE;
|
|
||||||
ret->data.expansion.len_operator = false;
|
|
||||||
ret->data.expansion.var_name = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_FILE_REDIRECTION)
|
|
||||||
{
|
|
||||||
ret->data.file_redirection.input = NULL;
|
|
||||||
ret->data.file_redirection.output = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_FOR)
|
|
||||||
{
|
|
||||||
ret->data.for_.do_ = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.for_.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.for_.term = AST_TERM_NONE;
|
|
||||||
ret->data.for_.var_name = NULL;
|
|
||||||
ret->data.for_.words = vec_ast_new(16, ast_free);
|
|
||||||
}
|
|
||||||
if (kind == AST_FUNCTION_DEFINITION)
|
|
||||||
{
|
|
||||||
ret->data.function_definition.body = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.function_definition.name = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_HEREDOC_REDIRECTION)
|
|
||||||
{
|
|
||||||
ret->data.heredoc_redirection.delimiter = NULL;
|
|
||||||
ret->data.heredoc_redirection.output = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_IF)
|
|
||||||
{
|
|
||||||
ret->data.if_.condition = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.if_.elif_ = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.if_.else_ = NULL;
|
|
||||||
ret->data.if_.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.if_.term = AST_TERM_NONE;
|
|
||||||
ret->data.if_.then = vec_ast_new(16, ast_free);
|
|
||||||
}
|
|
||||||
if (kind == AST_LIST)
|
|
||||||
{
|
|
||||||
ret->data.list.left = NULL;
|
|
||||||
ret->data.list.op = AST_LIST_OR;
|
|
||||||
ret->data.list.right = NULL;
|
|
||||||
ret->data.list.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.list.term = AST_TERM_NONE;
|
|
||||||
}
|
|
||||||
if (kind == AST_PIPELINE)
|
|
||||||
{
|
|
||||||
ret->data.pipeline.bang = false;
|
|
||||||
ret->data.pipeline.statements = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.pipeline.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.pipeline.term = AST_TERM_NONE;
|
|
||||||
}
|
|
||||||
if (kind == AST_PROGRAM)
|
|
||||||
{
|
|
||||||
ret->data.program.body = vec_ast_new(16, ast_free);
|
|
||||||
}
|
|
||||||
if (kind == AST_RAW_STRING)
|
|
||||||
{
|
|
||||||
ret->data.raw_string.len = 0;
|
|
||||||
ret->data.raw_string.str = NULL;
|
|
||||||
ret->data.raw_string.kind = AST_WORD_NO_QUOTE;
|
|
||||||
ret->data.raw_string.start = true;
|
|
||||||
ret->data.raw_string.end = true;
|
|
||||||
}
|
|
||||||
if (kind == AST_SUBSHELL)
|
|
||||||
{
|
|
||||||
ret->data.subshell.term = AST_TERM_NONE;
|
|
||||||
ret->data.subshell.body = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.subshell.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.subshell.bang = false;
|
|
||||||
}
|
|
||||||
if (kind == AST_UNTIL)
|
|
||||||
{
|
|
||||||
ret->data.until.condition = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.until.do_ = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.until.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.until.term = AST_TERM_NONE;
|
|
||||||
}
|
|
||||||
if (kind == AST_VARIABLE_ASSIGNMENT)
|
|
||||||
{
|
|
||||||
ret->data.variable_assignment.name = NULL;
|
|
||||||
ret->data.variable_assignment.value = NULL;
|
|
||||||
ret->data.variable_assignment.bang = false;
|
|
||||||
}
|
|
||||||
if (kind == AST_WHILE)
|
|
||||||
{
|
|
||||||
ret->data.while_.condition = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.while_.do_ = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.while_.suffixes_redirections = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.while_.term = AST_TERM_NONE;
|
|
||||||
}
|
|
||||||
if (kind == AST_WORD)
|
|
||||||
{
|
|
||||||
ret->data.word.inner = vec_ast_new(16, ast_free);
|
|
||||||
ret->data.word.kind = AST_WORD_NO_QUOTE;
|
|
||||||
}
|
|
||||||
if (kind == AST_EXTGLOB)
|
|
||||||
{
|
|
||||||
ret->data.extglob.pattern = NULL;
|
|
||||||
}
|
|
||||||
if (kind == AST_REGEX)
|
|
||||||
{
|
|
||||||
ret->data.regex.pattern = NULL;
|
|
||||||
}
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ast_set_term(t_ast_node *node, t_ast_terminator_kind term)
|
void ast_set_term(t_ast_node *node, t_ast_terminator_kind term)
|
||||||
{
|
{
|
||||||
t_ast_terminator_kind void_storage;
|
t_ast_terminator_kind void_storage;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue