class Fluent::Config::BasicParser
def check(pattern)
def check(pattern) @ss.check(pattern) end
def eof?
def eof? @ss.eos? end
def error_sample
def error_sample pos = @ss.pos lines = @ss.string.lines.to_a lines.each_with_index { |line, ln| if line.size >= pos msgs = ["line #{ln + 1},#{pos}\n"] if ln > 0 last_line = lines[ln - 1] msgs << "%3s: %s" % [ln, last_line] end msgs << "%3s: %s" % [ln + 1, line] msgs << "\n #{'-' * pos}^\n" if next_line = lines[ln + 1] msgs << "%3s: %s" % [ln + 2, next_line] end return msgs.join end pos -= line.size last_line = line } end
def getch
def getch @ss.getch end
def initialize(strscan)
def initialize(strscan) @ss = strscan end
def line_end
def line_end skip(LINE_END) end
def parse_error!(message)
def parse_error!(message) raise ConfigParseError, "#{message} at #{error_sample}" end
def prev_match
def prev_match @ss[0] end
def scan(pattern)
def scan(pattern) @ss.scan(pattern) end
def skip(pattern)
def skip(pattern) @ss.skip(pattern) end
def spacing
def spacing skip(SPACING) end
def spacing_without_comment
def spacing_without_comment skip(SPACING_WITHOUT_COMMENT) end