Implement h_attr_bool.
This commit is contained in:
parent
d343b0c8f0
commit
905183cddc
3 changed files with 17 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue