Skip to content

switches without nondefaults results in syntax error on Python #595

@ejeandel

Description

@ejeandel

The following codes produces a syntax error on python:

meta:
  id: ops
  endian: le
seq:      
  - id: opcode
    type: u1
  - id: arguments
    type:
      switch-on: opcode
      cases:
        _: u4

the produced code is:

    def _read(self):
        self.opcode = self._io.read_u1()
        _on = self.opcode
        else:
            self.arguments = self._io.read_u4le()

hence a "else" with no "if".
Maybe this particular pattern should not be allowed ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions