 class Matcher {
     var src: String
     var recursive: Bool
-    var matched:((String,String,Int) -> (String,Int))?
-    init(src: String,recursive: Bool ,matched:((String,String,Int) -> (String,Int))?) {
+    var matched:((String,String,Int) -> (String,[NSObject : AnyObject]?))?
+    init(src: String,recursive: Bool ,matched:((String,String,Int) -> (String,[NSObject : AnyObject]?))?) {
         self.src = src
         self.matched = matched
         self.recursive = recursive

    return lhs.text == rhs.text && lhs.start == rhs.start
}

public class BumbleBee {
    
    var patterns = Array<Matcher>()
    
    public func add(pattern: String, recursive: Bool, matched: ((String,String,Int) -> (String,Int))?) {
        patterns.append(Matcher(src: pattern, recursive: recursive, matched: matched))
    }
    
    public func process(srcText: String) -> String {
        var pending = Array<Pattern>()
        var index = 0
        var text = srcText
        for char in text {

//

import Foundation
#if os(iOS)
import UIKit
#elseif os(OSX)
import Cocoa
#endif

//The support support class that keeps a track of the patterns while processing
class Pattern {
    var matched:((String,String,Int) -> (text: String,attrs: [NSObject : AnyObject]?))?
    var start = 0
    var length = -1
    var attrs: [NSObject : AnyObject]?
    var text: String
    var recursive: Bool
    var current: Character
    var mustFullfill = true
    var index = 0
    var rewindIndex = 0
    init(_ text: String, _ start: Int, _ recursive: Bool, _ matched: ((String,String,Int) -> (String,[NSObject : AnyObject]?))?) {
        self.mustFullfill = true
        self.recursive = recursive
        self.start = start
