Method: PuppetLint::LexerError#initialize

Defined in:
lib/puppet-lint/lexer.rb

#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