Skip to content

Refactor Refinements Parser#167

Merged
rcosta358 merged 7 commits intomainfrom
improve-parser
Mar 5, 2026
Merged

Refactor Refinements Parser#167
rcosta358 merged 7 commits intomainfrom
improve-parser

Conversation

@rcosta358
Copy link
Collaborator

@rcosta358 rcosta358 commented Mar 2, 2026

This PR refactors the logic of the refinements parser to avoid repetition and improve readability.

Based on improve-syntax-errors. After #166 is merged, the target branch should be changed to main.

@rcosta358 rcosta358 self-assigned this Mar 2, 2026
@rcosta358 rcosta358 requested a review from CatarinaGamboa March 2, 2026 13:43
@rcosta358 rcosta358 changed the title Improve Parser Refactor Refinements Parser Mar 2, 2026
Copy link
Collaborator

@CatarinaGamboa CatarinaGamboa left a comment

Choose a reason for hiding this comment

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

great! with minor comment

int b = pred.stop.getStopIndex();
Interval interval = new Interval(a, b);
return input.getText(interval);
return pred.start.getInputStream().getText(interval);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we worry about nulls here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so, because this method is only called after a match with AliasContext, so both pred.start and getInputStream() are non-null.

@rcosta358 rcosta358 changed the base branch from improve-syntax-errors to main March 5, 2026 11:36
@rcosta358 rcosta358 merged commit 5430ba1 into main Mar 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants