kaitai-io / kaitai_struct

Kaitai Struct: declarative language to generate binary data parsers in C++ / C# / Go / Java / JavaScript / Lua / Nim / Perl / PHP / Python / Ruby
https://kaitai.io
4.04k stars 199 forks source link

Can't compare BitsType1(BigBitEndian) and Int1Type(true) #997

Open bersbersbers opened 2 years ago

bersbersbers commented 2 years ago

Related: https://github.com/kaitai-io/kaitai_struct/issues/118

meta:
  id: switch_b1
seq:
  - id: bit1
    type: b1
  - id: next
    type:
      switch-on: bit1
      cases:
        0: b1
        1: b1

switch_b1: /seq/1/type/cases/IntNum(0): error: can't compare BitsType1(BigBitEndian) and Int1Type(true)

bersbersbers commented 2 years ago

This works:

meta:
  id: switch_b1
seq:
  - id: bit1
    type: b1
  - id: next
    type:
      switch-on: bit1
      cases:
        false: b1
        true: b1