diff --git a/shcat_c/parser/Filelist.mk b/shcat_c/parser/Filelist.mk index 8f218c84..2d9180e2 100644 --- a/shcat_c/parser/Filelist.mk +++ b/shcat_c/parser/Filelist.mk @@ -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 \ diff --git a/shcat_c/parser/Makefile b/shcat_c/parser/Makefile index 8e898cc5..c47524d6 100644 --- a/shcat_c/parser/Makefile +++ b/shcat_c/parser/Makefile @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # 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 # # # # **************************************************************************** # diff --git a/shcat_c/parser/static/lex_funcs/lex_keywords/lex_keywords_funcs.h b/shcat_c/parser/static/lex_funcs/lex_keywords/lex_keywords_funcs.h index ea13fb4a..27f4833f 100644 --- a/shcat_c/parser/static/lex_funcs/lex_keywords/lex_keywords_funcs.h +++ b/shcat_c/parser/static/lex_funcs/lex_keywords/lex_keywords_funcs.h @@ -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); diff --git a/shcat_c/parser/static/lex_funcs/lex_keywords/state_0.c b/shcat_c/parser/static/lex_funcs/lex_keywords/state_0.c index ef91ef62..f0848713 100644 --- a/shcat_c/parser/static/lex_funcs/lex_keywords/state_0.c +++ b/shcat_c/parser/static/lex_funcs/lex_keywords/state_0.c @@ -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') diff --git a/shcat_c/parser/static/lex_funcs/lex_keywords/state_0_bis.c b/shcat_c/parser/static/lex_funcs/lex_keywords/state_0_bis.c new file mode 100644 index 00000000..897bf3fd --- /dev/null +++ b/shcat_c/parser/static/lex_funcs/lex_keywords/state_0_bis.c @@ -0,0 +1,51 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* state_0_bis.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: maiboyer +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* 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); +} diff --git a/shcat_c/parser/static/lex_funcs/lex_keywords/state_4.c b/shcat_c/parser/static/lex_funcs/lex_keywords/state_4.c index 61236348..297eec16 100644 --- a/shcat_c/parser/static/lex_funcs/lex_keywords/state_4.c +++ b/shcat_c/parser/static/lex_funcs/lex_keywords/state_4.c @@ -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') diff --git a/shcat_c/parser/static/lex_funcs/lex_keywords/state_4_bis.c b/shcat_c/parser/static/lex_funcs/lex_keywords/state_4_bis.c new file mode 100644 index 00000000..0e451fa7 --- /dev/null +++ b/shcat_c/parser/static/lex_funcs/lex_keywords/state_4_bis.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* state_0_bis.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: maiboyer +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* 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); +} diff --git a/shcat_c/parser/static/lex_funcs/lex_normal/state_helper.c b/shcat_c/parser/static/lex_funcs/lex_normal/state_helper.c index 8be7a413..35e836f7 100644 --- a/shcat_c/parser/static/lex_funcs/lex_normal/state_helper.c +++ b/shcat_c/parser/static/lex_funcs/lex_normal/state_helper.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* state_helper.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: rparodi +#+ +:+ +#+ */ +/* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); -} diff --git a/shcat_c/parser/static/lex_funcs/lex_normal/state_helper2.c b/shcat_c/parser/static/lex_funcs/lex_normal/state_helper2.c new file mode 100644 index 00000000..14aa76e5 --- /dev/null +++ b/shcat_c/parser/static/lex_funcs/lex_normal/state_helper2.c @@ -0,0 +1,58 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* state_helper2.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: maiboyer +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* 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); +}