Exception: PETOOH::YY_SyntaxExpectationError
- Inherits:
-
YY_SyntaxError
- Object
- Exception
- YY_SyntaxError
- PETOOH::YY_SyntaxExpectationError
- Defined in:
- gen/lib/petooh.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from YY_SyntaxError
Instance Method Summary collapse
-
#initialize(*expectations, pos) ⇒ YY_SyntaxExpectationError
constructor
expectationsare String-s. - #message ⇒ Object
-
#or(other) ⇒ Object
returns other YY_SyntaxExpectationError with #expectations combined.
Constructor Details
#initialize(*expectations, pos) ⇒ YY_SyntaxExpectationError
expectations are String-s.
297 298 299 300 |
# File 'gen/lib/petooh.rb', line 297 def initialize(*expectations, pos) super(nil, pos) @expectations = expectations end |
Instance Method Details
#message ⇒ Object
314 315 316 317 318 319 320 321 |
# File 'gen/lib/petooh.rb', line 314 def 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) ⇒ Object
returns other YY_SyntaxExpectationError with #expectations combined.
other is another YY_SyntaxExpectationError.
#pos of this YY_SyntaxExpectationError and other must be equal.
309 310 311 312 |
# 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 |