Basic implementation of recursive parsers macro#902
Conversation
* Make nested_in more flexible * Semver break
|
After having played around with this version a bit, it has the same benefit that the (improved) Neat solution :) Out of curiosity, what is your opinion on removing |
|
I'm glad you like it, your
Hmm, what do you mean by this? My editor doesn't have LSP support, so I don't really understand. My plan is to add some way to include a type hint (like
Very much in favour. I've been of the view for a while that they're a stop-gap, and one that's easy to accidentally misuse. I think deprecation is fine for the time being (leaks aren't ideal, but they're not really an actual problem for the most-part), at least until a 1.0 release finally comes around. |
Ah. I would not survive programming Rust without my LSP, props to you. So, I mean: // With `recursive_n` you effectively have to forward declare the parsers
recursive_n(|(expr, statement)|
let expr = expr_atom(expr.clone(), , sta▍)
})
// With `parsers!` you are encouraged to finish the definition before moving to the next time
parsers! {
expr = expr_atom(expr.clone(), sta▍)
}For this example, we can treat ▍as the cursor position. At this point with I don't think it's really a big problem, but just something I noticed :) |
|
I'm currently implementing chumsky alongside an existing pom implementation. However, pom seems to have a straightforward solution to this which is 'call': https://docs.rs/pom/3.4.0/pom/parser/fn.call.html Again, if I've understood correctly, this solves issues at point of call rather than at point of definition. Is this a possible solution and/or addition in this instance? Just for reference - my pom grammar is here https://github.com/nigeleke/fluent4rs/blob/main/src/grammar.rs |
Unfortunately not in chumsky, for two reasons:
|
(The use of
Unpinis arbitrary, I just wanted some dyn-compatible trait that worked for non-'staticlifetimes)