-
Hi, sorry for starting another discussion so quickly but I've got an important question! My previous question was about parsing a line until the end. This is an important feature of the file format I'm trying to read: one line = one "declaration". It's a format for rhythm game charts (BMS). It goes something like this:
The first two lines in this example are for metadata. What's hard about this:Callbacks and sinks are cool but I've got little idea how to translate that to my model. It looks like this (simplified):
As you can see, I've got a relatively deep structure here. My current idea is to create a custom sink class with a ton of overloads with some tag type so that I can distinguish the data that comes in from every single line, one by one. State management would be very manual. My question is, is this the right approach? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I don't fully understand your grammar to give a concrete solution, but the general advice is as follows: if you're having nested structures, parse it with nested productions. In your example, you have a |
Beta Was this translation helpful? Give feedback.
-
In the end, I did it with a custom sink and it seems to work fine. I used a lot of strong typedefs to distinguish between strings and I made one overload for tuple<measure, channel, vector>. You can check it out here. Thanks a lot for help! |
Beta Was this translation helpful? Give feedback.
In the end, I did it with a custom sink and it seems to work fine.
I used a lot of strong typedefs to distinguish between strings and I made one overload for tuple<measure, channel, vector>.
You can check it out here.
Thanks a lot for help!