Sha256: 55daaa0cef033bfeafcbd2efc9b8a5abed0659ade4ea651a65e9894745a233ac

Contents?: true

Size: 539 Bytes

Versions: 9

Compression:

Stored size: 539 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

      def initialize(value:, name:, line:, col:)
        @name = name
        @value = value
        @line = line
        @col = col
      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

9 entries across 9 versions & 1 rubygems

Version Path
graphql-0.19.3 lib/graphql/language/token.rb
graphql-0.19.2 lib/graphql/language/token.rb
graphql-0.19.1 lib/graphql/language/token.rb
graphql-0.19.0 lib/graphql/language/token.rb
graphql-0.18.15 lib/graphql/language/token.rb
graphql-0.18.14 lib/graphql/language/token.rb
graphql-0.18.13 lib/graphql/language/token.rb
graphql-0.18.12 lib/graphql/language/token.rb
graphql-0.18.11 lib/graphql/language/token.rb