semi-final parser

This commit is contained in:
Mthandazo Ndhlovu
2019-05-02 12:58:28 +02:00
10 changed files with 150 additions and 14 deletions

View File

@@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/23 17:43:34 by tmaze #+# #+# */
/* Updated: 2019/04/30 07:06:35 by mndhlovu ### ########.fr */
/* Updated: 2019/05/02 12:52:26 by mndhlovu ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,6 +19,56 @@ void lm_initdata(t_lmdata *data)
data->adj = NULL;
}
void lm_check_start_vert(int count, t_syntax *synt, t_lmdata *ldata, char *line)
{
if ((synt->s_pos < synt->e_pos) && lm_check_forbiden_chars(line, 0))
{
if ((count > synt->s_pos && count < synt->e_pos)
&& (!synt->s_vert))
{
if ((lm_add_vertex(ldata, line, 's', synt)))
synt->s_vert = count;
else
synt->s_error = 1;
}
}
if ((synt->s_pos > synt->e_pos) && lm_check_forbiden_chars(line, 0))
{
if (!synt->s_vert)
{
if ((lm_add_vertex(ldata, line, 's', synt)))
synt->s_vert = count;
else
synt->s_error = 1;
}
}
}
void lm_check_end_vert(int count, t_syntax *synt, t_lmdata *ldata, char *line)
{
if((synt->e_pos < synt->s_pos) && lm_check_forbiden_chars(line, 0))
{
if ((count > synt->e_pos && count < synt->s_pos)
&& (!synt->e_vert))
{
if ((lm_add_vertex(ldata, line, 'e', synt)))
synt->e_vert = count;
else
synt->e_error = 1;
}
}
if ((synt->e_pos > synt->s_pos) && lm_check_forbiden_chars(line, 0))
{
if (!synt->e_vert)
{
if ((lm_add_vertex(ldata, line, 'e', synt)))
synt->e_vert = count;
else
synt->e_error = 1;
}
}
}
int lm_init_src_dest(int *src, int *dest, t_lmdata *data
, char *raw)
{