Well, the tag layout thus far is really more like XML with different delimiters. For instance:
[ETHIC:ASSAULT:PUNISH_SERIOUS]
[ETHIC:MURDER:PUNISH_CAPITAL]
vs.
<Ethic type="ASSAULT" value="PUNISH_SERIOUS"></Ethic>
<Ethic type="MURDER" value="PUNISH_CAPITAL"><\Ethic>
I tend to treat XML as a good litmus test for describing structures, and honestly the way it is now is pretty close to how you would do it in XML. The other way would be:
<Ethics>
<Assault value="PUNISH_SERIOUS"></Assault>
<Murder value="PUNISH_CAPITAL"></Murder>
</Ethics>
Which in DF tags would be:
[ETHICS:
ASSAULT:PUNISH_SERIOUS:
MURDER:PUNISH_CAPITAL]
Which we already knew, but for the sake of clearer discussion. I personally favor the way it is now because of the ease of parsing and extensibility.
For instance, what if ethics are expanded to include optional tags? What if at some point this:
[ETHIC:ASSAULT:PUNISH_SERIOUS]
[ETHIC:LYING:PUNISH_SERIOUS:EQUITY]
[ETHIC:MURDER:PUNISH_CAPITAL]
(where "EQUITY" means that the punishment must roughly match the severity of the lie) becomes valid tag code? HOW do I write a parser for it if it could work like what you suggest:
[ETHICS:
ASSAULT:PUNISH_SERIOUS:
LYING:PUNISH_SERIOUS:EQUITY:
MURDER:PUNISH_CAPITAL]
It can be done, certainly, but it is more complicated and requires more loops and checks inside the parser to pull it off, and the code itself has to be more aware of the possible valid chains of tags. I have to know that any ethic can be followed by an optional modifier and what those modifiers are ahead of time, rather than sending tags off to some encapsulated parser that knows what to do with a list of tokens. In short, the parser has to have parts of the interpreter in it, it has to know more about the structure of the tokens than just where they start and end. That makes hard to maintain and more bug prone code. It also increases load times and the like.
Much of the difficulty stems from the sorta odd way DF tags handle the start and end of blocks of things. You can't put tags inside other tags and, unlike XML, there is no way to signal the end of a block except with an end of the file or the beginning of another block. For instance, this:
[ETHICS:START]
[ASSAULT:PUNISH_SERIOUS]
[LYING:PUNISH_SERIOUS:EQUITY]
[MURDER:PUNISH_CAPITAL]
[ETHICS:END]
would do what you'd like, allow the possibility of future optional tags with no headaches, and also make the parser easy to write and maintain. Its also much easier to follow.