class Lingo::Language::Lexical

Public Instance Methods

<=>(other) click to toggle source
# File lib/lingo/language/lexical.rb, line 45
def <=>(other)
  return 1 unless other.is_a?(self.class)

  a1, a2 = attr, other.attr
  return form <=> other.form if a1 == a2

  a1.empty? ? 1 : a2.empty? ? -1 : begin
    i1, i2 = LA_SORTORDER.values_at(a1, a2)
    i1 ? i2 ? i1 <=> i2 : -1 : i2 ? 1 : a1 <=> a2
  end
end
attr?(attr) click to toggle source
# File lib/lingo/language/lexical.rb, line 41
def attr?(attr)
  self.attr.start_with?(attr)
end
to_s() click to toggle source
# File lib/lingo/language/lexical.rb, line 61
def to_s
  "(#{super})"
end
to_str() click to toggle source
# File lib/lingo/language/lexical.rb, line 57
def to_str
  to_a.join('#')
end