class Parse::Expected

Attributes

what[R]

@!visibility private @return [Array<String>]

Public Class Methods

new(pos, what_1, *what_2_n) click to toggle source

@param [Position] pos @param [String] what_1 @param [*String] what_2_n

Calls superclass method Parse::Error::new
# File lib/parse.rb, line 120
def initialize(pos, what_1, *what_2_n)
  @what = [what_1, *what_2_n]
  super(pos, "#{@what.join(", ")} expected")
end

Public Instance Methods

or(other) click to toggle source

(see Error#or)

Calls superclass method Parse::Error#or
# File lib/parse.rb, line 126
def or other
  if other.is_a? Expected
    raise "#{self.pos} == #{other.pos} is false" unless self.pos == other.pos
    Expected.new(pos, *(self.what + other.what).uniq)
  else
    super(other)
  end
end