class PuppetLint::LexerError
Internal: A generic error thrown by the lexer when it encounters something it can't handle.
Attributes
column[R]
Internal: Get the Integer column number of the location of the error.
line_no[R]
Internal: Get the Integer line number of the location of the error.
Public Class Methods
new(code, offset)
click to toggle source
Internal: Initialise a new PuppetLint::LexerError object.
code - The String manifest code being tokenised. offset - The Integer position in the code string that the tokeniser was
at when it encountered the error.
# File lib/puppet-lint/lexer.rb, line 21 def initialize(code, offset) chunk = code[0..offset] @line_no = chunk.scan(/(\r\n|\r|\n)/).size + 1 if @line_no == 1 @column = chunk.length else @column = chunk.length - chunk.rindex(/(\r\n|\r|\n)/) - 1 end @column = 1 if @column == 0 end