Open hakanai opened 6 years ago
A good idea, but would probably require some time to be implemented.
As a workaround I might propose splitting that complex logic into separate types, i.e. something like:
type:
switch-on: first_condition
cases:
0: first_0
1: first_1
# ...
types:
first_1:
seq:
- id: value
type:
switch-on: second_condition
cases:
0: first_1_second_0
1: first_1_second_1
# etc
A .ksy file I found for parsing apfs filesystems has a construct like this:
Though I do think that the expression they wrote was not the most compact option, it seems like it would be much neater if we could instead write:
I'm about to add an additional level of hierarchy to this decision tree, which is going to make it much messier than it is already.