Conversation
Sync main
* fix: Update Makefile echo commands for consistency and readability * fix: Update main function to include readline and history management
) * fix: Add /build to .gitignore to exclude build directory from version control * fix: Update Makefile to improve build process and add dependency tracking * fix: Update Makefile header and adjust header file inclusion order * fix: Update minishell.h to remove token structures and adjust shell struct * feat: Add lexer.h header file with token type and structure definitions * feat: Implement input processing and readline loop in main shell function
* feat: add test utilities for token debugging and assertions * feat: implement token creation functions and add corresponding tests * fix: improve token memory management and add tests for token creation * feat: add token creation tests for various scenarios * feat: add test target to Makefile for running unit tests * feat: add ft_isspace function to check for whitespace characters * doc: add doc to free_token * feat: implement functions for skipping whitespace and determining operator types * feat: add token handling functions and improve token list debugging * fix: norm errors * feat: add tokenizer and lexer test functions, including free_token_list * feat: add memory tests for token management functions * fix: typo * fix: update token free check and header comment timestamp * fix: update function name for whitespace check in ft_atoi * fix: remove semicolon from include directive in test_utils.h * fix: add test_runner to .gitignore * fix: update Makefile for test integration and improve debug output * fix: norm in init.c and lexer.c --------- Co-authored-by: Nathalia Vitoria Buchholz <nbuchhol@c1r5p3.42sp.org.br>
* fix: update Makefile for Valgrind suppression and add readline suppression file * feat: add test targets for running tests and Valgrind checks in Makefile * test: main function to include new test functionality * feat: enhance lexer with word handling and metacharacter checks * fix: correct parameter descriptions in skip_whitespace function documentation --------- Co-authored-by: Nathalia Vitoria Buchholz <nbuchhol@c1r5p3.42sp.org.br>
…#65) * fix: update Makefile to include additional test source files * feat: add support for redirection append operator in lexer * feat: add tests for append operator functionality in lexer
* fix: update lexer.h to include TOKEN_HEREDOC in token type enumeration * feat: implement operator type recognition in new operators.c file * feat: add is_operator function to identify shell operator metacharacters
* refactor: remove memory leak test from memory tests suite * feat: add heredoc support in lexer and token utilities * test: add heredoc tests and update test runner * fix: norm in test heredoc --------- Co-authored-by: Nathalia Vitoria Buchholz <nbuchhol@c1r5p3.42sp.org.br>
* Remove unused parser files: ast.c and expansion.c * Add parser structures and initial command parsing implementation * feat: parser header and Makefile to include new command structures and source files * feat: implement command and redirection management functions * fix: correct struct name for command * feat: add command counting and printing functions for debugging * feat: add get_next_token function to retrieve the next token in the list * feat: implement validation and identification functions for redirection tokens * feat: add validation and utility functions for command and redirection handling * feat: add syntax validation functions for token sequences * wip * fix: remove outdated comment * wip: parse cmds * feat: implement redirection parsing and update command structure * fix: correct function name for redirection checks in syntax validation * feat: enhance command and redirection structures with additional documentation * feat: add syntax validation tests for command parsing and redirection * test: update heredoc tests and add simple command parsing tests * fix: correct function name in token cleanup calls for append operator tests * test: add heredoc test function and update cleanup calls for token validation * test: add parser tests and update Makefile and test utilities * feat: add syntax validation function for token list * Merge branch 'dev' into NaBuchholz/issue12 * fix: norm in syntax check and test files * refactor: rename quote processing functions for norm check
* refactor: Update argument structure to include quote type and modify command arguments * feat: Add argument and redirection utility functions * refactor: Update argument handling and add debugging utilities * refactor: Simplify command creation by removing argument count parameter --------- Co-authored-by: Nathalia Vitoria Buchholz <nbuchhol@c1r5p3.42sp.org.br>
* test: Add redirection tests for output, input, append, and multiple redirects * refactor: Update redirection parsing functions and add test for redirections * feat: Add debugging functions for command and redirection lists * feat: Add debugging for command parsing and update file headers * fix: norm
…ocess.c | modified parser.h
) * feat: Implement pipeline parsing in parser and update related functions * fix: norm * feat: Add executor header and utility functions for command execution * feat: Update Makefile and minishell.h, add syntax and command error handling functions * feat: Refactor syntax validation and implement command execution in executor * feat: Add token_type_to_symbol function for better error reporting in syntax validation * Merge branch 'dev' into NaBuchholz/issue19
…ore to exclude .vscode directory
* feat: Implement signal handling and environment initialization in shell loop * fix: Norm
* WIP: Implement heredoc functionality in the shell * feat: Add heredoc signal handling and related tests * fix: Improve exit command detection in utils and update file headers
* fix: remove bypass exit to built in exit cmd * refactor: remove unused cleanup and history source files * refactor: remove unused functions * fix: add 'cd' command handling in builtins dispatcher
There was a problem hiding this comment.
Pull Request Overview
This PR completes the first version of the minishell by adding error-reporting utilities, comprehensive testing, and refining core components.
- Introduce
syntax_errorandcommand_errorfunctions inutils.cfor uniform error messages. - Add an extensive test suite covering tokenization, lexing, parsing, redirections, heredoc, environment management, and memory handling.
- Update signal handling, main loop, and pipeline execution, but a debug print remains in production code.
Reviewed Changes
Copilot reviewed 98 out of 103 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/utils.c | Added syntax_error and command_error functions |
| src/tests/ | Added dozens of new test files for tokens, lexer, parser, heredoc, environment, and memory |
| src/executor/pipeline_utils.c | Leftover debug printf in create_pipes |
| src/parser/syntax_check.c | Production code includes test_utils.h unnecessarily |
Comments suppressed due to low confidence (2)
src/tests/test_token_utils.c:27
- [nitpick] The function returns "TOKEN_HEREDOC" while other token names omit the
TOKEN_prefix (e.g., "WORD"). Consider returning a consistent string like "HEREDOC."
else if (type == TOKEN_HEREDOC)
src/parser/syntax_check.c:14
- The production parser code includes
test_utils.h, which is only needed for tests. Remove this unnecessary include.
#include "test_utils.h"
| } | ||
| printf("🔧 PIPE: Criado pipe[%d] = {%d, %d}\n", | ||
| i, (*pipes)[i * 2], (*pipes)[i * 2 + 1]); |
There was a problem hiding this comment.
This debug printf outputs Portuguese text and emojis in production code. Consider removing it or guarding it under a debug flag.
| } | |
| printf("🔧 PIPE: Criado pipe[%d] = {%d, %d}\n", | |
| i, (*pipes)[i * 2], (*pipes)[i * 2 + 1]); | |
| } | |
| #ifdef DEBUG | |
| printf("🔧 PIPE: Criado pipe[%d] = {%d, %d}\n", | |
| i, (*pipes)[i * 2], (*pipes)[i * 2 + 1]); | |
| #endif |
| tokens = tokenize_input(">>"); | ||
| debug_token_list(tokens); | ||
| if (!tokens || tokens->type != TOKEN_REDIR_APPEND) | ||
| return (cleanup_and_return(tokens, "ExpecTOKEN_REDIR_APPEND", 1, NULL)); |
There was a problem hiding this comment.
The error message has a typo and missing space: "ExpecTOKEN_REDIR_APPEND" should be "Expect TOKEN_REDIR_APPEND".
| return (cleanup_and_return(tokens, "ExpecTOKEN_REDIR_APPEND", 1, NULL)); | |
| return (cleanup_and_return(tokens, "Expect TOKEN_REDIR_APPEND", 1, NULL)); |
| if (expected && token->value | ||
| && ft_strncmp(token->value, expected, ft_strlen(expected)) != 0) | ||
| { | ||
| printf("❌ ASSERT FAIL:Expec '%s', got '%s'\n", expected, token->value); |
There was a problem hiding this comment.
Missing space after colon and typo: "ASSERT FAIL:Expec" should be "ASSERT FAIL: Expect".
| printf("❌ ASSERT FAIL:Expec '%s', got '%s'\n", expected, token->value); | |
| printf("❌ ASSERT FAIL: Expect '%s', got '%s'\n", expected, token->value); |
No description provided.