minishell
Minishell Project for École 42
|
Functions for lexical analysis, tokenization and parsing. More...
#include "minishell.h"
Functions | |
bool | check_pipe_syntax (t_lexer_list *lexer) |
Performs a pipe syntax check on the given list of lexems t_lexer_list *lexer. | |
t_lexer_list * | lexer (t_shell *shell) |
Lexical analysis and tokenization of the input string. | |
bool | parser (t_shell *shell) |
Parses the input using the lexer. | |
Functions for lexical analysis, tokenization and parsing.
bool check_pipe_syntax | ( | t_lexer_list * | lexer | ) |
Performs a pipe syntax check on the given list of lexems t_lexer_list *lexer.
Checks the lexer list for a syntax error with pipes, by checking if a valid token is encounterd after a PIPE token.
lexer | A pointer to the lexer list. |
t_lexer_list * lexer | ( | t_shell * | shell | ) |
Lexical analysis and tokenization of the input string.
Performs the lexical analysis and tokenization of the input string. First frees the previous 'rl_copy' if it exists, then creates a clean copy of the input string and removes leading/trailing whitespaces. Checks the syntax of the quotes. If syntax is incorrect, print message, set g_exit_code and return NULL. Calls tokenize() to tokenize the clean copy and returns the head of the returned lexer list.
shell | The shell data structure (main data structure). @ return A pointer to the head of the lexer list if successful, otherwise NULL. |
bool parser | ( | t_shell * | shell | ) |
Parses the input using the lexer.
Performs the parsing operation using the lexer. It first frees the existing lexer list if it exists. Then uses lexer() to generate a new list. If it failes to produce a new list, returns false. Else returns true.
shell | The shell data structure (main data structure). |