raydac/java-binary-block-parser

Issue with simple object parse

earce opened this issue · 2 comments

earce commented

Hi,

I am getting the following error:

Detected atomic field definition without type

When running the following:

final JBBPParser marketParser = JBBPParser.prepare(
                "byte[5] blob5; "
                + "accountFlags {"
                + " byte[32] address; "
                + "}; "
                + "byte[7] blob7;"
);

I suspect it has to do with the fact that I am passing 32 into the byte array for address. The example:

final JBBPParser pngParser = JBBPParser.prepare(
              "long header;"
              + "chunk [_]{"
              + "   int length; "
              + "   int type; "
              + "   byte[length] data; "
              + "   int crc;"
              + "}"
      );

shows you passing the length which is calculated as the message is read dynamically. Is there a way to statically set this to 32?

Hello
you just have syntax error in structure definition, it must not have ; after }

earce commented

Thanks!