class ABNF::Concat
Public Class Methods
new(*choices, &blk)
click to toggle source
# File lib/abnf.rb, line 115 def initialize(*choices, &blk) @choices = choices @blk = blk end
Public Instance Methods
match(strm)
click to toggle source
# File lib/abnf.rb, line 125 def match(strm) c_strm = strm start = c_strm.pos @choices.each { |c| c_strm = c.match(c_strm) return nil if c_strm.nil? } @blk.call(c_strm.clip(start)) unless @blk.nil? return c_strm end
set_block(&blk)
click to toggle source
# File lib/abnf.rb, line 120 def set_block(&blk) @blk = blk return self end