Import protocol code generator from xK, add tests

Also add a VIM syntax highlighting file.

This also fixes some previously untriggered bugs.
This commit is contained in:
2022-09-29 21:06:46 +02:00
parent 4c3837ae2c
commit ebbe7a1672
8 changed files with 1608 additions and 0 deletions

23
tests/lxdrgen.lxdr Normal file
View File

@@ -0,0 +1,23 @@
/*
* tests/lxdrgen.lxdr: a test protocol for the generator
*/
const VERSION = 1;
const NOISREV = -1;
// TODO: Test failure paths, and in general go for full coverage.
struct Struct {
union Union switch (enum Enum {
NUMBERS = VERSION,
OTHERS = 2,
NOTHING,
} tag) {
case NUMBERS:
i8 a; i16 b; i32 c; i64 d;
u8 e; u16 f; u32 g; u64 h;
case OTHERS:
bool foo;
string bar;
case NOTHING:
void;
} u<>;
};