Adding more protection to the parser, leaving it at this state for now whilst i branch out to work on a new parser
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/25 06:30:51 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/11 09:51:29 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/04/20 13:08:01 by mndhlovu ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,10 +14,12 @@
|
||||
|
||||
void lm_locate_cd(int index, t_syntax *synt, char *line)
|
||||
{
|
||||
char *tmp;
|
||||
char *tmp;
|
||||
|
||||
tmp = ft_strchr(line, '#');
|
||||
if ((!synt->s_cmd || !synt->e_cmd) && (tmp != NULL && line[1] == '#'))
|
||||
if ((!synt->s_cmd || !synt->e_cmd)
|
||||
&& (tmp != NULL && line[1] == '#'
|
||||
&& lm_check_forbiden_chars(line, 1)))
|
||||
{
|
||||
if (!synt->s_cmd)
|
||||
{
|
||||
@@ -42,7 +44,7 @@ int lm_get_ant_(int counter, t_lmdata *ldata, t_syntax *synt, ch
|
||||
{
|
||||
int value;
|
||||
|
||||
if (counter == 0)
|
||||
if (counter == 0 && lm_check_forbiden_chars(line, 0))
|
||||
{
|
||||
value = lm_get_value(line);
|
||||
if (value != -1)
|
||||
@@ -82,13 +84,13 @@ int lm_parser(t_syntax *synt, t_lmdata *ldata,
|
||||
if (!(lm_get_ant_(index, ldata, synt, raw)) && index == 0)
|
||||
{
|
||||
ft_strdel(&raw);
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
lm_locate_cd(index, synt, raw);
|
||||
if (!(lm_get_vertices(index, synt, ldata, holder, raw)))
|
||||
{
|
||||
ft_strdel(&raw);
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
ft_strdel(&raw);
|
||||
index++;
|
||||
|
||||
Reference in New Issue
Block a user