Normed: rest of parser/static

This commit is contained in:
Maieul BOYER 2024-04-28 19:21:34 +02:00
parent df5cc636b5
commit 9c60e63fb9
No known key found for this signature in database
9 changed files with 155 additions and 88 deletions

View file

@ -4373,6 +4373,10 @@ static/symbols_names/symbols_names_2 \
static/unique_symbols_map/unique_symbols_map_0 \
static/unique_symbols_map/unique_symbols_map_1 \
static/unique_symbols_map/unique_symbols_map_2 \
static/lex_funcs/lex_normal/state_helper \
static/lex_funcs/lex_normal/state_helper2 \
static/lex_funcs/lex_keywords/state_0_bis \
static/lex_funcs/lex_keywords/state_4_bis \
src/language \
src/lexer \
src/node \

View file

@ -6,7 +6,7 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
# Updated: 2024/04/28 18:19:27 by maiboyer ### ########.fr #
# Updated: 2024/04/28 19:05:13 by maiboyer ### ########.fr #
# #
# **************************************************************************** #

View file

@ -22,6 +22,9 @@
# include "./inline.h"
# include "../../../parse_types.h"
bool lex_keywords_s0_bis(t_lexer *lexer, t_lexer_state *s);
bool lex_keywords_s22_bis(t_lexer *lexer, t_lexer_state *s);
bool lex_keywords_s0(t_lexer *lexer, t_lexer_state *s);
bool lex_keywords_s1(t_lexer *lexer, t_lexer_state *s);
bool lex_keywords_s2(t_lexer *lexer, t_lexer_state *s);

View file

@ -14,32 +14,8 @@
bool lex_keywords_s0(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == 'A')
return (lex_advance(1, lexer, s));
if (s->lookahead == 'E')
return (lex_advance(2, lexer, s));
if (s->lookahead == 'K')
return (lex_advance(3, lexer, s));
if (s->lookahead == 'L')
return (lex_advance(4, lexer, s));
if (s->lookahead == 'P')
return (lex_advance(5, lexer, s));
if (s->lookahead == 'Q')
return (lex_advance(6, lexer, s));
if (s->lookahead == 'U')
return (lex_advance(7, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(8, lexer, s));
if (s->lookahead == 'a')
return (lex_advance(9, lexer, s));
if (s->lookahead == 'c')
return (lex_advance(10, lexer, s));
if (s->lookahead == 'd')
return (lex_advance(11, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(12, lexer, s));
if (s->lookahead == 'f')
return (lex_advance(13, lexer, s));
if (lex_keywords_s0_bis(lexer, s))
return (true);
if (s->lookahead == 'i')
return (lex_advance(14, lexer, s));
if (s->lookahead == 'k')

View file

@ -0,0 +1,51 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* state_0_bis.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/14 19:17:54 by maiboyer #+# #+# */
/* Updated: 2024/04/14 19:18:20 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "lex_keywords_funcs.h"
bool lex_keywords_s0_tris(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == 'A')
return (lex_advance(1, lexer, s));
if (s->lookahead == 'E')
return (lex_advance(2, lexer, s));
if (s->lookahead == 'K')
return (lex_advance(3, lexer, s));
if (s->lookahead == 'L')
return (lex_advance(4, lexer, s));
if (s->lookahead == 'P')
return (lex_advance(5, lexer, s));
if (s->lookahead == 'Q')
return (lex_advance(6, lexer, s));
return (false);
}
bool lex_keywords_s0_bis(t_lexer *lexer, t_lexer_state *s)
{
if (lex_keywords_s0_tris(lexer, s))
return (true);
if (s->lookahead == 'U')
return (lex_advance(7, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(8, lexer, s));
if (s->lookahead == 'a')
return (lex_advance(9, lexer, s));
if (s->lookahead == 'c')
return (lex_advance(10, lexer, s));
if (s->lookahead == 'd')
return (lex_advance(11, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(12, lexer, s));
if (s->lookahead == 'f')
return (lex_advance(13, lexer, s));
return (false);
}

View file

@ -29,20 +29,8 @@ bool lex_keywords_s21(t_lexer *lexer, t_lexer_state *s)
bool lex_keywords_s22(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '\\')
return (lex_skip(8, lexer, s));
if (s->lookahead == 'c')
return (lex_advance(10, lexer, s));
if (s->lookahead == 'd')
return (lex_advance(11, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(12, lexer, s));
if (s->lookahead == 'f')
return (lex_advance(13, lexer, s));
if (s->lookahead == 'i')
return (lex_advance(14, lexer, s));
if (s->lookahead == 'l')
return (lex_advance(16, lexer, s));
if (lex_keywords_s22_bis(lexer, s))
return (true);
if (s->lookahead == 'r')
return (lex_advance(17, lexer, s));
if (s->lookahead == 's')

View file

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* state_0_bis.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/14 19:17:54 by maiboyer #+# #+# */
/* Updated: 2024/04/14 19:18:20 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "lex_keywords_funcs.h"
bool lex_keywords_s22_bis(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '\\')
return (lex_skip(8, lexer, s));
if (s->lookahead == 'c')
return (lex_advance(10, lexer, s));
if (s->lookahead == 'd')
return (lex_advance(11, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(12, lexer, s));
if (s->lookahead == 'f')
return (lex_advance(13, lexer, s));
if (s->lookahead == 'i')
return (lex_advance(14, lexer, s));
if (s->lookahead == 'l')
return (lex_advance(16, lexer, s));
return (false);
}

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* state_helper.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/28 18:39:26 by rparodi #+# #+# */
/* Updated: 2024/04/28 18:59:41 by rparodi ### ########.fr */
/* Updated: 2024/04/28 19:10:20 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -56,48 +56,3 @@ bool lex_helper_s521(t_lexer *lexer, t_lexer_state *s)
return (lex_advance(593, lexer, s));
return (false);
}
bool lex_helper_s522(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '<')
return (lex_advance(613, lexer, s));
if (s->lookahead == '>')
return (lex_advance(618, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(543, lexer, s));
if (s->lookahead == '`')
return (lex_advance(855, lexer, s));
if (s->lookahead == '|')
return (lex_advance(593, lexer, s));
return (false);
}
bool lex_helper_s86(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '>')
return (lex_advance(618, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(379, lexer, s));
if (s->lookahead == '`')
return (lex_advance(510, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(514, lexer, s));
if (s->lookahead == '|')
return (lex_advance(593, lexer, s));
return (false);
}
bool lex_helper_s87(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '>')
return (lex_advance(618, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(380, lexer, s));
if (s->lookahead == '`')
return (lex_advance(510, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(514, lexer, s));
if (s->lookahead == '|')
return (lex_advance(593, lexer, s));
return (false);
}

View file

@ -0,0 +1,58 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* state_helper2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/28 19:09:30 by maiboyer #+# #+# */
/* Updated: 2024/04/28 19:10:30 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "./lex_normal_funcs.h"
bool lex_helper_s522(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '<')
return (lex_advance(613, lexer, s));
if (s->lookahead == '>')
return (lex_advance(618, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(543, lexer, s));
if (s->lookahead == '`')
return (lex_advance(855, lexer, s));
if (s->lookahead == '|')
return (lex_advance(593, lexer, s));
return (false);
}
bool lex_helper_s86(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '>')
return (lex_advance(618, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(379, lexer, s));
if (s->lookahead == '`')
return (lex_advance(510, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(514, lexer, s));
if (s->lookahead == '|')
return (lex_advance(593, lexer, s));
return (false);
}
bool lex_helper_s87(t_lexer *lexer, t_lexer_state *s)
{
if (s->lookahead == '>')
return (lex_advance(618, lexer, s));
if (s->lookahead == '\\')
return (lex_skip(380, lexer, s));
if (s->lookahead == '`')
return (lex_advance(510, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(514, lexer, s));
if (s->lookahead == '|')
return (lex_advance(593, lexer, s));
return (false);
}