require "objc2swift_assistant/version" require "objc2swift_assistant/code_recognizer" module Objc2swiftAssistant DIRECTIVE_REGEX = /^\s*@(?((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