module Parse::Position

Public Class Methods

new(line, column, file = "-") click to toggle source

@param [Integer] line @param [Integer] column @param [String] file @return [Position]

# File lib/parse.rb, line 53
def self.new(line, column, file = "-")
  Position2.new(line, column, file)
end

Public Instance Methods

<=>(other) click to toggle source

@return [-1, 0, 1, nil] nil if other.{#file} != self.{#file} or

+other+ is not a {Position}. Otherwise it compares {#line} and {#column}
and returns -1, 0 or 1. See also {Comparable#<=>}.
# File lib/parse.rb, line 72
def <=> other
  return nil unless other.is_a? Position
  return nil unless self.file == other.file
  x = self.line <=> other.line
  return x if x != 0
  return self.column <=> other.column
end
==(other) click to toggle source

@return [Boolean]

# File lib/parse.rb, line 81
def == other
  return false unless other.is_a? Position
  return (self <=> other) == 0
end
to_s() click to toggle source

@return [String]

# File lib/parse.rb, line 87
def to_s
  "#{file}:#{line}:#{column}"
end