From 2e35bb9a19c0711162e650f3723e2dbe061051ee Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Fri, 10 Nov 2023 12:55:23 +0100 Subject: compiler: support flags as int first argument This commit adds support for the following syntax: int_flags = 1, 5, 8, 9 int32[int_flags] which is equivalent to: int_flags = 1, 5, 8, 9 flags[int_flags, int32] The second int type argument, align, is not allowed if the first argument is a flag. The compiler will also error if the first argument appears to be a flag (is ident and has no colon), but can't be found in the map of flags. Signed-off-by: Paul Chaignon --- prog/encoding_test.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'prog/encoding_test.go') diff --git a/prog/encoding_test.go b/prog/encoding_test.go index 677375d7f..032ba2e42 100644 --- a/prog/encoding_test.go +++ b/prog/encoding_test.go @@ -272,6 +272,10 @@ func TestDeserialize(t *testing.T) { In: `test$auto0(AUTO, &AUTO=AUTO, AUTO, 0x0)`, Err: `wrong type *prog.IntType for AUTO`, }, + { + In: `test$bf2(&AUTO={AUTO, 0x10, 0x0})`, + Out: `test$bf2(&(0x7f0000000040)={0x8, 0x10, 0x0})`, + }, { In: `test$str0(&AUTO="303100090a0d7022273a")`, Out: `test$str0(&(0x7f0000000040)='01\x00\t\n\rp\"\':')`, -- cgit mrf-deployment