-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repeat: size, repeat: pos #24
Comments
You format can be described perfectly well in current language by adding an extra level of nesting: seq:
- id: table_1_size
type: u4
- id: table_1
size: table_1_size
type: table_1
types:
table_1:
seq:
- id: entries
type: table_1_entry
repeat: eos
table_1_entry:
seq:
- id: len
type: u4
- id: data
size: len In this example, The only downside of this is that you'll have to write this extra level of indirection in your code, i.e. not just Will that work for you? |
That works, thank you! And could you tell is there a way to do
Here I need to retrieve current position in a stream to calculate the size. I was trying |
Personally, I've never encountered a format where it would be needed. Like, in your example above, But, yeah, given that we have |
Before I create it, could you tell what you do mean by |
|
If we're adding Might be a good idea to add support/tests for # Example: I have a format that has an optional info block at the end of the file
seq:
- id: info
type: optional_info_type
if: !_io.eof
# Example: I'm doing something crazy and need this for a work-around or whatever
seq:
- id: never
type: u1
if: false |
Our "expression language" was originally a rip-off from a Python grammar, so I believe there's fairly good support for boolean expressions - but they are all named in English (i.e. |
Given that all questions seems to be answered, closing this one. |
Added a test to map value instances to an enum.
Fix some typos
Sometimes one need to describe repeated blocks which number is unknown and known only a size of all blocks or a position where they end. Consider the following .ksy file:
Here we want to read full table_1 but don't know how many entries exist. My suggestion is to add
repeat: size
attribute to make it possible to read as much table_1 entries as they fits in a size specified:The other option is to read to a position in stream. It may looks like that:
The text was updated successfully, but these errors were encountered: