Skip to content

fix: do not return EOF from Err#175

Merged
ianlewis merged 1 commit intomainfrom
170-bug-customlexer-returns-eof-from-err
Jan 25, 2026
Merged

fix: do not return EOF from Err#175
ianlewis merged 1 commit intomainfrom
170-bug-customlexer-returns-eof-from-err

Conversation

@ianlewis
Copy link
Copy Markdown
Owner

@ianlewis ianlewis commented Jan 25, 2026

Description:

Do not return io.EOF from CustomLexer.Err. Err should only return unexpected errors.

Related Issues:

Fixes #170

Checklist:

  • Review the CONTRIBUTING.md documentation.
  • Add a reference to a related issue in the repository.
  • Add a description of the changes proposed in the pull request.
  • Add unit tests if applicable.
  • Update documentation if applicable.
  • Add a note in the CHANGELOG.md if applicable.

Signed-off-by: Ian Lewis <ian@ianlewis.org>
@ianlewis ianlewis linked an issue Jan 25, 2026 that may be closed by this pull request
@ianlewis ianlewis requested a review from Copilot January 25, 2026 02:33
Copy link
Copy Markdown

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 fixes the CustomLexer.Err() method to correctly return nil at EOF instead of io.EOF. The change aligns with the expected behavior that Err() should only return unexpected errors, not the normal end-of-file condition.

Changes:

  • Removed the assignment of io.EOF to l.err when reaching end of input
  • Updated test to expect nil instead of io.EOF from Err()
  • Added documentation comment for the newToken method

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
custom.go Removed io.EOF assignment when reaching end of input and added documentation for newToken method
custom_test.go Updated test expectation to verify Err() returns nil at EOF

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ianlewis ianlewis merged commit 9a05b79 into main Jan 25, 2026
24 checks passed
@ianlewis ianlewis deleted the 170-bug-customlexer-returns-eof-from-err branch January 25, 2026 02:41
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.

[bug] CustomLexer returns EOF from Err()

2 participants