Sha256: 2faac28de6adea3844098979d6c2bc1a605fd72310154820873973670297c3cd

Contents?: true

Size: 794 Bytes

Versions: 18

Compression:

Stored size: 794 Bytes

Contents

class Code
  class Parser
    class Error
      class SyntaxError < ::Code::Parser::Error
        def initialize(
          message,
          input:,
          line:,
          column:,
          offset_lines:,
          offset_columns:
        )
          @message = message
          @input = input
          @line = line
          @column = column
          @offset_lines = offset_lines
          @offset_columns = offset_columns
        end

        def message
          @message + "\n\n" + line_message + "\n" + " " * column +
            "^" * offset_columns
        end

        private

        def line_message
          input.lines[line..(line + offset_lines)].join
        end

        attr_reader :input, :line, :column, :offset_lines, :offset_columns
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
template-ruby-parser-0.1.8 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.8 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.7 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.7 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.6 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.6 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.5 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.5 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.4 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.4 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.3 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.3 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.2 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.2 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.1 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.1 lib/code/parser/error/syntax_error.rb
template-ruby-parser-0.1.0 lib/code/parser/error/syntax_error.rb
code-ruby-parser-0.1.0 lib/code/parser/error/syntax_error.rb