diff --git a/42sh/grammar/copie b/42sh/grammar/copie new file mode 100644 index 00000000..e22142e4 --- /dev/null +++ b/42sh/grammar/copie @@ -0,0 +1,87 @@ +#SEPARATOR + +separator - separator : 0 +separator - sequential_sep : 0 +separator - separator_op : 0 +separator - linebreak : 0 +separator - newline_list : 0 +separator - here_end : 0 +separator - io_here : 0 +separator - filename : 0 +separator - io_file : 0 +separator - io_redirect : 0 +separator - redirect_list : 0 +separator - cmd_suffix : 0 +separator - cmd_prefix : 0 +separator - cmd_word : 0 +separator - cmd_name : 0 +separator - simple_commound : 0 +separator - do_group : 0 +separator - brace_group : 0 +separator - fname : 0 +separator - function_body : 0 +separator - function_definition : 0 +separator - until_clause : 0 +separator - while_clause : 0 +separator - else_part : 0 +separator - if_clause : 0 +separator - pattern : 0 +separator - case_item : 0 +separator - case_item_ns : 0 +separator - case_list : 0 +separator - case_list_ns : 0 +separator - case_clause : 0 +separator - wordlist : 0 +separator - in : 0 +separator - name : 0 +separator - term : 0 +separator - compound_list : 0 +separator - subshell : 0 +separator - compound_command : 0 +separator - command : 0 +separator - pipe_sequence : 0 +separator - pipeline : 0 +separator - and_or : 0 +separator - list : 0 +separator - complete_command : 0 +separator - complete_commands : 0 +separator - program : 0 +separator - In : 0 +#separator - Lbrace : 0 +#separator - Rbrace : 0 +#separator - Bang : 0 +separator - case : 0 +separator - esac : 0 +separator - while : 0 +separator - until : 0 +separator - for : 0 +separator - if : 0 +separator - then : 0 +separator - else : 0 +separator - elif : 0 +separator - fi : 0 +separator - do : 0 +separator - done : 0 +separator - CLOBBER : 0 +separator - DLESS : 0 +separator - DGREAT : 0 +separator - LESSAND : 0 +separator - GREATAND : 0 +separator - LESSGREAT : 0 +separator - DLESSDAH : 0 +separator - AND_IF : 0 +separator - OR_IF : 0 +separator - DSEMI : 0 +separator - WORD : 0 +separator - ASSIGNEMENT_WORD : 0 +separator - NAME : 0 +separator - NEWLINE : 0 +separator - IO_NUMER : 0 +separator - SEMI : 0 +separator - AMP : 0 +separator - EMPTY : 0 +separator - GREAT : 0 +separator - LESS : 0 +separator - PAREN_OPEN : 0 +separator - PIPE : 0 +separator - PAREN_CLOSE : 0 diff --git a/42sh/grammar/here_end b/42sh/grammar/here_end new file mode 100644 index 00000000..0a969177 --- /dev/null +++ b/42sh/grammar/here_end @@ -0,0 +1,87 @@ +#HERE_END + +here_end - here_end : 0 +here_end - sequential_sep : 0 +here_end - separator_op : 0 +here_end - linebreak : 0 +here_end - newline_list : 0 +here_end - separator : 0 +here_end - io_here : 0 +here_end - filename : 0 +here_end - io_file : 0 +here_end - io_redirect : 0 +here_end - redirect_list : 0 +here_end - cmd_suffix : 0 +here_end - cmd_prefix : 0 +here_end - cmd_word : 0 +here_end - cmd_name : 0 +here_end - simple_commound : 0 +here_end - do_group : 0 +here_end - brace_group : 0 +here_end - fname : 0 +here_end - function_body : 0 +here_end - function_definition : 0 +here_end - until_clause : 0 +here_end - while_clause : 0 +here_end - else_part : 0 +here_end - if_clause : 0 +here_end - pattern : 0 +here_end - case_item : 0 +here_end - case_item_ns : 0 +here_end - case_list : 0 +here_end - case_list_ns : 0 +here_end - case_clause : 0 +here_end - wordlist : 0 +here_end - in : 0 +here_end - name : 0 +here_end - term : 0 +here_end - compound_list : 0 +here_end - subshell : 0 +here_end - compound_command : 0 +here_end - command : 0 +here_end - pipe_sequence : 0 +here_end - pipeline : 0 +here_end - and_or : 0 +here_end - list : 0 +here_end - complete_command : 0 +here_end - complete_commands : 0 +here_end - program : 0 +here_end - In : 0 +#here_end - Lbrace : 0 +#here_end - Rbrace : 0 +#here_end - Bang : 0 +here_end - case : 0 +here_end - esac : 0 +here_end - while : 0 +here_end - until : 0 +here_end - for : 0 +here_end - if : 0 +here_end - then : 0 +here_end - else : 0 +here_end - elif : 0 +here_end - fi : 0 +here_end - do : 0 +here_end - done : 0 +here_end - CLOBBER : 0 + here_end - DLESS : VALID - AGGREGATION k = 1, new = io_here +here_end - DGREAT : 0 +here_end - LESSAND : 0 +here_end - GREATAND : 0 +here_end - LESSGREAT : 0 + here_end - DLESSDAH : VALID - AGGREGATION k = 1, new = io_here +here_end - AND_IF : 0 +here_end - OR_IF : 0 +here_end - DSEMI : 0 +here_end - WORD : 0 +here_end - ASSIGNEMENT_WORD : 0 +here_end - NAME : 0 +here_end - NEWLINE : 0 +here_end - IO_NUMER : 0 +here_end - SEMI : 0 +here_end - AMP : 0 +here_end - EMPTY : 0 +here_end - GREAT : 0 +here_end - LESS : 0 +here_end - PAREN_OPEN : 0 +here_end - PIPE : 0 +here_end - PAREN_CLOSE : 0 diff --git a/42sh/grammar/io_here b/42sh/grammar/io_here new file mode 100644 index 00000000..654ba9e7 --- /dev/null +++ b/42sh/grammar/io_here @@ -0,0 +1,87 @@ +#IO_HERE + +io_here - io_here : 0 +io_here - sequential_sep : 0 +io_here - separator_op : 0 + io_here - linebreak : VALID - AGGREGATION k = 1, new = program +io_here - newline_list : 0 +io_here - here_end : 0 +io_here - separator : 0 +io_here - filename : 0 +io_here - io_file : 0 +io_here - io_redirect : 0 + io_here - redirect_list : VALID - NOTHING + io_here - cmd_suffix : VALID - NOTHING + io_here - cmd_prefix : VALID - NOTHING + io_here - cmd_word : VALID - AGGREGATION k = 0, new = cmd_suffix + io_here - cmd_name : VALID - AGGREGATION k = 0, new = cmd_suffix +io_here - simple_command : 0 +io_here - do_group : 0 +io_here - brace_group : 0 +io_here - fname : 0 +io_here - function_body : 0 +io_here - function_definition : 0 +io_here - until_clause : 0 +io_here - while_clause : 0 +io_here - else_part : 0 +io_here - if_clause : 0 +io_here - pattern : 0 +io_here - case_item : 0 +io_here - case_item_ns : 0 +io_here - case_list : 0 +io_here - case_list_ns : 0 +io_here - case_clause : 0 +io_here - wordlist : 0 +io_here - in : 0 +io_here - name : 0 +io_here - term : 0 +io_here - compound_list : 0 +io_here - subshell : 0 +io_here - compound_command : 0 +io_here - command : 0 +io_here - pipe_sequence : 0 +io_here - pipeline : 0 +io_here - and_or : 0 +io_here - list : 0 +io_here - complete_command : 0 +io_here - complete_commands : 0 +io_here - program : 0 +io_here - In : 0 +#io_here - Lbrace : 0 +#io_here - Rbrace : 0 +#io_here - Bang : 0 +io_here - case : 0 +io_here - esac : 0 +io_here - while : 0 +io_here - until : 0 +io_here - for : 0 +io_here - if : 0 +io_here - then : 0 +io_here - else : 0 +io_here - elif : 0 +io_here - fi : 0 +io_here - do : 0 +io_here - done : 0 +io_here - CLOBBER : 0 +io_here - DLESS : 0 +io_here - DGREAT : 0 +io_here - LESSAND : 0 +io_here - GREATAND : 0 +io_here - LESSGREAT : 0 +io_here - DLESSDAH : 0 +io_here - AND_IF : 0 +io_here - OR_IF : 0 +io_here - DSEMI : 0 +io_here - WORD : 0 +io_here - ASSIGNEMENT_WORD : 0 +io_here - NAME : 0 +io_here - NEWLINE : 0 + io_here - IO_NUMBER : VALID - AGREGATION k = 1, new = io_redirect +io_here - SEMI : 0 +io_here - AMP : 0 +io_here - EMPTY : 0 +io_here - GREAT : 0 +io_here - LESS : 0 +io_here - PAREN_OPEN : 0 +io_here - PIPE : 0 +io_here - PAREN_CLOSE : 0 diff --git a/42sh/grammar/newline_list b/42sh/grammar/newline_list index daabf0af..94dc6b8e 100644 --- a/42sh/grammar/newline_list +++ b/42sh/grammar/newline_list @@ -1,10 +1,10 @@ #NEWLINE_LIST -newline_list - newline_list : 0 + newline_list - newline_list : VALID - NOTHING newline_list - sequential_sep : 0 newline_list - separator_op : 0 -newline_list - separator : 0 -newline_list - newline_list : 0 + newline_list - separator : VALID - NOTHNG !!! + newline_list - linebreak : VALID - NOTHING newline_list - here_end : 0 newline_list - io_here : 0 newline_list - filename : 0 @@ -34,7 +34,7 @@ newline_list - case_clause : 0 newline_list - wordlist : 0 newline_list - in : 0 newline_list - name : 0 -newline_list - term : 0 + newline_list - term : AGGREGATION k - 0, new = separator newline_list - compound_list : 0 newline_list - subshell : 0 newline_list - compound_command : 0 @@ -79,9 +79,9 @@ newline_list - NEWLINE : 0 newline_list - IO_NUMER : 0 newline_list - SEMI : 0 newline_list - AMP : 0 - newline_list - EMPTY : VALID + newline_list - EMPTY : AGGREGATION k = 1, new = linebreak; newline_list - GREAT : 0 newline_list - LESS : 0 newline_list - PAREN_OPEN : 0 newline_list - PIPE : 0 - newline_list - PAREN_CLOSE : VALID +newline_list - PAREN_CLOSE : 0 diff --git a/42sh/grammar/rules b/42sh/grammar/rules index 266c6214..75b22e2b 100644 --- a/42sh/grammar/rules +++ b/42sh/grammar/rules @@ -3,12 +3,12 @@ sequential_sep - in : VALID sequential_sep - name : VALID separator - term : VALID -separator - compound_list : NOTHING !!!!! +separator - compound_list : VALID - NOTHING !!!!! -separator_op - complete_commands : NOTHING !!!! +separator_op - complete_commands : VALID - NOTHING !!!! -linebreak - linebreak : NOTHING -linebreak - separator_op : ASSIGNATION, k = 1, new = separator +linebreak - linebreak : VALID - NOTHING +linebreak - separator_op : VALID - ASSIGNATION, k = 1, new = separator linebreak - in : VALID linebreak - name : VALID linebreak - compound_list : VALID @@ -16,6 +16,46 @@ linebreak - complete_commands : VALID linebreak - AND_IF : VALID linebreak - OR_IF : VALID linebreak - WORD : VALID -linebreak - SEMI : AGGREGATION k - 1, new = sequential_sep -linebreak - EMPTY : VALID +linebreak - SEMI : VALID - AGGREGATION k = 1, new = sequential_sep linebreak - PAREN_CLOSE : VALID + +newline_list - newline_list : VALID - NOTHING +newline_list - separator : VALID - NOTHING !!! +newline_list - linebreak : VALID - NOTHING +newline_list - term : VALID - AGGREGATION k = 0, new = separator + +here_end - DLESS : VALID - AGGREGATION k = 1, new = io_here +here_end - DLESSDAH : VALID - AGGREGATION k = 1, new = io_here + +io_here - linebreak : VALID - AGGREGATION k = 1, new = program +io_here - redirect_list : VALID - NOTHING +io_here - cmd_suffix : VALID - NOTHING +io_here - cmd_prefix : VALID - NOTHING +io_here - cmd_word : VALID - AGGREGATION k = 0, new = cmd_suffix +io_here - cmd_name : VALID - AGGREGATION k = 0, new = cd_suffix +io_here - IO_NUMBER : VALID - AGGREGATION k = 1, new = io_redirect +io_here - compound_command : VALID - AGGREGATION k = 0, new = io_redirect + +filename - LESS : VALID - AGGREGATION k = 1, new = io_file +filename - LESSAND : VALID - AGGREGATION k = 1, new = io_file +filename - GREAT : VALID - AGGREGATION k = 1, new = io_file +filename - GREATAND : VALID - AGGREGATION k = 1, new = io_file +filename - DGREAT : VALID - AGGREGATION k = 1, new = io_file +filename - LESSGREAT : VALID - AGGREGATION k = 1, new = io_file +filename - CLOBBER : VALID - AGGREGATION k = 1, new = io_file + +io_file - redirect_list : VALID - NOTHING +io_file - cmd_suffix : VALID - NOTHING +io_file - cmd_prefix : VALID - NOTHING +io_file - cmd_name : VALID - NOTHING +io_file - cmd_word : VALID - NOTHING +io_file - linebreak : VALID - AGGREGATION k = 1, new = program +io_file - IO_NUMBER : VALID - AGGREGATION k = 1, new = io_redirect +io_file - compound_command : VALID - AGGREGATION k = 0, new = io_redirect + +io_redirect - redirect_list : VALID - NOTHING +io_redirect - compound_command : VALID - AGGREGATION k = 0, new = redirect_list + +// si transparence continuer remontee, +// si dernier membre aurait pu aussi constitue membre actuel, ne rien fiare, ainsi que transparence +//push un dernier caracter linebreak diff --git a/42sh/includes/.parser.h.swn b/42sh/includes/.parser.h.swn deleted file mode 100644 index 7a3584ac..00000000 Binary files a/42sh/includes/.parser.h.swn and /dev/null differ diff --git a/42sh/includes/lexer.h b/42sh/includes/lexer.h index 4cfa83cb..d158daf4 100644 --- a/42sh/includes/lexer.h +++ b/42sh/includes/lexer.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */ -/* Updated: 2017/02/10 01:24:00 by ariard ### ########.fr */ +/* Updated: 2017/02/10 01:43:45 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/includes/parser.h b/42sh/includes/parser.h index 632ee87f..3ebc25e6 100644 --- a/42sh/includes/parser.h +++ b/42sh/includes/parser.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:54 by jhalford #+# #+# */ -/* Updated: 2017/02/10 01:39:33 by ariard ### ########.fr */ +/* Updated: 2017/02/10 15:58:05 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/.ft_parse.c.swm b/42sh/src/parser/.ft_parse.c.swm deleted file mode 100644 index 833a54ff..00000000 Binary files a/42sh/src/parser/.ft_parse.c.swm and /dev/null differ diff --git a/42sh/src/parser/.produce_sym.c.swn b/42sh/src/parser/.produce_sym.c.swn deleted file mode 100644 index f06e7bec..00000000 Binary files a/42sh/src/parser/.produce_sym.c.swn and /dev/null differ diff --git a/42sh/src/parser/eval_sym.c b/42sh/src/parser/eval_sym.c index fefbe13a..412488a7 100644 --- a/42sh/src/parser/eval_sym.c +++ b/42sh/src/parser/eval_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 16:26:30 by ariard #+# #+# */ -/* Updated: 2017/02/10 01:42:21 by ariard ### ########.fr */ +/* Updated: 2017/02/10 16:57:46 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/ft_parse.c b/42sh/src/parser/ft_parse.c index a7316233..dfcd3d4c 100644 --- a/42sh/src/parser/ft_parse.c +++ b/42sh/src/parser/ft_parse.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 14:30:22 by ariard #+# #+# */ -/* Updated: 2017/02/10 01:40:26 by ariard ### ########.fr */ +/* Updated: 2017/02/10 16:57:51 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/produce_sym.c b/42sh/src/parser/produce_sym.c index bad1b889..d66023df 100644 --- a/42sh/src/parser/produce_sym.c +++ b/42sh/src/parser/produce_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 17:58:34 by ariard #+# #+# */ -/* Updated: 2017/02/10 01:42:12 by ariard ### ########.fr */ +/* Updated: 2017/02/10 16:57:17 by ariard ### ########.fr */ /* */ /* ************************************************************************** */