class PETOOH::YY_SyntaxExpectationError

Attributes

expectations[R]

Private

Public Class Methods

new(*expectations, pos) click to toggle source

expectations are String-s.

Calls superclass method PETOOH::YY_SyntaxError::new
# File gen/lib/petooh.rb, line 297
def initialize(*expectations, pos)
  super(nil, pos)
  @expectations = expectations
end

Public Instance Methods

message() click to toggle source
# File gen/lib/petooh.rb, line 314
def message
  expectations = self.expectations.uniq
  (
    if expectations.size == 1 then expectations.first
    else [expectations[0...-1].join(", "), expectations[-1]].join(" or ")
    end
  ) + " is expected"
end
or(other) click to toggle source

returns other YY_SyntaxExpectationError with expectations combined.

other is another YY_SyntaxExpectationError.

pos of this YY_SyntaxExpectationError and other must be equal.

# File gen/lib/petooh.rb, line 309
def or other
  raise %(can not "or" #{YY_SyntaxExpectationError}s with different pos) unless self.pos == other.pos
  YY_SyntaxExpectationError.new(*(self.expectations + other.expectations), pos)
end