princemaple / abnf_parsec

ABNF in, parser out

Home Page:https://hexdocs.pm/abnf_parsec/AbnfParsec.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Case study: SCIM query

rmoorman opened this issue · comments

Hello,

I would like to use this library to generate parsers based on the the ABNF definitions for the SCIM (System for Cross-domain Identity Management) Protocol.
While I was trying to collect the ABNF definitions and use the library as described in the README file, I found that given that ABNF, a few example inputs yield no results.
Some inputs lead to only a part of the input to be parsed, while others seem to lead to a timeout when running the parser.

There is a small example repository that I created including the ABNF, the parser code, and some tests, and hope that it can demonstrate the problem as well as help a little while solving it.

There are two parser files within it's lib directory, a "path" and a "filter" parser.
What paths and filters do look like (hopefully truthfully according to the SCIM spec) is defined within priv/scim.abnf.
And then there are the tests in test/scim_parsers_test.exs. There is one test for each parser looping through a collection of matching collected examples. The examples are currently partially commented out starting from where the parser fails to parse the input. And as mentioned there are two kinds of failures some examples lead to: unparsed rest and timeouts

I don't really have a good idea where I would have to start in order to try solving this issue myself currently (or if the ABNF is wrong or indeed the generated parser code) so I hope that filing this issue can shed light on this and help solve a problem in the code (if any).

Best regards,
Rico Moorman

I'll take a look 🙂

@rmoorman I've sent a PR. The cause is complicated. It's a mixture of bad ABNF and limitations of auto generated parser.

rmoorman/2022-abnf-parsec-scim-filter-issue#1

Can I pin this issue as a case study for other users to learn?

@princemaple , thank you for taking the time to have a look and making it work! I merged the PR, and regarding pinning the issue the more material to learn from the better 👍🏻
Keep up the good work!