Sha256: ddc67c9a7ea2068b450ef76d234f320cd7835419b7e13558a7cbc125fadcdebb

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

require "objc2swift_assistant/version"

require "objc2swift_assistant/code_recognizer"

module Objc2swiftAssistant

  DIRECTIVE_REGEX = /^\s*@(?<directive>((required)|(optional)|(public)|(private)|(protected)))/

  class AtDirectiveRecognizer < CodeRecognizer
    def initialize( )
      super( DIRECTIVE_REGEX, AtDirectiveRegion, :all_source_files, false )
    end
  end


  class AtDirectiveRegion < MigrationRegion
    attr_accessor :directive_symbol

    def initialize(starting_line_number, is_root_entity )
      super(starting_line_number, is_root_entity, AT_DIRECTIVE_KEY, can_occur_in_class_decl:true )
      @is_single_line = true
      @directive_symbol = nil
    end

    def extract_information( file_slice )
      m = DIRECTIVE_REGEX.match(file_slice[0])
      unless m.nil?
        @directive_symbol = m[ 'directive' ].to_sym
      end
    end

    def brief_description()
      return "@#{@directive_symbol.to_s}"
    end

    def description()
      generic_description( "Objective-C directive @#{@directive_symbol.to_s}" )
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

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