Repository navigation
Make codegen unstable pub - #672
Conversation
|
Besides a more exhaustive check of the errors, this probably also needs a read through the rustdoc output. At a first glance, a lot of the codegen docs are in fact missing. |
|
So I think that is a initial pass over everything, I'll probably leave it draft for a day or two and mull over whether or not I might have forgotten anything and if nothing comes up mark it ready for review. |
|
One thing I haven't fully thought through: because this exposes a lot of previously-internal APIs, I wonder if we might want to document this API as being partly unstable? Some parts seem rock solid to me, and others I haven't really thought about if I'm honest! It might be that the whole kaboodle is good as-is: I'm happy to hear your thoughts! |
|
I don't really have a problem doing that, I recall we actually have features for that. It would mean that nimbleparse has to enable that feature, which seems fine (since it is a binary). My feeling would be that it would be good to make a stabilization issue, and put it in a comment, I think the place i'm least happy with the API is around the error handling, |
|
I think it might require some acrobatics to continue using the API from lrpar/lrlex without enabling the Is that the kind of thing you were thinking about, or something more informal? |
I haven't thought it through very carefully! FWIW I don't have a problem with the grmtools crates using an unstable API between themselves while we wait to see how it goes. If you think that might be a good compromise, it would work for me, but you're deeper into the details here than I am! |
|
I'll do some playing around with using the |
|
Thanks! |
|
I think this one is squashable and mergeable? |
73250e2 to
1a5a362
Compare
|
Besides that one little bit of accidental code that needed to be removed, I had to With that I squashed it down into a few sensible commits, and marked it ready for review. |
|
I guess, I did want to ask, let me just quote your previous message
I'm curious which parts you've thought less about vs the parts you thought seemed rock solid. I guess my list of things that give me some hesitation with this api is mostly just the error types.
The second is that the error cannot be checked until you've produced the AST, but by that point you can waltz off with the AST into the sunset. I'm not super worried about this second, as this probably is never going to be a commonly used end-user API. So it seems like enough to know you should call |
I guess the only way to solve this would be to rethink the API a bit. IIRC the problem in a sense is that |
Yep, exactly like what I think one way we might approach fixing it is that we remove the ability to get an So that might ensure that these errors are checked before people can run off with the ast. |
|
I played around with the above, and did get it working, besides moving the |
|
I went ahead and pushed that as 0fea24b so you could take a look. |
|
I think this is ready for squashing? |
This marks `Value`, `HeaderError`, and `HeaderErrorKind` in the header module as unstable API.
|
I agree, squashed. The diff comparison shows a small rustfmt change. |
This is a first attempt at my remaining todo list.
It tries to make codegen pub, and remove the usage of hidden API in nimbleparse.
It does so by usage of the codegen process and selectively unhiding some API we've worked towards making nicer over this development cycle (the
header::Valuestructure and header errors).The actual errors that are going to be emitted here will very likely need some work,
But I did do a basic smoke test run of nimbleparse with some erroneous input.
The usage of codegen might seem weird, nimbleparse doesn't actually generating any code...
We kind of use it as a "PreBuilder" for RTParserBuilder which does a couple of things
%grmtools{yacckind: ...}by parsing the%grmtoolssection.As an example of step 3, we can add an invalid key to one of the examples
$ cargo run --bin nimbleparse -- ./lrpar/examples/calc_parsetree/src/calc.{l,y}I had hoped to before making this stuff
pub, get a version of nimbleparse_lsp ready to test with.But that was before I had noticed the hidden API usage in nimbleparse. In this regard, there isn't
much that could go wrong in nimbleparse_lsp that wouldn't also run afoul of nimbleparse itself.
I would say that the
codegenerror handling is not totally pretty here.I should probably go through
CTParserBuilderand double check it's error handling,to see if I missed any nicer mechanisms. Despite that, it does seem to come out as a net negative lines of code (prior to adding documentation) 👏