Sha256: 966265aebdf6aa557a8111f7944fdaf78d3898abe9242710dc95d53ea715b06c
Contents?: true
Size: 677 Bytes
Versions: 14
Compression:
Stored size: 677 Bytes
Contents
# frozen_string_literal: true class Language class Parser class Interuption < StandardError def initialize(parser, atom = Atom.new) @parser = parser @atom = atom end def message "\n#{line}#{" " * column_index}^\n" end def line l = input.lines[line_index] l += "\n" if l[-1] != "\n" l end def line_index input[...cursor].count("\n") end def column_index cursor - input.lines[...line_index].map(&:size).sum end private def cursor @parser.cursor end def input @parser.input end end end end
Version data entries
14 entries across 14 versions & 1 rubygems