200sc / bebop

bebop wire format in Go
Apache License 2.0
69 stars 5 forks source link

Nested arrays result in "expected (Ident) got Open Square" #31

Closed merlindru closed 1 year ago

merlindru commented 1 year ago

This might be a little tough to solve/the generated code could change a lot if an infinite amount of nesting is allowed.

The TypeScript version of bebop-tools compiles byte[][][] in my .bop to Array<Array<Uint8Array>>.

And thank you for maintaining this lib!! 😄

200sc commented 1 year ago

@merlindru Thanks for the report!

It's obviously a lot worse for readability but I've written a short test demonstrating that the other way of formatting arrays, array[subtype] does support nesting, e.g. array[array[array[byte]]] bytes;; this could be used as a workaround for now, although it should be a fairly quick thing to fix.

200sc commented 1 year ago

Correction; that will enable parsing to succeed but there's a code generation bug that needs to be addressed yet.