mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
norm: fix line too long & rename token_build to builder in all locations
This commit is contained in:
parent
068a7c85c0
commit
6f175dd792
1 changed files with 26 additions and 26 deletions
|
|
@ -13,44 +13,44 @@
|
|||
#include "wordsplit.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void delimit(t_token_build *token_build)
|
||||
void delimit(t_token_build *builder)
|
||||
{
|
||||
if (token_build->cur_token == NULL)
|
||||
if (builder->cur_token == NULL)
|
||||
return ;
|
||||
token_build->wordlist = wordlist_push(token_build->wordlist,
|
||||
worddesc_create(token_build->cur_token->buffer, token_build->cur_flags));
|
||||
free(token_build->cur_token);
|
||||
token_build->cur_flags = 0;
|
||||
token_build->cur_token = NULL;
|
||||
token_build->currently_in_word = false;
|
||||
token_build->currently_in_operator = false;
|
||||
builder->wordlist = wordlist_push(builder->wordlist,
|
||||
worddesc_create(builder->cur_token->buffer, builder->cur_flags));
|
||||
free(builder->cur_token);
|
||||
builder->cur_flags = 0;
|
||||
builder->cur_token = NULL;
|
||||
builder->currently_in_word = false;
|
||||
builder->currently_in_operator = false;
|
||||
}
|
||||
|
||||
void push_char(t_token_build *token_build, char c)
|
||||
void push_char(t_token_build *builder, char c)
|
||||
{
|
||||
if (token_build->cur_token == NULL)
|
||||
token_build->cur_token = ft_buffer_new();
|
||||
ft_buffer_pushchar(token_build->cur_token, c);
|
||||
if (builder->cur_token == NULL)
|
||||
builder->cur_token = ft_buffer_new();
|
||||
ft_buffer_pushchar(builder->cur_token, c);
|
||||
}
|
||||
|
||||
void new_word(t_token_build *token_build, char c)
|
||||
void new_word(t_token_build *builder, char c)
|
||||
{
|
||||
push_char(token_build, c);
|
||||
token_build->currently_in_word = true;
|
||||
push_char(builder, c);
|
||||
builder->currently_in_word = true;
|
||||
}
|
||||
|
||||
void quote_flip(t_token_build *token_build, char c)
|
||||
void quote_flip(t_token_build *builder, char c)
|
||||
{
|
||||
if (token_build->quote == '\0')
|
||||
token_build->quote = c;
|
||||
else if (token_build->quote == c)
|
||||
token_build->quote = '\0';
|
||||
push_char(token_build, c);
|
||||
if (builder->quote == '\0')
|
||||
builder->quote = c;
|
||||
else if (builder->quote == c)
|
||||
builder->quote = '\0';
|
||||
push_char(builder, c);
|
||||
}
|
||||
|
||||
void operator_start(t_token_build *token_build, char c)
|
||||
void operator_start(t_token_build *builder, char c)
|
||||
{
|
||||
delimit(token_build);
|
||||
new_word(token_build, c);
|
||||
token_build->currently_in_operator = true;
|
||||
delimit(builder);
|
||||
new_word(builder, c);
|
||||
builder->currently_in_operator = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue