class Herb::Errors::UnexpectedTokenError
def initialize(type, location, message, expected_type, found)
def initialize(type, location, message, expected_type, found) super(type, location, message) @expected_type = expected_type @found = found end
def inspect
def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end
def to_hash
def to_hash super.merge({ expected_type: expected_type, found: found, }) end
def tree_inspect(indent = 0)
def tree_inspect(indent = 0) output = +"" output += %(@ #{error_name} #{location.tree_inspect}\n) output += %(├── message: #{message.inspect}\n) output += %(├── expected_type: #{expected_type.inspect}\n) output += %(└── found: #{found ? found.tree_inspect : "∅"}\n) output += %(\n) output.gsub(/^/, " " * indent) end