UpstandingHackers / hammer

Parser combinators for binary formats, in C. Yes, in C. What? Don't look at me like that.
GNU General Public License v2.0
430 stars 40 forks source link

h_many_up_to_n and h_many_i_j missing? #134

Open uucidl opened 9 years ago

uucidl commented 9 years ago

Hammer has:

hammer ABNF
h_many *(expr)
h_many1 1*(expr)
h_repeat_n n*n(expr)
? *n(expr)
? i*j(expr)

I've searched the source code and to my knowledge the last two cases are missing, for expressions with many elements up to n or many between i and j.

abiggerhammer commented 9 years ago

Good point! What would you think about folding the two missing cases into an h_many_between that takes a lower and upper bound? up_to(n) is like saying between(0, n).

uucidl commented 9 years ago

Yeah that would be perfect!

uucidl commented 9 years ago

By the way this came up as I was building an RFC5322 parser from the spec. The lines in the body are all supposed to be *998text

abiggerhammer commented 9 years ago

Cool. I'll try and get that banged into many.c this weekend.