Norm: Parser static now at the norm

This commit is contained in:
Maieul BOYER 2024-06-10 15:36:38 +02:00
parent 5759396eb2
commit c24766ee47
No known key found for this signature in database
25 changed files with 116 additions and 69 deletions

View file

@ -16,7 +16,7 @@
t_alias_sequences_array *create_alias_sequences(void) t_alias_sequences_array *create_alias_sequences(void)
{ {
static t_alias_sequences_array table = {}; static t_alias_sequences_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_external_scanner_states_array *create_external_scanner_states(void) t_external_scanner_states_array *create_external_scanner_states(void)
{ {
static t_external_scanner_states_array table = {}; static t_external_scanner_states_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_external_scanner_symbol_map_array *create_external_scanner_symbol_map(void) t_external_scanner_symbol_map_array *create_external_scanner_symbol_map(void)
{ {
static t_external_scanner_symbol_map_array table = {}; static t_external_scanner_symbol_map_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_field_map_entries_array *create_field_map_entries(void) t_field_map_entries_array *create_field_map_entries(void)
{ {
static t_field_map_entries_array table = {}; static t_field_map_entries_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_field_map_slices_array *create_field_map_slices(void) t_field_map_slices_array *create_field_map_slices(void)
{ {
static t_field_map_slices_array table = {}; static t_field_map_slices_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_field_names_array *create_field_names(void) t_field_names_array *create_field_names(void)
{ {
static t_field_names_array table = {}; static t_field_names_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_lex_keywords_array *create_lex_keywords(void) t_lex_keywords_array *create_lex_keywords(void)
{ {
static t_lex_keywords_array table = {}; static t_lex_keywords_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_lex_modes_array *create_lex_modes(void) t_lex_modes_array *create_lex_modes(void)
{ {
static t_lex_modes_array table = {}; static t_lex_modes_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_lex_normal_array *create_lex_normal(void) t_lex_normal_array *create_lex_normal(void)
{ {
static t_lex_normal_array table = {}; static t_lex_normal_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_non_terminal_alias_map_array *create_non_terminal_alias_map(void) t_non_terminal_alias_map_array *create_non_terminal_alias_map(void)
{ {
static t_non_terminal_alias_map_array table = {}; static t_non_terminal_alias_map_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -17,7 +17,7 @@
t_parse_actions_entries_array *create_parse_actions_entries(void) t_parse_actions_entries_array *create_parse_actions_entries(void)
{ {
static t_parse_actions_entries_array table = {}; static t_parse_actions_entries_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_parse_table_array *create_parse_table(void) t_parse_table_array *create_parse_table(void)
{ {
static t_parse_table_array table = {}; static t_parse_table_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_primary_state_ids_array *create_primary_state_ids(void) t_primary_state_ids_array *create_primary_state_ids(void)
{ {
static t_primary_state_ids_array table = {}; static t_primary_state_ids_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_small_parse_table_array *create_small_parse_table(void) t_small_parse_table_array *create_small_parse_table(void)
{ {
static t_small_parse_table_array table = {}; static t_small_parse_table_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_small_parse_table_map_array *create_small_parse_table_map(void) t_small_parse_table_map_array *create_small_parse_table_map(void)
{ {
static t_small_parse_table_map_array table = {}; static t_small_parse_table_map_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_symbols_metadata_array *create_symbols_metadata(void) t_symbols_metadata_array *create_symbols_metadata(void)
{ {
static t_symbols_metadata_array table = {}; static t_symbols_metadata_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_symbols_names_array *create_symbols_names(void) t_symbols_names_array *create_symbols_names(void)
{ {
static t_symbols_names_array table = {}; static t_symbols_names_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -16,7 +16,7 @@
t_unique_symbols_map_array *create_unique_symbols_map(void) t_unique_symbols_map_array *create_unique_symbols_map(void)
{ {
static t_unique_symbols_map_array table = {}; static t_unique_symbols_map_array table = {};
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {

View file

@ -13,7 +13,8 @@
#ifndef EXTERNAL_SCANNER_SYMBOL_IDENTIFIERS_H #ifndef EXTERNAL_SCANNER_SYMBOL_IDENTIFIERS_H
# define EXTERNAL_SCANNER_SYMBOL_IDENTIFIERS_H # define EXTERNAL_SCANNER_SYMBOL_IDENTIFIERS_H
enum e_external_scanner_symbol_identifiers { enum e_external_scanner_symbol_identifiers
{
ts_external_token_heredoc_start = 0, ts_external_token_heredoc_start = 0,
ts_external_token_simple_heredoc_body = 1, ts_external_token_simple_heredoc_body = 1,
ts_external_token__heredoc_body_beginning = 2, ts_external_token__heredoc_body_beginning = 2,

View file

@ -13,7 +13,8 @@
#ifndef FIELD_IDENTIFIERS_H #ifndef FIELD_IDENTIFIERS_H
# define FIELD_IDENTIFIERS_H # define FIELD_IDENTIFIERS_H
enum e_field_identifiers { enum e_field_identifiers
{
field_alternative = 1, field_alternative = 1,
field_arg = 2, field_arg = 2,
field_body = 3, field_body = 3,

View file

@ -13,7 +13,8 @@
#ifndef SYMBOLS_H #ifndef SYMBOLS_H
# define SYMBOLS_H # define SYMBOLS_H
enum e_symbols { enum e_symbols
{
sym_word = 1, sym_word = 1,
anon_sym_for = 2, anon_sym_for = 2,
anon_sym_in = 3, anon_sym_in = 3,

View file

@ -22,6 +22,10 @@
# include "./inline.h" # include "./inline.h"
# include "../../../parse_types.h" # include "../../../parse_types.h"
bool lex_normal_s237_bis(t_lexer *lexer, t_lexer_state *s, bool *ret);
bool lex_normal_s238_bis(t_lexer *lexer, t_lexer_state *s, bool *ret);
bool lex_normal_s250_bis(t_lexer *lexer, t_lexer_state *s, bool *ret);
bool lex_normal_s0(t_lexer *lexer, t_lexer_state *s); bool lex_normal_s0(t_lexer *lexer, t_lexer_state *s);
bool lex_normal_s1(t_lexer *lexer, t_lexer_state *s); bool lex_normal_s1(t_lexer *lexer, t_lexer_state *s);
bool lex_normal_s2(t_lexer *lexer, t_lexer_state *s); bool lex_normal_s2(t_lexer *lexer, t_lexer_state *s);

View file

@ -32,22 +32,10 @@ bool lex_normal_s236(t_lexer *lexer, t_lexer_state *s)
bool lex_normal_s237(t_lexer *lexer, t_lexer_state *s) bool lex_normal_s237(t_lexer *lexer, t_lexer_state *s)
{ {
if (s->eof) bool ret;
return (lex_advance(251, lexer, s));
if (s->lookahead == '\n') if (lex_normal_s237_bis(lexer, s, &ret))
return (lex_advance(308, lexer, s)); return (ret);
if (s->lookahead == '#')
return (lex_advance(437, lexer, s));
if (s->lookahead == '&')
return (lex_advance(355, lexer, s));
if (s->lookahead == ')')
return (lex_advance(273, lexer, s));
if (s->lookahead == ';')
return (lex_advance(535, lexer, s));
if (s->lookahead == '<')
return (lex_advance(288, lexer, s));
if (s->lookahead == '>')
return (lex_advance(291, lexer, s));
if (s->lookahead == '\\') if (s->lookahead == '\\')
return (lex_skip(246, lexer, s)); return (lex_skip(246, lexer, s));
if (s->lookahead == '`') if (s->lookahead == '`')
@ -64,22 +52,10 @@ bool lex_normal_s237(t_lexer *lexer, t_lexer_state *s)
bool lex_normal_s238(t_lexer *lexer, t_lexer_state *s) bool lex_normal_s238(t_lexer *lexer, t_lexer_state *s)
{ {
if (s->eof) bool ret;
return (lex_advance(251, lexer, s));
if (s->lookahead == '\n') if (lex_normal_s238_bis(lexer, s, &ret))
return (lex_advance(308, lexer, s)); return (ret);
if (s->lookahead == '#')
return (lex_advance(437, lexer, s));
if (s->lookahead == '&')
return (lex_advance(355, lexer, s));
if (s->lookahead == ')')
return (lex_advance(273, lexer, s));
if (s->lookahead == ';')
return (lex_advance(535, lexer, s));
if (s->lookahead == '<')
return (lex_advance(288, lexer, s));
if (s->lookahead == '>')
return (lex_advance(291, lexer, s));
if (s->lookahead == '\\') if (s->lookahead == '\\')
return (lex_skip(247, lexer, s)); return (lex_skip(247, lexer, s));
if (s->lookahead == '`') if (s->lookahead == '`')

View file

@ -14,22 +14,10 @@
bool lex_normal_s250(t_lexer *lexer, t_lexer_state *s) bool lex_normal_s250(t_lexer *lexer, t_lexer_state *s)
{ {
if (s->eof) bool ret;
return (lex_advance(251, lexer, s));
if (lex_normal_map250(lexer, s)) if (lex_normal_s250_bis(lexer, s, &ret))
return (true); return (ret);
if (s->lookahead == '\\')
return (lex_skip(245, lexer, s));
if (s->lookahead == '^')
return (lex_advance(351, lexer, s));
if (s->lookahead == '`')
return (lex_advance(432, lexer, s));
if (s->lookahead == 'd')
return (lex_advance(231, lexer, s));
if (s->lookahead == 'e')
return (lex_advance(229, lexer, s));
if (s->lookahead == 'f')
return (lex_advance(227, lexer, s));
if (s->lookahead == 'i') if (s->lookahead == 'i')
return (lex_advance(230, lexer, s)); return (lex_advance(230, lexer, s));
if (s->lookahead == '|') if (s->lookahead == '|')

View file

@ -0,0 +1,76 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* state_additional.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_normal_funcs.h"
bool lex_normal_s237_bis(t_lexer *lexer, t_lexer_state *s, bool *ret)
{
if (s->eof)
return (*ret = lex_advance(251, lexer, s), true);
if (s->lookahead == '\n')
return (*ret = lex_advance(308, lexer, s), true);
if (s->lookahead == '#')
return (*ret = lex_advance(437, lexer, s), true);
if (s->lookahead == '&')
return (*ret = lex_advance(355, lexer, s), true);
if (s->lookahead == ')')
return (*ret = lex_advance(273, lexer, s), true);
if (s->lookahead == ';')
return (*ret = lex_advance(535, lexer, s), true);
if (s->lookahead == '<')
return (*ret = lex_advance(288, lexer, s), true);
if (s->lookahead == '>')
return (*ret = lex_advance(291, lexer, s), true);
return (false);
}
bool lex_normal_s238_bis(t_lexer *lexer, t_lexer_state *s, bool *ret)
{
if (s->eof)
return (*ret = lex_advance(251, lexer, s), true);
if (s->lookahead == '\n')
return (*ret = lex_advance(308, lexer, s), true);
if (s->lookahead == '#')
return (*ret = lex_advance(437, lexer, s), true);
if (s->lookahead == '&')
return (*ret = lex_advance(355, lexer, s), true);
if (s->lookahead == ')')
return (*ret = lex_advance(273, lexer, s), true);
if (s->lookahead == ';')
return (*ret = lex_advance(535, lexer, s), true);
if (s->lookahead == '<')
return (*ret = lex_advance(288, lexer, s), true);
if (s->lookahead == '>')
return (*ret = lex_advance(291, lexer, s), true);
return (false);
}
bool lex_normal_s250_bis(t_lexer *lexer, t_lexer_state *s, bool *ret)
{
if (s->eof)
return (*ret = lex_advance(251, lexer, s), true);
if (lex_normal_map250(lexer, s))
return (*ret = true, true);
if (s->lookahead == '\\')
return (*ret = lex_skip(245, lexer, s), true);
if (s->lookahead == '^')
return (*ret = lex_advance(351, lexer, s), true);
if (s->lookahead == '`')
return (*ret = lex_advance(432, lexer, s), true);
if (s->lookahead == 'd')
return (*ret = lex_advance(231, lexer, s), true);
if (s->lookahead == 'e')
return (*ret = lex_advance(229, lexer, s), true);
if (s->lookahead == 'f')
return (*ret = lex_advance(227, lexer, s), true);
return (false);
}