Refactor: Review project, fix bugs, and improve parser functionality.#1
Open
Refactor: Review project, fix bugs, and improve parser functionality.#1
Conversation
This commit addresses several issues found during a project review:
- Corrected a typo in README.md ("Paser" to "Parser").
- Integrated the Parser into `main.cpp`, so it now processes input files and can dump the AST.
- Fixed `Lexer::line_start_idx` logic for more robust line number tracking, especially for empty files or files without trailing newlines.
- Refined `SourceFile::fill_the_buffer()` to use `std::filesystem::path` consistently.
- Significantly enhanced parser error reporting:
- Errors now show file, line, column, the problematic token, and the line of code with a marker.
- `Parser::ReportError` method added for centralized error handling.
- Removed a duplicated line in the "Known limitations" section of README.md.
- Added a basic parser test (`ParserTest.HandlesSimpleFunction`):
- Includes a new sample file `test/sample_parser_0.AL`.
- Verifies that a simple function declaration is parsed correctly without errors.
- Updated CMakeLists.txt to include the new parser test and ensure proper linking.
These changes provide a better understanding of the project's current state, fix several small bugs, and lay a better foundation for future development by improving the parser's utility and test coverage.
Owner
Author
|
As expected it didn't even build 🙂 |
Owner
Author
|
On having time, I would review it and see what Jules is trying to do. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I created this while experimenting Google's Jules and I couldn't review it there as there were no changes highlighting.
This commit addresses several issues found during a project review:
main.cpp, so it now processes input files and can dump the AST.Lexer::line_start_idxlogic for more robust line number tracking, especially for empty files or files without trailing newlines.SourceFile::fill_the_buffer()to usestd::filesystem::pathconsistently.Parser::ReportErrormethod added for centralized error handling.ParserTest.HandlesSimpleFunction):test/sample_parser_0.AL.These changes provide a better understanding of the project's current state, fix several small bugs, and lay a better foundation for future development by improving the parser's utility and test coverage.