Skip to content

Commit

Permalink
Fixed some AST-related bugs and effectively finalized project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoommus committed May 16, 2019
1 parent d252be0 commit ba8c073
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: vtarasiu <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/03/24 10:11:17 by vtarasiu #+# #+# #
# Updated: 2019/05/14 20:42:19 by vtarasiu ### ########.fr #
# Updated: 2019/05/16 13:05:03 by vtarasiu ### ########.fr #
# #
# **************************************************************************** #

Expand All @@ -16,12 +16,10 @@ CC = clang

FDS = shell(ulimit -n)

FLAGS = -g -DSH=\"$(NAME)\" \
FLAGS = -DSH=\"$(NAME)\" \
-Wall \
-Wextra \
-Werror \
#-fprofile-instr-generate \
#-fsanitize="address"
-Werror

HEADER = -I include/ -I printf/include -I libft/
SRC_DIR = ./src/
Expand Down
6 changes: 3 additions & 3 deletions include/twenty_one_sh.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: vtarasiu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/07 18:12:03 by vtarasiu #+# #+# */
/* Updated: 2019/05/15 13:29:08 by vtarasiu ### ########.fr */
/* Updated: 2019/05/16 13:05:17 by vtarasiu ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -70,8 +70,8 @@
# define ERR_RUNNING_JOBS ANSI_RESET SH ": you have running jobs\n"
# define ERR_AMBIGUOUS_REDIRECT ANSI_RESET SH ": ambiguous redirect\n"

# define BUILD 2424
# define BUILD_DATE "15.05.19 13:29:08 EEST"
# define BUILD 2459
# define BUILD_DATE "16.05.19 13:05:16 EEST"

# ifdef MAX_INPUT
# undef MAX_INPUT
Expand Down
6 changes: 6 additions & 0 deletions src/ast/exec_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ static int exec_pipeline_inner(const t_node *node,
int pp[2];
t_context *context_left;

if (node->left->node_type == NODE_SUBSHELL ||
node->right->node_type == NODE_SUBSHELL)
{
ft_dprintf(2, SH ": subshells inside pipes are illegal\n");
return (127);
}
if (node->left->node_type == NODE_COMMAND &&
node->right->node_type == NODE_COMMAND)
return (exec_pipeline_terminator(node, context_right));
Expand Down
6 changes: 3 additions & 3 deletions src/ast/syntax_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: vtarasiu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/03 16:28:37 by vtarasiu #+# #+# */
/* Updated: 2019/05/14 17:30:00 by vtarasiu ### ########.fr */
/* Updated: 2019/05/15 19:32:02 by vtarasiu ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -154,7 +154,7 @@ const t_rule g_compound_command = {
const t_rule g_subshell = {
.token = TOKEN_NOT_APPLICABLE,
.expands_to = {
{&g_lbracket_token, &g_compound_list, &g_rbracket_token}
{&g_lbracket_token, &g_list, &g_rbracket_token}
},
.human_readable = "subshell",
.tree_builder = &subshell_build
Expand Down Expand Up @@ -358,7 +358,7 @@ const t_rule g_term_rule_dash = {
const t_rule g_brace_group = {
.token = TOKEN_NOT_APPLICABLE,
.expands_to = {
{&g_lbrace_token, &g_compound_list, &g_rbrace_token}
{&g_lbrace_token, &g_list, &g_rbrace_token}
},
.human_readable = "brace_group",
.tree_builder = NULL
Expand Down
2 changes: 1 addition & 1 deletion src/ast/tree_pipe_sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: vtarasiu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/02 13:13:27 by vtarasiu #+# #+# */
/* Updated: 2019/03/04 18:48:57 by vtarasiu ### ########.fr */
/* Updated: 2019/05/15 17:02:58 by vtarasiu ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/ast/tree_subshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: vtarasiu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/03 18:08:28 by vtarasiu #+# #+# */
/* Updated: 2019/03/04 18:48:56 by vtarasiu ### ########.fr */
/* Updated: 2019/05/15 17:45:48 by vtarasiu ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/expansions/expand_vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ char *expand_vars(char *str)
while (i < len)
{
ignore = check_ignore(str, i, ignore);
if (ignore != QUOTE && str[i] == '$' && i + 1 != len &&
if (ignore != QUOTE && str[i] == '$' && i + 1 != len &&
ft_isascii(str[i + 1]))
{
swap = str;
Expand Down

0 comments on commit ba8c073

Please sign in to comment.