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

Bleaphar/comment node investigation #3492

Merged
merged 6 commits into from
Mar 23, 2024

Conversation

bleaphar
Copy link
Contributor

This pr treats text that is on the same line as a request separator as a part of the node and consumes those tokens into the request separator. Also, it creates an early out for the parsing of url nodes in the event that we parse an embedded expression that is the entirety of the url node. Lastly, added a test based on several requests with request separator nodes and embedded expressions.


{name=value}
"""
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it may be better to create a more targeted test for the scenario being fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Namely less requests and intricacies?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, a tight test that tests exactly the single case that was not working before and that is fixed now.

@@ -462,6 +474,11 @@ private void ConsumeCurrentTokenInto(HttpSyntaxNode node)
}
}

if (!((CurrentToken?.Kind is HttpTokenKind.Word or HttpTokenKind.Punctuation) || (IsAtStartOfEmbeddedExpression())))
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this another bug in the url parsing? Could you please add a separate test for this?

"""
);

var requestNodes = result.SyntaxTree.RootNode.ChildNodes
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious about how this is parsed. Is a child comment node added to the request separator node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's parsed as tokens into the http request separator node


result.GetDiagnostics().Should().BeEmpty();

result.SyntaxTree.RootNode.ChildNodes.Count().Should().Be(2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make a more specific assertion here?

@jonsequitur jonsequitur merged commit b5c58fd into dotnet:main Mar 23, 2024
4 checks passed
@bleaphar bleaphar deleted the bleaphar/CommentNodeInvestigation branch July 29, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants