class Cucumber::CucumberExpressions::ParameterTypeMatcher

def <=>(other)

def <=>(other)
  pos_comparison = start <=> other.start
  return pos_comparison if pos_comparison != 0
  length_comparison = other.group.length <=> group.length
  return length_comparison if length_comparison != 0
  0
end

def advance_to(new_match_position)

def advance_to(new_match_position)
  (new_match_position...@text.length).each do |advanced_position|
    matcher = self.class.new(parameter_type, @regexp, @text, advanced_position)
    return matcher if matcher.find && matcher.full_word?
  end
  self.class.new(parameter_type, @regexp, @text, @text.length)
end

def find

def find
  !@match.nil? && !group.empty?
end

def full_word?

def full_word?
  space_before_match_or_sentence_start? && space_after_match_or_sentence_end?
end

def group

def group
  @match.captures[0]
end

def initialize(parameter_type, regexp, text, match_position = 0)

def initialize(parameter_type, regexp, text, match_position = 0)
  @parameter_type, @regexp, @text = parameter_type, regexp, text
  @match = @regexp.match(@text, match_position)
end

def space_after_match_or_sentence_end?

def space_after_match_or_sentence_end?
  match_end = @match.end(0)
  match_end == @text.length || @text[match_end].match(/\p{Z}|\p{P}|\p{S}/)
end

def space_before_match_or_sentence_start?

def space_before_match_or_sentence_start?
  match_begin = @match.begin(0)
  match_begin == 0 || @text[match_begin - 1].match(/\p{Z}|\p{P}|\p{S}/)
end

def start

def start
  @match.begin(0)
end