You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have reviewed the changes and it contains no misspelling.
The code is well commented, especially in the parts that contain more
complexity.
New and old tests passed locally.
Additional information
Reviewer's checklist
Copy and paste this template for your review's note:
## Reviewer's Checklist
- [ ] I managed to reproduce the problem locally from the `main` branch
- [ ] I managed to test the new changes locally
- [ ] I confirm that the issues mentioned were fixed/resolved .
NOTE: This is generated by an AI program, so some comments may not make sense.
.prettierrc.yaml
LGTM!
src/arx/lexer.py
Potential runtime bug: constructing the message assumes location has .line/.col. If location is None or a different object, raising LexerError will itself raise AttributeError and mask the original error. Use safe access with fallbacks. Replace the body as below (L.207):
def init(self, message: str, location: SourceLocation) -> None:
"""Initialize LexerError with an error message and optional source location."""
line = getattr(location, "line", "?")
col = getattr(location, "col", "?")
super().init(f"{message} at line {line}, col {col}")
self.location = location
To avoid forward-reference issues in some Python versions or when evaluating type hints at runtime, consider enabling postponed evaluation (L.1):
from future import annotations # """Enable postponed evaluation of annotations."""
NOTE: This is generated by an AI program, so some comments may not make sense.
src/arx/lexer.py
Correctness: The numeric branch will treat a standalone '.' (or the start of '..') as a number, which can either mis-tokenize punctuation or raise later when converting ".". Guard the branch with a digit lookahead so only "." enters numeric lexing. Example change (L.322):
if self.last_char.isdigit() or (self.last_char == "." and self.peek().isdigit()):
If you don’t have peek(), add:
def peek(self) -> str:
"""Peek next character without consuming it."""
return self.source[self.index] if self.index < len(self.source) else "\0"
Breaking behavior: Introducing LexerError changes the public contract of get_token/get_next_token. Ensure callers catch this or convert it to an error token to avoid crashing the pipeline.
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
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.
Pull Request description
How to test these changes
...Pull Request checklists
This PR is a:
About this PR:
Author's checklist:
complexity.
Additional information
Reviewer's checklist
Copy and paste this template for your review's note: