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 43
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 47
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 60
def number?
  attr == TA_NUMBER
end
position_and_offset() click to toggle source
# File lib/lingo/language/token.rb, line 64
def position_and_offset
  "#{position}#{POSITION_SEP}#{offset}"
end
to_a() click to toggle source
# File lib/lingo/language/token.rb, line 68
def to_a
  [form, attr, position, offset]
end
to_s() click to toggle source
# File lib/lingo/language/token.rb, line 72
def to_s
  ":#{super}:"
end
word?() click to toggle source
# File lib/lingo/language/token.rb, line 54
def word?
  attr == TA_WORD
end
Also aliased as: word_token?
word_token?()
Alias for: word?