class Hocon::Impl::Tokens

FIXME the way the subclasses of Token are private with static isFoo and accessors is kind of ridiculous.

Constants

CLOSE_CURLY
CLOSE_SQUARE
COLON
COMMA
ConfigBoolean
ConfigBugOrBrokenError
ConfigDouble
ConfigInt
ConfigNull
ConfigNumber
ConfigString
EOF
EQUALS
OPEN_CURLY
OPEN_SQUARE
PLUS_EQUALS
ResolveStatus
START
Token
TokenType

Public Class Methods

comment?(t) click to toggle source
# File lib/hocon/impl/tokens.rb, line 346
def self.comment?(t)
  t.is_a?(Comment)
end
comment_text(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 350
def self.comment_text(token)
  if comment?(token)
    token.text
  else
    raise ConfigBugOrBrokenError, "tried to get comment text from #{token}"
  end
end
get_problem_cause(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 338
def self.get_problem_cause(token)
  if token.is_a?(Problem)
    token.cause
  else
    raise ConfigBugOrBrokenError.new("tried to get problem cause from #{token}")
  end
end
get_problem_message(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 322
def self.get_problem_message(token)
  if token.is_a?(Problem)
    token.message
  else
    raise ConfigBugOrBrokenError.new("tried to get problem message from #{token}")
  end
end
get_problem_suggest_quotes(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 330
def self.get_problem_suggest_quotes(token)
  if token.is_a?(Problem)
    token.suggest_quotes
  else
    raise ConfigBugOrBrokenError.new("tried to get problem suggest_quotes from #{token}")
  end
end
get_problem_what(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 314
def self.get_problem_what(token)
  if token.is_a?(Problem)
    token.what
  else
    raise ConfigBugOrBrokenError, "tried to get problem what from #{token}"
  end
end
get_substitution_optional(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 386
def self.get_substitution_optional(token)
  if token.is_a?(Substitution)
    token.optional?
  else
    raise ConfigBugOrBrokenError, "tried to get substitution optionality from #{token}"
  end
end
get_substitution_path_expression(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 378
def self.get_substitution_path_expression(token)
  if token.is_a?(Substitution)
    token.value
  else
    raise ConfigBugOrBrokenError, "tried to get substitution from #{token}"
  end
end
ignored_whitespace?(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 370
def self.ignored_whitespace?(token)
  token.is_a?(IgnoredWhitespace)
end
new_boolean(origin, value) click to toggle source
# File lib/hocon/impl/tokens.rb, line 457
def self.new_boolean(origin, value)
  new_value(ConfigBoolean.new(origin, value), value.to_s)
end
new_comment_double_slash(origin, text) click to toggle source
# File lib/hocon/impl/tokens.rb, line 413
def self.new_comment_double_slash(origin, text)
  Comment::DoubleSlashComment.new(origin, text)
end
new_comment_hash(origin, text) click to toggle source
# File lib/hocon/impl/tokens.rb, line 417
def self.new_comment_hash(origin, text)
  Comment::HashComment.new(origin, text)
end
new_double(origin, value, orig_text) click to toggle source
# File lib/hocon/impl/tokens.rb, line 445
def self.new_double(origin, value, orig_text)
  new_value(ConfigNumber.new_number(origin, value, orig_text), orig_text)
end
new_ignored_whitespace(origin, s) click to toggle source
# File lib/hocon/impl/tokens.rb, line 425
def self.new_ignored_whitespace(origin, s)
  IgnoredWhitespace.new(origin, s)
end
new_int(origin, value, orig_text) click to toggle source
# File lib/hocon/impl/tokens.rb, line 441
def self.new_int(origin, value, orig_text)
  new_value(ConfigNumber.new_number(origin, value, orig_text), orig_text)
end
new_line(origin) click to toggle source
# File lib/hocon/impl/tokens.rb, line 405
def self.new_line(origin)
  Line.new(origin)
end
new_long(origin, value, orig_text) click to toggle source
# File lib/hocon/impl/tokens.rb, line 449
def self.new_long(origin, value, orig_text)
  new_value(ConfigNumber.new_number(origin, value, orig_text), orig_text)
end
new_null(origin) click to toggle source
# File lib/hocon/impl/tokens.rb, line 453
def self.new_null(origin)
  new_value(ConfigNull.new(origin), "null")
end
new_problem(origin, what, message, suggest_quotes, cause) click to toggle source
# File lib/hocon/impl/tokens.rb, line 409
def self.new_problem(origin, what, message, suggest_quotes, cause)
  Problem.new(origin, what, message, suggest_quotes, cause)
end
new_string(origin, value, orig_text) click to toggle source
# File lib/hocon/impl/tokens.rb, line 437
def self.new_string(origin, value, orig_text)
  new_value(ConfigString::Quoted.new(origin, value), orig_text)
end
new_substitution(origin, optional, expression) click to toggle source
# File lib/hocon/impl/tokens.rb, line 429
def self.new_substitution(origin, optional, expression)
  Substitution.new(origin, optional, expression)
end
new_unquoted_text(origin, s) click to toggle source
# File lib/hocon/impl/tokens.rb, line 421
def self.new_unquoted_text(origin, s)
  UnquotedText.new(origin, s)
end
new_value(value, orig_text = nil) click to toggle source
# File lib/hocon/impl/tokens.rb, line 433
def self.new_value(value, orig_text = nil)
  Value.new(value, orig_text)
end
newline?(t) click to toggle source
# File lib/hocon/impl/tokens.rb, line 306
def self.newline?(t)
  t.is_a?(Line)
end
problem?(t) click to toggle source
# File lib/hocon/impl/tokens.rb, line 310
def self.problem?(t)
  t.is_a?(Problem)
end
substitution?(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 374
def self.substitution?(token)
  token.is_a?(Substitution)
end
unquoted_text(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 362
def self.unquoted_text(token)
  if unquoted_text?(token)
    token.value
  else
    raise ConfigBugOrBrokenError, "tried to get unquoted text from #{token}"
  end
end
unquoted_text?(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 358
def self.unquoted_text?(token)
  token.is_a?(UnquotedText)
end
value(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 294
def self.value(token)
  if token.is_a?(Value)
    token.value
  else
    raise ConfigBugOrBrokenError, "tried to get value of non-value token #{token}"
  end
end
value?(token) click to toggle source
# File lib/hocon/impl/tokens.rb, line 290
def self.value?(token)
  token.is_a?(Value)
end
value_with_type?(t, value_type) click to toggle source
# File lib/hocon/impl/tokens.rb, line 302
def self.value_with_type?(t, value_type)
  value?(t) && (value(t).value_type == value_type)
end