Class: Scribble::Parsing::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/scribble/parsing/reporter.rb

Defined Under Namespace

Classes: Cause

Instance Method Summary collapse

Instance Method Details

#err(atom, source, message, children = nil) ⇒ Object



57
58
59
# File 'lib/scribble/parsing/reporter.rb', line 57

def err atom, source, message, children = nil
  err_at atom, source, message, source.pos, children
end

#err_at(atom, source, message, position, children = nil) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/scribble/parsing/reporter.rb', line 61

def err_at atom, source, message, position, children = nil
  if @position.nil? || position > @position
    @position = position
    @cause = Cause.new source, position
  end
  @cause.strings << atom.str if position == @position && atom.respond_to?(:str)
  @cause
end