Skip to content
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

Create EOF token with empty data #591

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

allancalix
Copy link
Contributor

tl;dr Make consuming the token stream's data produce an identical string to the original input of the lexer.

I was working on a streaming processor using the streaming lexer and noticed that the Token::Eof has "EOF" as a string hard-coded as it's data. This doesn't appear to be used anywhere (though is maybe a breaking change?) and the tests still pass without this.

The formatter for Debug prefixes the location with EOF so the debugging output is not effected. The practical effect of this is that consuming a token stream's data does not produce the same output as the original input.

- [email protected]
- [email protected] "query"
- [email protected] " "
- [email protected]
- [email protected] "__typename"
- ERROR@16..19 "EOF"
- ERROR@16..16 ""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what to make of this here, the OPERATION_DEFINITION is now showing the correct character span (the source is 16 characters long) but I don't know why this error message is empty.

Copy link
Member

Choose a reason for hiding this comment

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

It's an error token, not an error message, so IMO it's correct like this

Copy link
Member

@goto-bus-stop goto-bus-stop left a comment

Choose a reason for hiding this comment

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

I think this was used in the past but now isn't, so its a good bit of cleanup. thanks!

@goto-bus-stop goto-bus-stop merged commit 55014af into apollographql:main Jul 13, 2023
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