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 344 def self.comment?(t) t.is_a?(Comment) end
comment_text(token)
click to toggle source
# File lib/hocon/impl/tokens.rb, line 348 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 336 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 320 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 328 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 312 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 384 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 376 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 368 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 455 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 411 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 415 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 443 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 423 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 439 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 403 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 447 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 451 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 407 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 435 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 427 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 419 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 431 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 304 def self.newline?(t) t.is_a?(Line) end
problem?(t)
click to toggle source
# File lib/hocon/impl/tokens.rb, line 308 def self.problem?(t) t.is_a?(Problem) end
substitution?(token)
click to toggle source
# File lib/hocon/impl/tokens.rb, line 372 def self.substitution?(token) token.is_a?(Substitution) end
unquoted_text(token)
click to toggle source
# File lib/hocon/impl/tokens.rb, line 360 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 356 def self.unquoted_text?(token) token.is_a?(UnquotedText) end
value(token)
click to toggle source
# File lib/hocon/impl/tokens.rb, line 292 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 288 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 300 def self.value_with_type?(t, value_type) value?(t) && (value(t).value_type == value_type) end