aboutsummaryrefslogtreecommitdiff
path: root/include/ms_parse.h
blob: 59c9ca894038debc1540dcc3b4c197c13dfca30f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ms_parse.h                                         :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/28 09:00:00 by cacharle          #+#    #+#             */
/*   Updated: 2020/02/28 14:57:58 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef MS_PARSE_H
# define MS_PARSE_H

# include "minishell.h"

typedef enum
{
	REDIRECTION_OUT,
	REDIRECTION_IN,
	REDIRECTION_APPEND
}						t_redirection_type;

typedef struct
{
	char				*filename;
	t_redirection_type	type;
}						t_redirection;

typedef struct
{
	char				*name;
	char				**argv;
	t_ftlst				*redirections;  // need to store them in reverse order
}						t_command;

typedef enum
{
	SEPARATOR_SEMICOLON,
	SEPARATOR_PIPE,
	// SEPARATOR_AND,  // with parhenthesis => harder
	// SEPARATOR_OR,
}						t_separator;

typedef struct
{
	t_ftlst 			*commands;
	t_ftlst 			*separators;
}						t_parsing;

/*
** parse.c
*/

t_parsing				*ms_parse(char *input);

#endif