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:
Mthandazo Ndhlovu
2019-04-20 13:38:13 +02:00
parent 4a5c798b25
commit bfb125f503
5 changed files with 34 additions and 20 deletions

View File

@@ -6,7 +6,7 @@
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/04 09:24:45 by mndhlovu #+# #+# */
/* Updated: 2019/04/08 16:51:51 by tmaze ### ########.fr */
/* Updated: 2019/04/20 13:25:57 by mndhlovu ### ########.fr */
/* */
/* ************************************************************************** */
@@ -62,23 +62,17 @@ void lm_get_cmd_vert(int count, t_syntax *synt
void lm_get_vert_link(int count, t_syntax *synt, t_lmdata *ldata
, t_holder *holder, char *line)
{
char *link_sign;
char *hash;
if (count > 0 && (count != synt->s_vert && count != synt->e_vert)
&& (count != synt->s_pos && count != synt->e_pos))
{
link_sign = ft_strchr(line, '-');
hash = ft_strchr(line, '#');
if (link_sign == NULL && hash == NULL)
if (lm_check_forbiden_chars(line, 0))
{
if (!(lm_add_vertex(ldata, line, 'v', synt)))
{
synt->v_error = 1;
}
}
if (link_sign != NULL && hash == NULL)
if (lm_check_forbiden_chars(line, 0))
{
if (!(lm_ext_conn(holder, ldata, line)))
{