class Omnium::Parser::ParseErrorHandler::ParseError

could possibly break this out if desired…

Attributes

actual_type[R]
expected_type[R]

Public Class Methods

new(**args) click to toggle source
Calls superclass method
# File lib/omnium/parser/parse_error_handler.rb, line 20
def initialize(**args)
  @actual_type = args[:actual_type]
  @expected_type = args[:expected_type]

  super(args[:message] || default_message)
end

Private Instance Methods

default_message() click to toggle source
# File lib/omnium/parser/parse_error_handler.rb, line 29
def default_message
  template = "Expecting token type(s) '%s', got '%s'."
  format(template, sanitised_expected_type, @actual_type)
end
sanitised_expected_type() click to toggle source
# File lib/omnium/parser/parse_error_handler.rb, line 34
def sanitised_expected_type
  return @expected_type.to_s if @expected_type.is_a? Symbol

  @expected_type.join(', ')
end