Sha256: 8c4ede70d6918f4602626ab2a27347a41ec90aef66f7fbf0bf26e37e8d069527

Contents?: true

Size: 630 Bytes

Versions: 4

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module RBS
    class ProcessedRBSSource
      attr_reader :raw_source
      attr_reader :source
      attr_reader :buffer
      attr_reader :directives
      attr_reader :decls
      attr_reader :error

      def initialize(source)
        @raw_source = source.content
        @buffer, @directives, @decls = ::RBS::Parser.parse_signature(source)
        @error = nil
        @tokens = nil
      rescue ::RBS::ParsingError => e
        @error = e
      end

      def tokens
        @tokens ||= begin
          ::RBS::Parser.lex(buffer).value
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-on-rbs-0.5.0 lib/rubocop/rbs/processed_rbs_source.rb
rubocop-on-rbs-0.4.0 lib/rubocop/rbs/processed_rbs_source.rb
rubocop-on-rbs-0.3.0 lib/rubocop/rbs/processed_rbs_source.rb
rubocop-on-rbs-0.2.0 lib/rubocop/rbs/processed_rbs_source.rb