spicy
spicy copied to clipboard
Allow &synchronized with static length fields and not just literals
Some protocols have static length fields before the literal where we might use the &synchronize attribute but currently spicy only allows literals before the literal where &synchronize is used.
Here is a toy parser that should illustrate what I would like to be able to do...
module test;
public type PDUs = unit {
: (PDU &synchronize)[];
};
type PDU = unit {
len: uint8;
sub: subPDU &size=self.len;
};
type subPDU = unit {
typ: /this|that/ &synchronize;
switch (self.typ) {
/this/ -> eight: uint8;
/that/ -> thirty_two: uint32;
* -> : bytes &eod;
};
};
This currently give this error....
[error] ../test13.spicy:9:10-9:14: &synchronize cannot be used on field, look-ahead contains non-literals
[error] spicyc: aborting after errors