Replies: 2 comments 1 reply
-
Right, the playground uses the I unfortunately do not have any other resources besides the documentation.
Yes,
Can you post the error messages you got? Unless you're using MSVC, it should have told you the relevant information.
Good catch, I will update it to use this example: https://godbolt.org/z/MdK77ErqM |
Beta Was this translation helpful? Give feedback.
-
|
For what I was trying to do, I think I was approaching it the wrong way. I was wanting to do my own parsing of a more complicated thing (multiple tokens with different possibilities). I changed my approach, breaking the possibilities down into distinct sub-productions and then using "or" alternatives ( @foonathan Thanks again for the tips, reading your answers and then struggling a bit more convinced me to try a different approach, which worked. I still don't know how to do what I had originally intended, where I wanted to parse a set of multiple tokens/values with dsl::positions before/after the whole set, and I wanted the text between these "positions" as text (std::string_view or std::string) in a callback, where I could output whatever resulting value I wanted. But this is not important (to me) right now, just a curiosity if this was even possible. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I'm having a hard time wrapping my mind around more complex productions with lexy. In some cases, I want to do things like specify a complex rule and do the parsing myself, using a callback (and knowing where various things occurred in parsing, using
dsl::position.Besides the website documentation (which is great) -- are there any other recommended resources on how to work one's way up in expertise with lexy? I've gone through the docs, and tried many examples, but I find the playground lacking because it only seems to handle the parsing part (
rule) and not thevaluepart, which is where I seem to struggle most.I guess what I'm asking for specifically would be an example of using
dsl::position(possibly more than once in a rule) and a return values, using a custom callback that takes those positions as arguments (along with other parsed things, like ints or strings). Does one just usechar const*to take parsed position arguments? Or lexemes, orinput_location? I've not managed to make an example that compiles... And an example fordsl::positionlike this one from the Reference doesn't include avaluedefinition.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions