Implement h_attr_bool.

This commit is contained in:
Jakob Rath 2013-12-17 00:06:29 +01:00 committed by Dan Hirsch
parent d343b0c8f0
commit 905183cddc
3 changed files with 17 additions and 1 deletions

View file

@ -46,3 +46,8 @@ $r = parser.parse 'abcdefgh'
p $r[:ast][:data][:seq].elements.map {|e| e[:data][:uint]}
# or:
p $r.ast.data.map(&:data)
h = Hammer::Parser
parser = h.many(h.attr_bool(h.uint8) { |r| r.ast.data <= 100 })
p parser.parse('abcdefgh').ast.data.map(&:data)