Page 1 of 1

Need help restructuring ShipPartsParser

Posted: Mon Oct 08, 2018 11:26 am
by Ophiuchus
I wanted to restructure the parsing of capacity/damage/shots because it helps me with the targetting feature and makes also sense.
The difference is between weapons (damage -> capacity, shots -> capacity2) and the hangar/other parts (capacity -> capacity, damage -> capacity2).

So it would make sense that the subparser creates a pair<optional<double>,optional<double>> which gets used from the outer parser. But actually i do not know how to do so.

here is what i managed until now: commit

Any hints how to proceed?

Re: Need help restructuring ShipPartsParser

Posted: Mon Oct 08, 2018 3:57 pm
by Dilvish
Your general idea of making this particular pair sub-parser sounds fine to me.

It's been a long while since I've done any serious work with the parsers, and I won't be able to do anything with this for at least a few more days, but if you don't get it sorted out in the meantime I'll try taking a look at it when I can.

For all these cases where you are running into trouble with the parser, keeping in mind the idea I think Geoff suggested that you might be running into complications from the overall complexity of the parsing rule you are trying, for things like your double values you could think of starting with just the simple double parser rather than the full blown flexible double parser, for example (if I am remembering the namings and their order of complexity correctly).