class GraphQL::Language::Token
Emitted by the lexer and passed to the parser. Contains type, value and position data.
Attributes
col[R]
line[R]
name[R]
@return [Symbol] The kind of token this is
prev_token[R]
to_s[R]
@return [String] The text of this token
value[R]
@return [String] The text of this token
Public Class Methods
new(value:, name:, line:, col:, prev_token:)
click to toggle source
# File lib/graphql/language/token.rb, line 13 def initialize(value:, name:, line:, col:, prev_token:) @name = name @value = value.freeze @line = line @col = col @prev_token = prev_token end
Public Instance Methods
inspect()
click to toggle source
# File lib/graphql/language/token.rb, line 29 def inspect "(#{@name} #{@value.inspect} [#{@line}:#{@col}])" end
line_and_column()
click to toggle source
# File lib/graphql/language/token.rb, line 25 def line_and_column [@line, @col] end
to_f()
click to toggle source
# File lib/graphql/language/token.rb, line 23 def to_f; @value.to_f; end
to_i()
click to toggle source
# File lib/graphql/language/token.rb, line 22 def to_i; @value.to_i; end