Skip to content

feat: v1 finished#84

Merged
NaBuchholz merged 77 commits intomainfrom
dev
Jul 13, 2025
Merged

feat: v1 finished#84
NaBuchholz merged 77 commits intomainfrom
dev

Conversation

@NaBuchholz
Copy link
Owner

No description provided.

NaBuchholz and others added 30 commits May 30, 2025 21:14
* 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
)

* 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
Vinicius Da Silva Lima and others added 23 commits July 6, 2025 17:35
* test: Add pipeline parsing tests and update related files

* feat: Implement pipeline execution and related utilities

* fix: apply the norm

closes #35
closes #36
* 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
@NaBuchholz NaBuchholz added this to the Entrega milestone Jul 13, 2025
@NaBuchholz NaBuchholz self-assigned this Jul 13, 2025
Copilot AI review requested due to automatic review settings July 13, 2025 18:14
@NaBuchholz NaBuchholz merged commit c441322 into main Jul 13, 2025
2 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_error and command_error functions in utils.c for 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"

Comment on lines +45 to +47
}
printf("🔧 PIPE: Criado pipe[%d] = {%d, %d}\n",
i, (*pipes)[i * 2], (*pipes)[i * 2 + 1]);
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This debug printf outputs Portuguese text and emojis in production code. Consider removing it or guarding it under a debug flag.

Suggested change
}
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

Copilot uses AI. Check for mistakes.
tokens = tokenize_input(">>");
debug_token_list(tokens);
if (!tokens || tokens->type != TOKEN_REDIR_APPEND)
return (cleanup_and_return(tokens, "ExpecTOKEN_REDIR_APPEND", 1, NULL));
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message has a typo and missing space: "ExpecTOKEN_REDIR_APPEND" should be "Expect TOKEN_REDIR_APPEND".

Suggested change
return (cleanup_and_return(tokens, "ExpecTOKEN_REDIR_APPEND", 1, NULL));
return (cleanup_and_return(tokens, "Expect TOKEN_REDIR_APPEND", 1, NULL));

Copilot uses AI. Check for mistakes.
if (expected && token->value
&& ft_strncmp(token->value, expected, ft_strlen(expected)) != 0)
{
printf("❌ ASSERT FAIL:Expec '%s', got '%s'\n", expected, token->value);
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after colon and typo: "ASSERT FAIL:Expec" should be "ASSERT FAIL: Expect".

Suggested change
printf("❌ ASSERT FAIL:Expec '%s', got '%s'\n", expected, token->value);
printf("❌ ASSERT FAIL: Expect '%s', got '%s'\n", expected, token->value);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants