23 typedef enum e_token_type
40 typedef enum e_quote_type
50 typedef enum e_node_type
70 typedef struct s_token
101 typedef struct s_cmd_node
110 typedef struct s_redir_node
122 typedef struct s_binary_node
131 typedef struct s_subshell_node
139 typedef union u_ast_data
163 typedef struct s_shell
183 typedef enum e_syntax_error
208 typedef struct s_wild_ctx
t_syntax_error
Syntax error codes (for parser)
t_token_type
Token types produced by Lexer.
t_node_type
AST node types.
t_quote_type
Quote context of a token.
t_ast_data data
cmd, redir or binary data
t_node_type type
To determine which union member to pick.
Binary operator data inside AST Node (pipe)
struct s_ast * left
left child (before pipe)
struct s_ast * right
right child (after pipe)
Command data inside AST node.
char ** args
NULL terminated args array.
int argc
Number of arguments.
Environment variable (doubly linked list)
char * value
Value (NULL if export only)
struct s_env * prev
Previous node.
struct s_env * next
Next node.
Redirection data inside AST node.
int heredoc_fd
Heredoc pipe fd (-1 if not used)
t_node_type redir_type
Redirection type.
char * file
Target filename or delimiter.
struct s_ast * cmd
Command subtree.
int quote
1 if delimiter was quoted
int interactive
1 if STDIN is a tty
t_env * env
Environment linked list.
int is_child
Child flag (to avoid leaks)
int running
1 while main loop is active
char * current_input
Current input line.
int exit_status
Last command's exit status.
struct s_ast * current_ast
Currently executing AST.
struct s_ui * ui
UI state (NULL if off)
int ui_mode
1 if UI mode (–ui)
Subshell data inside of the AST node.
Lexer token (singly linked list)
char * value
Text content (allocated)
t_token_type type
Token type (word, pipe, redir)
struct s_token * next
Next token.
t_quote_type quote_type
Quote context.
int connected
1 if connected
t_token ** head
pointer to the list head pointer
t_token * end
last token of the current chain
t_token * cur
first token of the current chain
t_token ** prev
pointer to the previous token
Only one will be valid depending on node's type.