style : norming all the header (sorted the enum)
This commit is contained in:
parent
1ba78fe873
commit
58abb9b168
4 changed files with 68 additions and 8 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */
|
/* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/09/27 11:38:18 by rparodi ### ########.fr */
|
/* Updated: 2024/09/27 22:37:22 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,12 +21,12 @@
|
||||||
enum e_token
|
enum e_token
|
||||||
{
|
{
|
||||||
AMP,
|
AMP,
|
||||||
|
CARRET,
|
||||||
DOLLAR,
|
DOLLAR,
|
||||||
DQUOTE,
|
DQUOTE,
|
||||||
LPAREN,
|
LPAREN,
|
||||||
NQUOTE,
|
NQUOTE,
|
||||||
PIPE,
|
PIPE,
|
||||||
CARRET,
|
|
||||||
RPAREN,
|
RPAREN,
|
||||||
SEMICOLON,
|
SEMICOLON,
|
||||||
SQUOTE,
|
SQUOTE,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* what_is_it.c :+: :+: :+: */
|
/* dollar.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/27 11:46:45 by rparodi #+# #+# */
|
/* Created: 2024/09/27 22:18:46 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/09/27 12:48:18 by rparodi ### ########.fr */
|
/* Updated: 2024/09/27 22:20:40 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
#include "me/types.h"
|
#include "me/types.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
bool is_quote(char c)
|
bool is_dollar(char c)
|
||||||
{
|
{
|
||||||
if (c == '"' || c == '\'')
|
if (c == '$')
|
||||||
return (true);
|
return (true);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
45
parser/src/quotes.c
Normal file
45
parser/src/quotes.c
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* quotes.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/09/27 11:46:45 by rparodi #+# #+# */
|
||||||
|
/* Updated: 2024/09/27 22:35:20 by rparodi ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "me/vec/vec_token.h"
|
||||||
|
#include "parser/token.h"
|
||||||
|
#include "me/string/string.h"
|
||||||
|
#include "me/types.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
bool is_quote(char c)
|
||||||
|
{
|
||||||
|
if (c == '"' || c == '\'')
|
||||||
|
return (true);
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
t_error find_end_string(t_str raw, t_usize *start, t_token *output)
|
||||||
|
{
|
||||||
|
if (!raw || !output)
|
||||||
|
return (ERROR);
|
||||||
|
if (is_quote(raw[(*start)]))
|
||||||
|
{
|
||||||
|
string_push_char(output->string, raw[(*start)]);
|
||||||
|
(*start)++;
|
||||||
|
if (raw[(*start)] == '\0')
|
||||||
|
return (ERROR);
|
||||||
|
while (raw[(*start)] != '\0')
|
||||||
|
{
|
||||||
|
string_push_char(output->string.buf, raw[(*start)]);
|
||||||
|
if (is_quote(raw[(*start)]))
|
||||||
|
return (NO_ERROR);
|
||||||
|
(*start)++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (ERROR);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/25 16:27:03 by rparodi #+# #+# */
|
/* Created: 2024/09/25 16:27:03 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/09/27 13:14:23 by rparodi ### ########.fr */
|
/* Updated: 2024/09/27 22:29:04 by rparodi ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,10 +15,25 @@
|
||||||
#include "me/types.h"
|
#include "me/types.h"
|
||||||
#include "me/vec/vec_token.h"
|
#include "me/vec/vec_token.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
bool is_space(char c)
|
||||||
|
{
|
||||||
|
if (c == ' ')
|
||||||
|
return (true);
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
t_error start_analyse(t_const_str raw, enum e_token list, t_vec_token *output)
|
t_error start_analyse(t_const_str raw, enum e_token list, t_vec_token *output)
|
||||||
{
|
{
|
||||||
|
t_usize i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (raw[i] != '\0')
|
||||||
|
{
|
||||||
|
if (is_space(raw[i]))
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t_error tokeniser(t_const_str raw, enum e_token list)
|
t_error tokeniser(t_const_str raw, enum e_token list)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue