YvanoffP / minishell

3 stars 1 forks source link

Parsing pt3 #37

Closed YvanoffP closed 2 years ago

YvanoffP commented 2 years ago

Create token process with enum and identification of each parts. See the ressource image for more

YvanoffP commented 2 years ago

List of tokens

YvanoffP commented 2 years ago

The goal would be to create a realloc tab that will be called at each new word met. The principle of this will be to add one more cell to the tab to hold the new arg found.

Work with indexes and an offset to size the words we are about to malloc with substr() func.

Nodes will be as followed : char *arg; // this will be where the args stand t_node next; // next node

Any succession of chars will be counted as a string. here's a list of the splitters :

a separator or a redirect will be threated as a new node holding only the sep/redir we found

if we meet a $, it will be parsed with the entire word attached to it

pay attention to the $> ./exec_me case in this case, we would store the following : arg[x] = "./exec_me" and arg[x+1] = "case"

Bima42 commented 2 years ago

At this moment, Chained list are created, we cut arguments words by words like we tell before Then, "" ' ' and space are ok

We need :

Bima42 commented 2 years ago

So now, parsing of $ is ok. But we have to change quotes parsing :

TO DO :