This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sym_get_sets.c
52 lines (44 loc) · 1.64 KB
/
sym_get_sets.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sym_get_sets.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mgautier <mgautier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/03 17:53:15 by mgautier #+# #+# */
/* Updated: 2018/01/03 18:45:15 by mgautier ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "sym_defs.h"
#include <stdarg.h>
static t_bool same_sym(void const *sym, va_list args)
{
return (sym == va_arg(args, t_symbol const*));
}
t_bool has_symbol_in_set(t_lst const *set, t_symbol const *to_find)
{
return (NULL !=
f_lst_every_valid_va(set, FALSE, same_sym, to_find));
}
t_bool has_symbol_in_first(
t_symbol const *search_in, t_symbol const *to_find)
{
return (has_symbol_in_set(search_in->first, to_find));
}
t_bool has_symbol_in_follow(
t_symbol const *search_in, t_symbol const *to_find)
{
return (has_symbol_in_set(search_in->follow, to_find));
}
/*
** Used in debug.
*/
t_lst const *get_first_set(t_symbol const *sym)
{
return (sym->first);
}
t_lst const *get_follow_set(t_symbol const *sym)
{
return (sym->follow);
}