Skip to content

How restore filter from UriQueryExpressionParser to string? #1105

Answered by aboryczko
P9avel asked this question in General
Discussion options

You must be logged in to vote

What do you want to achieve? UriQueryExpressionParser will return a tree of tokens (Abstract Syntax Tree). You would need to visit the nodes in order to process it. The result of your ParseFilter would look something like this:

flowchart TD
    bo[BinaryOperatorToken Equals]-->ep;
    bo-->lt[LiteralToken London];
    ep[EndPathToken name]-->ip[InnerPathToken city];
Loading

You could implement the ISyntacticTreeVisitor interface to visit the different nodes and change it into a string. In the library I've seen that they use Binders to change QueryTokens to QueryNodes and there is a NodeToStringBuilder that builds the query string from the tree.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by P9avel
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants