Sha256: d849ad1f499b4fac3fcdb00eb575c32c34db530d4f81c38598907ab200935b7c

Contents?: true

Size: 635 Bytes

Versions: 38

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module Language
    # Emitted by the lexer and passed to the parser.
    # Contains type, value and position data.
    class Token
      # @return [Symbol] The kind of token this is
      attr_reader :name, :prev_token, :line

      def initialize(value:, name:, line:, col:, prev_token:)
        @name = name
        @value = value
        @line = line
        @col = col
        @prev_token = prev_token
      end

      def to_s; @value; end
      def to_i; @value.to_i; end
      def to_f; @value.to_f; end

      def line_and_column
        [@line, @col]
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
graphql-1.8.0.pre1 lib/graphql/language/token.rb
graphql-1.7.6 lib/graphql/language/token.rb
graphql-1.7.5 lib/graphql/language/token.rb
graphql-1.7.4 lib/graphql/language/token.rb
graphql-1.7.3 lib/graphql/language/token.rb
graphql-1.7.2 lib/graphql/language/token.rb
graphql-1.7.1 lib/graphql/language/token.rb
graphql-1.7.0 lib/graphql/language/token.rb
graphql-1.6.8 lib/graphql/language/token.rb
graphql-1.6.7 lib/graphql/language/token.rb
graphql-1.6.6 lib/graphql/language/token.rb
graphql-1.6.5 lib/graphql/language/token.rb
graphql-1.6.4 lib/graphql/language/token.rb
graphql-1.5.15 lib/graphql/language/token.rb
graphql-1.6.3 lib/graphql/language/token.rb
graphql-1.6.2 lib/graphql/language/token.rb
graphql-1.6.1 lib/graphql/language/token.rb
graphql-1.6.0 lib/graphql/language/token.rb
graphql-1.5.14 lib/graphql/language/token.rb
graphql-1.5.13 lib/graphql/language/token.rb