-
Notifications
You must be signed in to change notification settings - Fork 25
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
Provide a simpler parser API #25
Comments
Re. traits vs. macros, big +1. Initially, I wanted to define a Leaving aside the trait vs. macro problem, what you propose above is actually very close to the current API, expect that what you call That being said, I agree that this subtle semantic distinctions may bring more confusion than clarity. So we might as well bite the bullet and use the name everyone expects. To sum it up: my plan is to replace the current |
The discussions about #8 may have impact on this issue. We actually have two options:
The second option is more light-weight, but then we lose the ability to uniformly get the location of the error. This could be mitigated by requiring I think I like option 2 + |
Maybe have a look at the Can't provide further material as I'm on mobile |
Commit 9af95c5 is an attempt to address this issue. @MattesWhite , let me know if you are satisfied with it, and if so, feel free to close this issue. Note that parsers are almost rid of the global error types; only the RDF/XML parser still depends on it, because changing that would involve a substantial refactoring... |
Nice work this should satisfy the most use cases. The only thing that bothers me is the An alternative to removing |
They all provide it, so it is reasonable to require this from any parser (and anyway, They all provide it in their own way, so there is some value in unifying that with a unique trait (see more below).
I could not disagree more. Take for example any good text editor or IDE: they use this information to provide highlighting and navigation. Ok, they are usually parsing textual representations to extract the location information, but if they could get it more directly, why prevent them to do so? So sorry, but I still vote to keep |
Okay, I missed that use-case. It is okay for me to keep To sum up, the design of the new |
Thanks :) |
This issue contributes to #23
For me the parser API of
sophia
is a bit confusing with its macros andConfig
.I suggest the introduction of a
Parser
-trait:For
Quad
s a similar trait respectivelyParser
s to store state so they can lazily parse.TripleSource
An implementation for the N-Triples parser, e.g.:
The text was updated successfully, but these errors were encountered: