You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to make some rules which generate chunks in a certain file format (similar to the Amiga HUNK format), and I would like to be able to calculate sizes inside a rule.
Currently one can manually place labels around, like in this simple example:
#ruledef { item {data}, {size: u32} => size @ data}; This works, but needs to manually add the label and extra parameteritem "hello world", (item_end - $)item_end:
But this gets tiresome and the global name space of labels gets polluted. It would be much nicer if local labels could be used inside a rule, for example like this:
#ruledef { item {data} => { (.item_end - $)`32 @ data .item_end: }}; This does not currently work, would be nice to haveitem "hello world"
Alternatively, allowing “local” variables inside rules could also work for this use case. The same example, using local variables, could be as follows:
#ruledef { item {data} => { (item_end - $)`32 @ data item_end = $ }}; This almost works currently, the "item_end" variable is considered undefined.item "hello world"
The text was updated successfully, but these errors were encountered:
I am trying to make some rules which generate chunks in a certain file format (similar to the Amiga HUNK format), and I would like to be able to calculate sizes inside a rule.
Currently one can manually place labels around, like in this simple example:
But this gets tiresome and the global name space of labels gets polluted. It would be much nicer if local labels could be used inside a rule, for example like this:
Alternatively, allowing “local” variables inside rules could also work for this use case. The same example, using local variables, could be as follows:
The text was updated successfully, but these errors were encountered: