Big endian support

I want to use BEdit on a format that uses big endian numbers, also with enum tags.

How about simply being able to specify endianness as a type parameter (u(4, big) and TagEnum(4, big))?

Edited by Benjamin Pedersen on Reason: Initial post
Hello Benjipede,

Byte order / endianess is something I've had on my todo-list for some time now and I was thinking of a similar approach to the one you suggest.

As files usually have the same byte order across the entire data I was thinking of also adding something like a global directive telling the interpreter to treat all data (unless specified otherwise) as big or little endian. It would be rather annoying to have to write big all over the place when you could just specify it once. However that would of course make it more complicated if some data uses big endian and some uses little, although I'm not sure how common that is.

It should be a somewhat trivial addition to the current codebase so I think I could even add it to the next update.
I just released version 0.0.3 that adds some support for byte order specification.

You can write exactly as you wrote in the original post, but you can also use `default(endianess=big)` on top block level, any definition below that statement will interpret the scalars with that byte order.
I know it is a late reply, but I like your way of handling it.