Exception: Ruby::Rego::LexerError

Inherits:
Error
  • Object
show all
Defined in:
lib/ruby/rego/errors.rb

Overview

Error raised during tokenization.

Instance Attribute Summary collapse

Attributes inherited from Error

#location

Instance Method Summary collapse

Methods inherited from Error

#to_h

Constructor Details

#initialize(message, line:, column:, offset: nil, length: nil) ⇒ LexerError

Create a lexer error.

Parameters:

  • message (String)

    error message

  • line (Integer)

    line number

  • column (Integer)

    column number

  • offset (Integer, nil) (defaults to: nil)

    character offset

  • length (Integer, nil) (defaults to: nil)

    token length



71
72
73
74
75
76
# File 'lib/ruby/rego/errors.rb', line 71

def initialize(message, line:, column:, offset: nil, length: nil)
  @line = line
  @column = column
  location = Location.new(line: line, column: column, offset: offset, length: length)
  super(message, location: location)
end

Instance Attribute Details

#columnInteger (readonly)

Returns:

  • (Integer)


62
63
64
# File 'lib/ruby/rego/errors.rb', line 62

def column
  @column
end

#lineInteger (readonly)

Returns:

  • (Integer)


59
60
61
# File 'lib/ruby/rego/errors.rb', line 59

def line
  @line
end