class CTioga2::Commands::ParsingContext

Context of parsing, mostly for error reporting

Public Instance Methods

parsing_file(command, file, line = -1) click to toggle source

Currently within a file

# File lib/ctioga2/commands/context.rb, line 31
def parsing_file(command, file, line = -1)
  @option = nil
  @command = command
  @file = file
  @number = line
end
parsing_option(opt, number) click to toggle source

Currently parsing an option

# File lib/ctioga2/commands/context.rb, line 25
def parsing_option(opt, number)
  @option = opt
  @number = number
end
to_s() click to toggle source
# File lib/ctioga2/commands/context.rb, line 38
def to_s
  if @option
    "option #{@option} (##{@number})"
  else
    file = @file.inspect
    if @file.respond_to?(:path)
      file = @file.path
    end
    if @command
      "command #{@command} in file '#{file}' line #{@number}"
    else
      "line #{@number} in file '#{file}'"
    end
  end
end