Sha256: cfc757e379a83db91b4532df0843d1de844709fceec70cc54f0e4fe2ed7d4dfd

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

require "objc2swift_assistant/version"

require "objc2swift_assistant/code_recognizer"

module Objc2swiftAssistant

  class InterfaceRecognizer < CodeRecognizer
    def initialize( )
      super( /^\s*@interface()/, ClassInterfaceRegion, :implementation, true, voiding_regex:/^\s*@interface\s*\w*\s*\(/)
    end
  end


  class ClassInterfaceRegion < ClassRootRegion
    attr_accessor :super_class
    attr_accessor :implements

    def initialize(starting_line_number, is_root_entity )
      super(starting_line_number, is_root_entity, CLASS_INTERFACE_KEY )
    end

    def extract_information( file_slice )
      m = /^\s*(@interface)\s+(?<class_name>\w*)\s*:\s*(?<super_class>\w*)?\s*(<(?<implements>.*)>)?/.match(file_slice[0])
      unless m.nil?
        @class_name = m["class_name"]
        @super_class = m["super_class"]
        implements_list = m["implements"]
        @implements = implements_list.nil? ? [] : implements_list.split( /\s*,\s*/ )
        @configuration.log_verbose( "class_name = #{@class_name} super_class = #{@super_class} implements = #{@implements}")
      else
        @configuration.log_warning( "WARNING: Could not match interface declaration in #{file_slice[0]}" )
      end
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
objc2swift_assistant-0.3.6 lib/objc2swift_assistant/recognizers/interface_recognizer.rb
objc2swift_assistant-0.3.4 lib/objc2swift_assistant/recognizers/interface_recognizer.rb
objc2swift_assistant-0.3.3 lib/objc2swift_assistant/recognizers/interface_recognizer.rb
objc2swift_assistant-0.3.2 lib/objc2swift_assistant/recognizers/interface_recognizer.rb
objc2swift_assistant-0.3.1 lib/objc2swift_assistant/recognizers/interface_recognizer.rb
objc2swift_assistant-0.3.0 lib/objc2swift_assistant/recognizers/interface_recognizer.rb