-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better scanner positioning #7
Merged
Merged
Conversation
This file contains 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
Significant changes include: - Introduced a new 'exports.go' file to handle token creation - Refactored the Scanner struct in 'scanner.go' to include a file object and an offset - Added a Pos() method to return the position of the current token in the file - Created a newFile function for adding files to the FileSet
The token scanning logic has been improved to handle spaces as separate tokens. This change affects both the main scanner function and its associated tests. The handling of other special characters remains unchanged.
The scanner tests have been refactored to adjust the expected token positions. The changes include updating the position values in the "Starting token" and "Consume first token" test cases. Additionally, a new test case for 'identifier' has been added. The check for consuming only one token has also been removed from these tests.
Expanded the set of characters that are not allowed in identifiers to include whitespace. This change ensures that identifiers cannot contain spaces, improving parsing accuracy. Corresponding unit tests have also been updated to reflect this change.
A new function `skipWhitespace` has been added to the scanner which skips over any whitespace characters. This function is called before scanning for tokens, ensuring that leading whitespaces are ignored. Corresponding tests have also been updated to verify this behavior.
The constructors for the Parser and Scanner classes have been updated to include a file parameter. This change allows for more flexibility when creating instances of these classes, as they can now be associated with specific files right from their creation. The corresponding test cases have also been updated to reflect this change.
Significant changes include the removal of an unused file, exports.go, and a function from scanner.go. The scanner tests have been updated to reflect these changes. Additionally, new test cases have been added to track lines in the scanner_test.go file.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 95.59% 95.76% +0.17%
==========================================
Files 6 6
Lines 363 378 +15
==========================================
+ Hits 347 362 +15
Misses 12 12
Partials 4 4 ☔ View full report in Codecov by Sentry. |
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.
No description provided.