class DataMetaParse::Err

Parsing error, RuntimeError augmented with report feature

Attributes

parser[R]
source[R]

Public Class Methods

new(source, parser) click to toggle source

Constructor, constructs also the error message passed to the super.

@param [String] source the next have been parsed to get this error @param [Object] parser Treetop compiled parser whichever class it is. It may be Treetop::Runtime::CompiledParser

Calls superclass method
# File lib/dataMetaParse.rb, line 25
        def initialize(source, parser)
            @source, @parser = source, parser
            parser.failure_reason =~ /^(Expected .+) after/m
            reason = $1 || 'REASONLESS'
            # replace newlines with <EOL> to make them stand out
            super %Q<ERROR at index #{parser.index}
#{reason.gsub("\n", '<EOL>')}:
#{source.lines.to_a[parser.failure_line - 1]}
#{'~' * (parser.failure_column - 1)}^
>
        end