class Token

Attributes

origin[R]
token_text[R]
token_type[R]

Public Class Methods

new(token_type, origin, token_text = nil, debug_string = nil) click to toggle source
# File lib/hocon/impl/token.rb, line 11
def initialize(token_type, origin, token_text = nil, debug_string = nil)
  @token_type = token_type
  @origin = origin
  @token_text = token_text
  @debug_string = debug_string
end
new_without_origin(token_type, debug_string, token_text) click to toggle source
# File lib/hocon/impl/token.rb, line 7
def self.new_without_origin(token_type, debug_string, token_text)
  Hocon::Impl::Token.new(token_type, nil, token_text, debug_string)
end

Public Instance Methods

==(other) click to toggle source
# File lib/hocon/impl/token.rb, line 36
def ==(other)
  # @origin deliberately left out
  other.is_a?(Hocon::Impl::Token) && @token_type == other.token_type
end
hash() click to toggle source
# File lib/hocon/impl/token.rb, line 41
def hash
  @token_type.hash
end
line_number() click to toggle source
# File lib/hocon/impl/token.rb, line 20
def line_number
  if @origin
    @origin.line_number
  else
    -1
  end
end
to_s() click to toggle source
# File lib/hocon/impl/token.rb, line 28
def to_s
  if !@debug_string.nil?
    @debug_string
  else
    Hocon::Impl::TokenType.token_type_name(@token_type)
  end
end