In the game mod project I am working on I have to work with several string statements such as this:
RequiredSubSystems = "Research | AdvancedResearch & CapShipProduction"
The player must meet the listed requirements before being able to build a space ship, taking into account the logical operators. The logical statements are read from left to right.
However, using a Python script I want to remove one or more of the requirements so that they are more lax. How do I parse and edit the strings to omit the requirements?
I think all I need to do is remove the relevant keyword as well as the logical operator to the left of it using some string operation, except when the keyword is on the far left of the string in which case I need to remove the operator directly to the right of it. I have not confirmed yet whether parentheses are ever used to group logical statements together. [Ed. a single required item may also be listed, in which case no operator would be used.]
Am I approaching the problem correctly or did I overlook something?