Skip to content

Conversation

@TTOzzi
Copy link
Member

@TTOzzi TTOzzi commented Aug 28, 2023

Resolve #2107

While it's not a problem if different kinds of tokens that can be distinguished by their kinds appear consecutively without whitespace; however, if tokens of the same kind are positioned without a delimiter, there arises an issue when converting syntaxTextBytes into a SyntaxNode.

When two indistinguishable(of the same kind) tokens are positioned consecutively without whitespace or punctuation, I have added whitespace for differentiation.

@TTOzzi TTOzzi requested a review from ahoppen as a code owner August 28, 2023 16:16
@TTOzzi TTOzzi force-pushed the fix-syntax-text-bytes branch 2 times, most recently from f54f613 to d66cdc5 Compare August 28, 2023 17:54
@TTOzzi TTOzzi force-pushed the fix-syntax-text-bytes branch from d66cdc5 to e707e00 Compare August 28, 2023 18:00
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

This is not correct because it breaks round-tripness of the syntax tree. If you generate source code, parse it and print the syntax tree, it must exactly correspond to the original source tree.

With this change a space that wasn’t present in the original source is added during the printing, which breaks this property.

As I commented in #2107, I think the fix for that issue is a lot more involved.

@TTOzzi
Copy link
Member Author

TTOzzi commented Aug 29, 2023

From the comments you left on the issue, I understand that it's much more difficult than I realized to fix the issue without modifications to the original source.
Thanks for the feedback! I'll close this PR 🙇

@TTOzzi TTOzzi closed this Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants