Sha256: 7cf27b6cab59c1f3a46dc5d67b965428f2fdad1551402947a86da540dbdb6f71

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

module RBS
  class Parser
    def self.parse_type(source, line: nil, column: nil, range: nil, variables: [])
      buf = buffer(source)
      _parse_type(buf, range&.begin || 0, range&.end || buf.last_position, variables, range.nil?)
    end

    def self.parse_method_type(source, line: nil, column: nil, range: nil, variables: [])
      buf = buffer(source)
      _parse_method_type(buf, range&.begin || 0, range&.end || buf.last_position, variables, range.nil?)
    end

    def self.parse_signature(source, line: nil, column: nil)
      buf = buffer(source)
      _parse_signature(buf, buf.last_position)
    end

    def self.buffer(source)
      case source
      when String
        Buffer.new(content: source, name: "a.rbs")
      when Buffer
        source
      end
    end

    autoload :SyntaxError, "rbs/parser_compat/syntax_error"
    autoload :SemanticsError, "rbs/parser_compat/semantics_error"
    autoload :LexerError, "rbs/parser_compat/lexer_error"
    autoload :LocatedValue, "rbs/parser_compat/located_value"

    KEYWORDS = %w(
      bool
      bot
      class
      instance
      interface
      nil
      self
      singleton
      top
      void
      type
      unchecked
      in
      out
      end
      def
      include
      extend
      prepend
      alias
      module
      attr_reader
      attr_writer
      attr_accessor
      public
      private
      untyped
      true
      false
      ).each_with_object({}) do |keyword, hash|
        hash[keyword] = nil
      end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/rbs-2.8.4/lib/rbs/parser_aux.rb
rbs-2.8.4 lib/rbs/parser_aux.rb
rbs-2.8.3 lib/rbs/parser_aux.rb
rbs-3.0.0.dev.1 lib/rbs/parser_aux.rb
rbs-2.8.2 lib/rbs/parser_aux.rb
rbs-2.8.1 lib/rbs/parser_aux.rb
rbs-2.8.0 lib/rbs/parser_aux.rb
rbs-2.8.0.pre.1 lib/rbs/parser_aux.rb