just one of tests, but the code moved inside a proc()
import binarylang
proc main() =
struct(aux):
8: x
struct(parser):
*aux: x(3)
8: y
var fbs = newFileBitStream("data/substreams.hex")
defer: close(fbs)
let data = parser.get(fbs)
assert data.x.x == 0x12
assert data.y == 0x78
# Serialization
var sbs = newStringBitStream()
defer: close(sbs)
parser.put(sbs, data)
sbs.seek(0)
let reparsed = parser.get(sbs)
assert data.x.x == reparsed.x.x
assert data.y == reparsed.y
main()
/.nimble/pkgs/binarylang-0.5.1/binarylang.nim:1317:222: error: request for member ‘ClE_0’ in something not a structure or union
1317 | result.add(quote do:
| ^
.nimble/pkgs/binarylang-0.5.1/binarylang.nim:1317:255: error: request for member ‘ClP_0’ in something not a structure or union
1317 | result.add(quote do:
| .nimble/pkgs/binarylang-0.5.1/binarylang.nim:1317:422: error: request for member ‘ClE_0’ in something not a structure or union
1317 | result.add(quote do:
binarylang from nimble, 0.5.1, nim 1.6.6
Not sure if it's a nim bug or binarylang, or both.
BinaryLang codegen includes type definitions, which are disallowed in Nim in some cases. BinaryLang definitions should always be written at top-level. This should be documented in the manual. Thanks for reporting.
just one of tests, but the code moved inside a proc()
binarylang from nimble, 0.5.1, nim 1.6.6 Not sure if it's a nim bug or binarylang, or both.