Sha256: 8e1ecbcabd852e46f6f1428961f89e31bfab821b4de3c2815c311772914f8f69

Contents?: true

Size: 605 Bytes

Versions: 10

Compression:

Stored size: 605 Bytes

Contents

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

10 entries across 10 versions & 1 rubygems

Version Path
graphql-1.2.6 lib/graphql/language/token.rb
graphql-1.2.5 lib/graphql/language/token.rb
graphql-1.2.4 lib/graphql/language/token.rb
graphql-1.2.3 lib/graphql/language/token.rb
graphql-1.2.2 lib/graphql/language/token.rb
graphql-1.2.1 lib/graphql/language/token.rb
graphql-1.2.0 lib/graphql/language/token.rb
graphql-1.1.0 lib/graphql/language/token.rb
graphql-1.0.0 lib/graphql/language/token.rb
graphql-0.19.4 lib/graphql/language/token.rb