Skip to content

Conversation

@tahina-pro
Copy link
Member

This PR allows adding a field at the end of a typedef struct definition to consume the remainder of the input:

typedef struct _test {
   UINT32 my_field;
   UINT8 remainder[:consume-all];
} test;

The remainder field uses the parse_all_bytes parser, which does not have the strong prefix property, so this field must be at the end of the struct.

Similarly, such a field makes its enclosing type test lose the strong prefix property, so the type itself must be used either at the end of a struct, or with a [:byte-size n], [:byte-size-single-element-array n] or [:byte-size-single-element-array-at-most n] container.

@tahina-pro tahina-pro added the 3d The 3d dependent data description language and frontend label Dec 1, 2023
@tahina-pro tahina-pro requested a review from nikswamy December 1, 2023 02:27
let tbool = mk_prim_t "Bool"
let tunit = mk_prim_t "unit"
let tuint8 = mk_prim_t "UINT8"
let tuint8be = mk_prim_t "UINT8BE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, this is relevant here: I see no reason to reject UINT8BE remainder[:consume-all]

@nikswamy
Copy link
Contributor

nikswamy commented Dec 1, 2023

Looks good to me, thanks! A bit surprised by UINT8BE ... but I guess it's good for uniformity.

@nikswamy nikswamy merged commit 6ce6d3a into master Dec 1, 2023
@tahina-pro tahina-pro deleted the _taramana_3d_consume_all branch December 1, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3d The 3d dependent data description language and frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants