class KPeg::Choice
Attributes
ops[R]
Public Class Methods
new(*many)
click to toggle source
Calls superclass method
KPeg::Operator::new
# File lib/kpeg/grammar.rb, line 194 def initialize(*many) super() @ops = many end
Public Instance Methods
==(obj)
click to toggle source
Calls superclass method
# File lib/kpeg/grammar.rb, line 220 def ==(obj) case obj when Choice @ops == obj.ops else super end end
inspect()
click to toggle source
# File lib/kpeg/grammar.rb, line 229 def inspect inspect_type "any", @ops.map { |i| i.inspect }.join(' | ') end
match(x)
click to toggle source
# File lib/kpeg/grammar.rb, line 206 def match(x) pos = x.pos @ops.each do |c| if m = c.match(x) return m end x.pos = pos end return nil end
|(other)
click to toggle source
# File lib/kpeg/grammar.rb, line 201 def |(other) @ops << Grammar.resolve(other) self end