class KPeg::Sequence
Attributes
ops[R]
Public Class Methods
new(*ops)
click to toggle source
Calls superclass method
KPeg::Operator::new
# File lib/kpeg/grammar.rb, line 293 def initialize(*ops) super() @ops = ops detect_tags ops end
Public Instance Methods
==(obj)
click to toggle source
Calls superclass method
# File lib/kpeg/grammar.rb, line 314 def ==(obj) case obj when Sequence @ops == obj.ops else super end end
inspect()
click to toggle source
# File lib/kpeg/grammar.rb, line 323 def inspect inspect_type "seq", @ops.map { |i| i.inspect }.join(' ') end
match(x)
click to toggle source
# File lib/kpeg/grammar.rb, line 301 def match(x) start = x.pos matches = @ops.map do |n| m = n.match(x) unless m x.pos = start return nil end m end MatchComposition.new(self, matches) end