benjamin-hodgson/Pidgin

Expression handling examples/documentation

martinkoslof opened this issue · 1 comments

Hello there,

I stumbled into Pidgin and I'm liking what I see so far. However, I'm trying to wrap my head around the expression support and I'm having a hard time finishing up my parsing efforts. I am trying to create an API query language (for sorting and filtering) and while sorting wasn't too hard, I'm running into some confusion on how to do the filtering. More or less I just want to support -> eq, neq, lt, lte, gt, gte, startswith, endswith and contains. I also need to support and/or statements.

I started here: #134 and while this looked promising, it was difficult to follow and its not clear how the AndExpression, OrExpression could be created and also, how to more or less use Map or some form of combining parsers to support all scenarios above, for example: filter=Field1 eq '12345' and Field2 lt 50 and contains(Field3, 'A String') or Field10 neq 'Hello'

Are there any examples of this? I don't need much, just a shove in the right direction, shell code or a link would surely be enough.

I also looked at the examples here, https://github.com/benjamin-hodgson/Pidgin/tree/main/Pidgin.Examples/Expression, but it wasn't clear how to handle the operators and also And/Or chaining.

I wound up going a different direction and using a different parser combinator library. Closing this.