Exception: PuppetLint::LexerError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/puppet-lint/lexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, offset) ⇒ LexerError

Returns a new instance of LexerError.



9
10
11
12
13
14
15
16
17
18
# File 'lib/puppet-lint/lexer.rb', line 9

def initialize(code, offset)
  chunk = code[0..offset]
  @line_no = chunk.count("\n") + 1
  if @line_no == 1
    @column = chunk.length
  else
    @column = chunk.length - chunk.rindex("\n") - 1
  end
  @column = 1 if @column == 0
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



8
9
10
# File 'lib/puppet-lint/lexer.rb', line 8

def column
  @column
end

#line_noObject (readonly)

Returns the value of attribute line_no.



8
9
10
# File 'lib/puppet-lint/lexer.rb', line 8

def line_no
  @line_no
end