Trying to trace the source of the segfault

I will breakdown the parser for a slight moment then relink it.
This commit is contained in:
Mthandazo Ndhlovu
2019-04-22 16:00:16 +02:00
parent a8b2e31701
commit c35deace58
15 changed files with 93 additions and 209 deletions

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* lm_parser.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
/* By: mndhlovu <mndhlovu@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/25 06:30:51 by mndhlovu #+# #+# */
/* Updated: 2019/04/20 13:08:01 by mndhlovu ### ########.fr */
/* Created: 2019/04/20 15:24:51 by mndhlovu #+# #+# */
/* Updated: 2019/04/22 15:31:03 by mndhlovu ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,22 +17,25 @@ void lm_locate_cd(int index, t_syntax *synt, char *line)
char *tmp;
tmp = ft_strchr(line, '#');
ft_printf("Bingo 1\n");
if ((!synt->s_cmd || !synt->e_cmd)
&& (tmp != NULL && line[1] == '#'
&& lm_check_forbiden_chars(line, 1)))
{
if (!synt->s_cmd)
{
if (ft_strcmp(tmp, "##start") == 0)
if (ft_strcmp(line, "##start") == 0)
{
ft_printf("Bingo 2\n");
synt->s_cmd = 1;
synt->s_pos = index;
}
}
if (!synt->e_cmd)
{
if (ft_strcmp(tmp, "##end") == 0)
if (ft_strcmp(line, "##end") == 0)
{
ft_printf("Bingo 3\n");
synt->e_cmd = 1;
synt->e_pos = index;
}
@@ -49,6 +52,7 @@ int lm_get_ant_(int counter, t_lmdata *ldata, t_syntax *synt, ch
value = lm_get_value(line);
if (value != -1)
{
ft_printf("Bingo 4 %d\n", value);
ldata->nbants = value;
synt->nb_state = 1;
return (1);
@@ -61,9 +65,11 @@ int lm_get_ant_(int counter, t_lmdata *ldata, t_syntax *synt, ch
static int lm_get_vertices(int count, t_syntax *synt,
t_lmdata *data, t_holder *holder, char *line)
{
ft_printf("Bingo 5\n");
lm_get_cmd_vert(count, synt, data, line);
if (!synt->s_error && !synt->e_error)
{
ft_printf("Bingo 6 %s\n", line);
lm_get_vert_link(count, synt, data, holder, line);
if (!synt->v_error && !synt->l_error)
return (1);