class Lingo::Language::Token

Constants

POSITION_SEP

Attributes

offset[R]
position[R]

Public Class Methods

clean(attr) click to toggle source
# File lib/lingo/language/token.rb, line 44
def self.clean(attr)
  attr.sub(/:.*/, '')
end
new(form, attr, position = nil, offset = nil) click to toggle source
Calls superclass method
# File lib/lingo/language/token.rb, line 48
def initialize(form, attr, position = nil, offset = nil)
  @position, @offset = position, offset
  super(form, self.class.clean(attr))
end

Public Instance Methods

number?() click to toggle source
# File lib/lingo/language/token.rb, line 61
def number?
  attr == TA_NUMBER
end
position_and_offset() click to toggle source
# File lib/lingo/language/token.rb, line 65
def position_and_offset
  "#{position}#{POSITION_SEP}#{offset}"
end
to_a() click to toggle source
# File lib/lingo/language/token.rb, line 69
def to_a
  [form, attr, position, offset]
end
to_s() click to toggle source
# File lib/lingo/language/token.rb, line 73
def to_s
  ":#{super}:"
end
word?() click to toggle source
# File lib/lingo/language/token.rb, line 55
def word?
  attr == TA_WORD
end
Also aliased as: word_token?
word_token?()
Alias for: word?