Sha256: b3afdb0e0d22223a35c96b9e9c12dd2b0cdf0403e2b94ca03410917b006e32f5

Contents?: true

Size: 476 Bytes

Versions: 7

Compression:

Stored size: 476 Bytes

Contents

# encoding: utf-8

module RuboCop
  # A basic wrapper around Parser's tokens.
  class Token
    attr_reader :pos, :type, :text

    def self.from_parser_token(parser_token)
      type, details = *parser_token
      text, range = *details
      new(range, type, text)
    end

    def initialize(pos, type, text)
      @pos = pos
      @type = type
      @text = text
    end

    def to_s
      "[[#{@pos.line}, #{@pos.column}], #{@type}, #{@text.inspect}]"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubocop-0.34.2 lib/rubocop/token.rb
rubocop-0.34.1 lib/rubocop/token.rb
rubocop-0.34.0 lib/rubocop/token.rb
rubocop-0.33.0 lib/rubocop/token.rb
rubocop-0.32.1 lib/rubocop/token.rb
rubocop-0.32.0 lib/rubocop/token.rb
rubocop-0.31.0 lib/rubocop/token.rb